Bruno_A
December 28, 2022, 11:31am
1
I have the following error, could you please help me with the solution?
2022-12-28 08:24:39.298 Uncaught app exception
Traceback (most recent call last):
File “C:\Users\Bruno\anaconda3\lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py”, line 565, in _run_script
exec(code, module.dict )
File “C:\Users\Bruno\maintenance_app\maintenance_app.py”, line 29, in
modelo = load(‘classifier_binary.pkl’)
File “C:\Users\Bruno\anaconda3\lib\site-packages\joblib\numpy_pickle.py”, line 587, in load
obj = _unpickle(fobj, filename, mmap_mode)
File “C:\Users\Bruno\anaconda3\lib\site-packages\joblib\numpy_pickle.py”, line 506, in _unpickle
obj = unpickler.load()
File “C:\Users\Bruno\anaconda3\lib\pickle.py”, line 1212, in load
dispatchkey[0]
KeyError: 0
arnaud
December 28, 2022, 2:32pm
2
Hey @Bruno_A ,
Welcome to our forum!
When sharing code problems in the forum, please make sure to share a minimal context so we can understand what’s going on for instance, source code and what python/streamlit versions you’re using.
That being said, it seems like the error is coming from loading your pickled classifier, and that has no link with the streamlit library. Did a quick search and found that this may be a common issue when mistakenly using import joblib instead of from sklearn.externals import joblib. See this SO thread .
Best,
Bruno_A
December 28, 2022, 2:53pm
3
I solved the problem. The error is related to the machine learning models not being installed on the terminals. Thanks for the feedback.
Greetings!!
I tried all the best possible options still getting below error. Please advise.
Welcome to the Streamlit forum!
The issue is unrelated to Streamlit, please look through past forum threads on this topic and also consult the SO thread shared above: python - KeyError when loading pickled scikit-learn model using joblib - Stack Overflow
We try limiting posts on the Streamlit forum to Streamlit-specific issues. Additionally, please avoid tagging or DM’ing Streamlit staff and moderators.
We’re so glad you’ve found the Streamlit forum! Here are some guidelines to help you craft a thoughtful post that will receive helpful answers:
Use the search bar to see if someone has previously posted or answered your question.
Our forum is full of awesome community members like yourself who have shared their solutions for most errors and issues. There’s a good chance someone encountered a similar problem in the past and has posted on the forum.
If you’ve run into an error message, try…
system
Closed
April 5, 2024, 11:07am
6
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.