The project is done by me before 2 months and I deployed it using streamlit share then it worked well now when i opened it is giving this error

Summary

The project is done by me before 2 months and I deployed it using streamlit share then it worked well now when i opened it is giving this error. And also it is working well i run it on local server.

Steps to reproduce

Code snippet:

add code here

If applicable, please provide the steps we should take to reproduce the error or specified behavior.

Expected behavior:

It is working well when i run it on local server. When I checked logs it is checking for streamlit version and again updating some modules to higher versions which i didn’t mentioned in my requirements.txt.

Actual behavior:

KeyError: 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 565, in _run_script
    exec(code, module.__dict__)File "/app/olympics-data-analysis/app.py", line 84, in <module>
    nations_over_time = helper.data_over_time(df,'region')File "/app/olympics-data-analysis/helper.py", line 46, in data_over_time
    nations_over_time = df.drop_duplicates(['Year', col])['Year'].value_counts().reset_index().sort_values('index')File "/home/appuser/venv/lib/python3.9/site-packages/pandas/core/frame.py", line 6758, in sort_values
    k = self._get_label_or_level_values(by, axis=axis)File "/home/appuser/venv/lib/python3.9/site-packages/pandas/core/generic.py", line 1778, in _get_label_or_level_values

And also it is working well i run it on local server. When I checked logs it is checking for streamlit version and again updating some modules to higher versions which i didn’t mentioned in my requirements.txt.
If you’re seeing an error message, share the full contents of the error message here.

Debug info

  • Streamlit version: (get it with $ streamlit version) streamlit==1.18.1
  • Python version: (get it with $ python --version) python 3.11 i tried using other versions also but it is giving same error
  • Using Conda? PipEnv? PyEnv? Pex? pycharm virtual environment venv
  • OS version:
  • Browser version:

Requirements file

this is there in my requirements.txt and which is created in pycharm by creating virtual environment venv by giving required commands to get requirements.txt file

altair==4.2.2
attrs==22.2.0
blinker==1.5
cachetools==5.3.0
certifi==2022.12.7
charset-normalizer==3.0.1
click==8.1.3
colorama==0.4.6
contourpy==1.0.7
cycler==0.11.0
decorator==5.1.1
entrypoints==0.4
fonttools==4.38.0
gitdb==4.0.10
GitPython==3.1.30
idna==3.4
importlib-metadata==6.0.0
Jinja2==3.1.2
joblib==1.2.0
jsonschema==4.17.3
kiwisolver==1.4.4
markdown-it-py==2.1.0
MarkupSafe==2.1.2
matplotlib==3.6.3
mdurl==0.1.2
numpy==1.24.2
packaging==23.0
pandas==1.5.3
Pillow==9.4.0
plotly==5.13.0
protobuf==3.20.3
pyarrow==11.0.0
pydeck==0.8.0
Pygments==2.14.0
Pympler==1.0.1
pyparsing==3.0.9
pyrsistent==0.19.3
python-dateutil==2.8.2
pytz==2022.7.1
pytz-deprecation-shim==0.1.0.post0
requests==2.28.2
rich==13.3.1
scikit-learn==1.2.1
scipy==1.10.0
seaborn==0.12.2
semver==2.13.0
six==1.16.0
smmap==5.0.0
streamlit==1.18.1
tenacity==8.2.0
threadpoolctl==3.1.0
toml==0.10.2
toolz==0.12.0
tornado==6.2
typing_extensions==4.4.0
tzdata==2022.7
tzlocal==4.2
urllib3==1.26.14
validators==0.20.0
watchdog==2.2.1
zipp==3.12.1

Using Conda? PipEnv? PyEnv? Pex? Share the contents of your requirements file here.
Not sure what a requirements file is? Check out this doc and add a requirements file to your app.

Links

Additional information

If needed, add any other context about the problem here.
Screenshot 2023-07-06 134843


please give suggestions with which i can solve my problem

Hi @RushiAadepu,

Thanks for posting!

FYI, the repo you shared is private so we cannot access it to replicate the issue.

Based on the error logs, it seems that the index column is not found in your DataFrame.

Can you make your code accessible?

Sorry. Now I made it public.
and I want to clarify that this app is running perfectly in my local server and after the deployment also it worked well but recently when I opened deployed app link it is giving this error. I’m not getting suddenly what happened.

There is a known issue on Community Cloud where pinning Streamlit to version 1.19 or lower will cause some packages to be reinstalled after your requirements file is resolved. This can cause undesirable upgrades in some packages (namely, all of altair’s dependencies). If you are able to increase your Streamlit version to at least 1.20, you can avoid this issue prior and respect the remainder of your pins.