File not found error for an app that was working previously

Hi,

My app that I had deployed 4 months ago suddenly started showing file not found error. I have a csv file in my git repo and is in the same repo as the .py code. Why would it suddenly stop working?
Would appreciate help debugging.


My github repo - ai-accelerators/streamlit_app.py at main · dubey031/ai-accelerators · GitHub

Hi @dubey031 , did you check the logs in the terminal in the bottom right corner of streamlit cloud?

Without the exact error message, one can only speculate. But while we’re at it, I suspect it’s a simple path error. The paths to files that are loaded must be relative to the root folder of the github repository. Because that’s also where the streamlit app is launched from.

@willhuang - Yes, in the logs there are warnings while loading libraries but at the end there is a file not found error.
@Franky1- correct. I made some changed to the path and now it is giving me another error.
ValueError: Value of 'y' is not the name of a column in 'data_frame'. Expected one of ['customers', 'count'] but received: Feature_name

For this I printed my dataframe and it has all the necessary columns.
I do not understand why suddenly the app which was working fine for months id now throwing errors.

Hi @dubey031

Would be happy to help, but requires some additional information as your provided code does not include a df called ‘data_frame’ or let me know if i missed it! Also I would recommend you open a new topic as the title relates to a different issue that you noted was a user error related to path which was resolved.

I just wanted to note that locally I can run your .py file with your .csv file without any issues.

The only couple things, without more information, I can think of could be:
0. you call .reset_index() on your dataframe → if rerunning this code multiple times and you keep your df in memory it might create a new column maybe add df.reset_index(drop=True) or add additional logic to validate

df_reset1 = df.reset_index()
   index  A  B
0      0  1  4
1      1  2  5
2      2  3  6
df_reset2 = df_reset1.reset_index()
   level_0  index  A  B
0        0      0  1  4
1        1      1  2  5
2        2      2  3  6

As you can see, calling .reset_index() can cause undesired behavior. However, if you don’t want to keep the previous index as a column, you can use the drop=True parameter like df.reset_index(drop=True). This will remove the previous index column.

  1. your requirements.txt has outdated streamlit package

    • i have streamlit version 1.21.0 installed, you have streamlit==1.19.0
  2. you made changes to code but did not push your latest code to Github?

If you can add a screenshot of the error message and note the code which has the ‘date_frame’, will look into it!

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