FileNotFoundError while Deploying streamlit app using GitHub repository to streamlit cloud

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 (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 556, in _run_script
    exec(code, module.__dict__)File "/app/portfolio/Portfolio/1_🏠Homepage.py", line 10, in <module>
    profile_pic =Image.open("/Portfolio/assets/prt.jpg")File "/home/appuser/venv/lib/python3.9/site-packages/PIL/Image.py", line 3092, in open
    fp = builtins.open(filename, "rb")

Hi @Praneeth-official, welcome to the community! :wave:

The error should be resolved if you remove the / before Portfolio. Replace the following lines 10, 22, 74:

profile_pic =Image.open(os.path.join("/assets/prt.jpg"))
lottie_coding = load_lottiefile("lottiefiles/coding.json")
lottie_hello = load_lottiefile("lottiefiles/hello.json")

with the following:

profile_pic =Image.open("Portfolio/assets/prt.jpg")
lottie_coding = load_lottiefile("Portfolio/lottiefiles/coding.json")
lottie_hello = load_lottiefile("Portfolio/lottiefiles/hello.json")

Once you make the above changes to the filepaths, your app should successfully deploy :balloon:

2 Likes

Thank you very much @snehankekre.The problem has been resolved.Lots of thanks :)))))

1 Like

hello, I have the same error here I am trying to deploy the app on the cloud its says

File "/app/diseases-prediction/main.py", line 15, in <module>
    diabetes_model = pickle.load(open('D:\Work\MachineLearning\DeployingMachineLearningmodel\diabetes_model.sav','rb'))

and file exists in the specific path why was this error encountered ? while on localhost its running 
FileNotFoundError: [Errno 2] No such file or directory: 'D:\\Work\\MachineLearning\\DeployingMachineLearningmodel\\diabetes_model.sav'

You don’t have access to the Client’s computer, if streamlit runs in a hosted environment.

6 posts were split to a new topic: FileNotFound Error in Deployed App

how can I solve this problem?
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 (if you’re on Streamlit Cloud, click on ‘Manage app’ in the lower right of your app).

this is my repo GitHub - Parham-Esmailzadeh/Stock-Prediction

Traceback:

> File "/home/adminuser/venv/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 541, in _run_script
>     exec(code, module.__dict__)File "/mount/src/stock-prediction/main.py", line 4, in <module>
>     import yfinance as yfFile "/home/adminuser/venv/lib/python3.11/site-packages/yfinance/__init__.py", line 23, in <module>
>     from .ticker import TickerFile "/home/adminuser/venv/lib/python3.11/site-packages/yfinance/ticker.py", line 29, in <module>
>     from .base import TickerBaseFile "/home/adminuser/venv/lib/python3.11/site-packages/yfinance/base.py", line 38, in <module>
>     from . import utilsFile "/home/adminuser/venv/lib/python3.11/site-packages/yfinance/utils.py", line 991, in <module>
>     class _KV(_peewee.Model):File "/home/adminuser/venv/lib/python3.11/site-packages/yfinance/utils.py", line 995, in _KV
>     class Meta:File "/home/adminuser/venv/lib/python3.11/site-packages/yfinance/utils.py", line 996, in Meta
>     database = _DBManager.get_database()
>                ^^^^^^^^^^^^^^^^^^^^^^^^^File "/home/adminuser/venv/lib/python3.11/site-packages/yfinance/utils.py", line 953, in get_database
>     cls._initialise()File "/home/adminuser/venv/lib/python3.11/site-packages/yfinance/utils.py", line 972, in _initialise
>     _os.mkdir(cls._cache_dir)
> ```

I think this is a different sort of error that seems to be related to yfinance, and should be solved by upgrading to a newer yfinance release Fix for yfinance > 0.2.28 on Community Cloud -- /home/appuser/.cache/py-finance FileNotFound