Hi,
My project here https://share.streamlit.io/damienld/rakuteam/main/Streamlit_rakuten/demo_rakuten.py works perfectly locall under a virtual environment with python 3.8.
But when I upload it here it says
FileNotFoundError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs.
File “/app/rakuteam/Streamlit_rakuten/creation_features.py”, line 28, in load_keywords_fromfile
with open(‘dico_keywords_tfidf_15.pkl’, ‘rb’) as handle:
How Can I check if my file’dico_keywords_tfidf_15.pkl’ was correctly uploaded? Is it a problem with pickle (but I don’t have any issue locally …)
Thans
Did you upload dico_keywords_tfidf_15.pkl in your github repo?
If you use with open(‘dico_keywords_tfidf_15.pkl’, ‘rb’) as handle:, then dico_keywords_tfidf_15.pkl should be in the relative path of where creation_features.py is.
Please share the repo if you still struggle.
Change the filepath to the pickle file on line 28 of creation_features.py to:
with open('Streamlit_rakuten/dico_keywords_tfidf_15.pkl', 'rb') as handle:
Also, replace opencv-python==4.5.3.56 with opencv-python-headless==4.5.3.56 to avoid:
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
Go through all your Python scripts and make sure to prepend Streamlit_rakuten/ to the paths of any files you open in them and just ensure you have the correct filepaths. e.g. Cnnimage_predict("Streamlit_rakuten/test2.jpg")
Hello, I was having a similar deploying a Streamlit app. At first it was issues with requirements files for cv2, but I think that is sorted, but now I am getting this error:
ModuleNotFoundError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs.
Traceback:
File “/home/appuser/venv/lib/python3.7/site-packages/streamlit/script_runner.py”, line 354, in _run_script
exec(code, module.dict)File “/app/smile_project/UI.py”, line 56, in
CNN_model = pickle.load(pickle_file)
For some context, I have a Keras object class ‘keras.engine.sequential.Sequential’ which I have created as a .pkl file and have it in the same directory as my python files. It works locally when I run the program, but does not work at deployment time. Leading up to this step there were also errors saying that I was missing Keras and tensor flow, which I added into my requirments.txt file.
I also did some snooping around Streamlit other Streamlit forums and found that sometimes the pickle error can occur when the model that you pickled was exported when using a different version of python than the one being used in Streamlit. I checked this, and this was the case, so I took the model out of google Colab, I trained it in Atom on my local python environment which is running python 3.7 and pickled it from there, and I still got the same error, when trying to deploy it on Streamlit. It works locally still but is still giving the same error.
File “/app/smile_project/UI.py”, line 47, in
with open(“CNN_Model_p7.pkl”, “rb”) as pickle_file:
ModuleNotFoundError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you're on Streamlit Cloud, click on 'Manage app' in the lower right of your app).
Traceback:
File “/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py”, line 562, in _run_script
exec(code, module.dict)File “/app/traffic_app/app.py”, line 17, in
lgb = pickle.load(pickle_in)
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.