Images not showing after deploy

Hello, everyone!
I’ve tried deploying an app using Streamlit Community Cloud but for some reason all the images are not showing. I tried moving all the files from a subfolder to the same folder level as the main page of my app but I have a 'file not found error ’ each time:

File "/home/adminuser/venv/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/", line 600, in _run_script
    exec(code, module.__dict__)File "/mount/src/online_courses-project/Streamlit_app/", line 21, in <module>'online_education.jpg')
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "/home/adminuser/venv/lib/python3.11/site-packages/PIL/", line 3277, in open
    fp =, "rb")

To display images I used this type of code:

from PIL import Image'online_education.jpg')

I also tried to simply use st.image(‘file_path’) but it didn’t work. I don’t understand what I did wrong because everything works perfectly well locally…
here’s the streamlit link:
and my github streamlit_repo
It’s my first time deploying an app so I’ll appreciate any help/insights you might have!

All file paths in streamlit cloud must be relative to the root folder of the github repo.

I’m not sure I understand what you mean… I put all my images in the same folder that contains the py file coding my app so the file path should be correct since they’re not in a subfolder and directly in the root folder off the app? All my pkl files were correctly detected when I accessed them in a similar way too

That doesn’t matter on streamlit cloud, because streamlit is invoked from the root folder of the git repo.

Always start the streamlit app from the root folder of the git repo. Then your streamlit app will also fail locally.'Streamlit_app/online_education.jpg')

Because they are sitting in the root folder of your git project.


Thank you so much!!! It works perfectly fine now :grin:
For some reason changing the file path to (‘Streamlit_app/image_name’) didn’t work but after moving the files to the root folder everything’s running smoothly.
Thanks for taking the time to explain everything it was really helpful!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.