pythonjoblibpython-3.11

Joblib Error After Upgrading From Python3.10 to python3.11


After updating from python3.10 to python3.11, a simple command like the following:

joblib.load("test.pkl")

Fails with error

TypeError: '>' not supported between instances of 'NoneType' and 'sys.version_info'

Full error:

  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.11/dist-packages/joblib/numpy_pickle.py", line 658, in load
    obj = _unpickle(fobj, filename, mmap_mode)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/joblib/numpy_pickle.py", line 577, in _unpickle
    obj = unpickler.load()
          ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/pickle.py", line 1213, in load
    dispatch[key[0]](self)
  File "/usr/lib/python3.11/pickle.py", line 1538, in load_stack_global
    self.append(self.find_class(module, name))
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/pickle.py", line 1580, in find_class
    __import__(module, level=0)
  File "/usr/local/lib/python3.11/dist-packages/category_encoders/__init__.py", line 9, in <module>
    from category_encoders.backward_difference import BackwardDifferenceEncoder
  File "/usr/local/lib/python3.11/dist-packages/category_encoders/backward_difference.py", line 4, in <module>
    from patsy.contrasts import Diff
  File "/usr/local/lib/python3.11/dist-packages/patsy/__init__.py", line 77, in <module>
    import patsy.highlevel
  File "/usr/local/lib/python3.11/dist-packages/patsy/highlevel.py", line 19, in <module>
    from patsy.design_info import DesignMatrix, DesignInfo
  File "/usr/local/lib/python3.11/dist-packages/patsy/design_info.py", line 38, in <module>
    from patsy.desc import ModelDesc, Term
  File "/usr/local/lib/python3.11/dist-packages/patsy/desc.py", line 14, in <module>
    from patsy.eval import EvalEnvironment, EvalFactor
  File "/usr/local/lib/python3.11/dist-packages/patsy/eval.py", line 36, in <module>
    _ALL_FUTURE_FLAGS = _all_future_flags()
                        ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/patsy/eval.py", line 32, in _all_future_flags
    if feature.getMandatoryRelease() > sys.version_info:

Attempted to update joblib to most recent version (1.4.0) but this did not fix the issue. (This is on Ubuntu if that is relevant in any regard)


Solution

  • You have to update pasty itself. Older versions of pasty are not compatible with python 3.11.