Keep getting errors when unserializing

Traceback (most recent call last):
  File "/home/appuser/venv/lib/python3.8/site-packages/streamlit/", line 354, in _run_script
    exec(code, module.__dict__)
  File "/app/heart-failure-prediction/", line 38, in <module>
    explainer = joblib.load('explainer_all.jl')
  File "/home/appuser/venv/lib/python3.8/site-packages/joblib/", line 587, in load
    obj = _unpickle(fobj, filename, mmap_mode)
  File "/home/appuser/venv/lib/python3.8/site-packages/joblib/", line 506, in _unpickle
    obj = unpickler.load()
  File "/usr/local/lib/python3.8/", line 1212, in load
  File "/usr/local/lib/python3.8/", line 1589, in load_reduce
    stack[-1] = func(*args)
  File "/home/appuser/venv/lib/python3.8/site-packages/numba/core/", line 97, in _unpickle__CustomPickled
    ctor, states = loads(serialized)
AttributeError: Can't get attribute '_rebuild_function' on <module 'numba.core.serialize' from '/home/appuser/venv/lib/python3.8/site-packages/numba/core/'>

I tried to set python to 3.8 as same as on my Mac(app works well locally), tried to use pickle and joblib, both are not working, same errors occured.

Does anyone get same issue?

Hi @Sunix_Liu -

I don’t quite know what to suggest to fix this, but in general, if the Python versions match but Python still gives errors, it’s usually something to do with a missing class definition or other reference.

The traceback shows that Numba is part of the problem…is the proper version of Numba imported into your session?


1 Like

Thank you @randyzwitch, I just updated all packaged to their latest version and regenerated the models, then redeployed to the streamlit cloud,it’s working now!