i got error message No module named ‘tensorflow’, this is my requiremnent.txt file content
This is the log
2024-02-08 17:00:42.035 Uncaught app exception
Traceback (most recent call last):
File “/home/adminuser/venv/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py”, line 565, in _run_script
File “/mount/src/cryptocurrency-predicition-app/project/main.py”, line 9, in
from keras.models import load_model
File “/home/adminuser/venv/lib/python3.11/site-packages/keras/init.py”, line 21, in
from keras import models
File “/home/adminuser/venv/lib/python3.11/site-packages/keras/models/init.py”, line 18, in
from keras.engine.functional import Functional
File “/home/adminuser/venv/lib/python3.11/site-packages/keras/engine/functional.py”, line 24, in
import tensorflow.compat.v2 as tf
ModuleNotFoundError: No module named ‘tensorflow’
2024-02-08 17:00:42.186 503 GET /script-health-check (10.12.48.32) 169.23ms
I already did it, i even deleted my app and deploy it again and still get the same results
Hi @Baghas_Wahyu . Just mention only the following packages in your requirements.txt as follows:-
#resr of your packages except matplotlib, numpy, scikit learn and keras
Hope it will works.
tensorflow==2.12.0 depends on
numpy<1.2 so you cannot install
numpy==1.24.3 at the same time. This information is available in the application logs.
i changed my requirments.txt file into this and yet same error
after i removed specified version numpy it still get same error
Could you try out with a small subset of libraries and then incrementally add the others afterwards (also make sure to reboot the app afterwards to ensure that the library gets installed).
requirements.txt works for me. Sometimes streamlit cloud doesn’t pick the changes to
requirements.txt until you reboot or redeploy the application.
that means i have to add library one by one is it correct?
It’s something that I would typically try if the bulk of libraries provided in requirements.txt file does not work. This would help to rule out which one works and which one does not.
As also mentioned earlier, it’s also worth trying to reboot the app after changes is made to the requirements.txt file in order to ensure that it gets installed.
@Goyo confirmed that your requirements.txt works, perhaps you can try rebooting the app.
Hope this helps