I built a simple app that for exploratory data analysis using pandas_profiling and streamlit_pandas_profiling Librairies. The app works well on the localhost but when deploying I have an error. here is my code and the error that I have while deploying
Here are the error while deploying
ImportError: 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 562, in _run_script
exec(code, module.__dict__)File "/app/data-analysis-app/CKD-Profiling.py", line 9, in <module>
import pandas_profiling as ppFile "/home/appuser/venv/lib/python3.9/site-packages/pandas_profiling/__init__.py", line 7, in <module>
from pandas_profiling.controller import pandas_decoratorFile "/home/appuser/venv/lib/python3.9/site-packages/pandas_profiling/controller/pandas_decorator.py", line 4, in <module>
from pandas_profiling.__init__ import ProfileReportFile "/home/appuser/venv/lib/python3.9/site-packages/pandas_profiling/__init__.py", line 8, in <module>
from pandas_profiling.profile_report import ProfileReportFile "/home/appuser/venv/lib/python3.9/site-packages/pandas_profiling/profile_report.py", line 11, in <module>
from pandas_profiling.model.describe import describe as describe_dfFile "/home/appuser/venv/lib/python3.9/site-packages/pandas_profiling/model/describe.py", line 11, in <module>
from pandas_profiling.model.correlations import calculate_correlationFile "/home/appuser/venv/lib/python3.9/site-packages/pandas_profiling/model/correlations.py", line 11, in <module>
from pandas.core.base import DataError
Looks like an incompatibility between the libraries pandas and pandas_profiling and should(?) be solved in later versions of pandas_profiling
As a first step i would remove all the version numbers in your requirements.txt file and try again:
If you have a current and working combination, you can also nail down the version numbers again, then there should be no problems with re-deployments in the future.
If you want to develop your Streamlit app further, note that it is recommended by the maintainers to switch to the ydata-profiling package:
Hi,
I have similar problem when trying to use streamlit-pandas-profiling and ydata-profiling in the deployed app.
However, the app is taking forever to load without loading. In the manager log it shows that it tries to load multiple versions of pandas trying to find a compatible one. It is stuck on these lines below:
Downloading pandas-1.3.4.tar.gz (4.7 MB)
━━━━━━ 4.7/4.7 MB 200.8 MB/s eta 0:00:00[2023-09-29 13:46:45.570066]
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Any suggestions on how to use the profiling function after removing streamlit_pandas_profiling from the code? I did remove it and below is the error I get.
NameError: 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.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 541, in _run_script
exec(code, module.__dict__)File "/app/clintrials/pages/2_Exploratory_Data_Analysis.py", line 60, in <module>
st_profile_report(pr)
^^^^^^^^^^^^^^^^^
Wait, I was conflating pandas-profiling with streamlit-pandas-profiling . Indeed the recommended way of integrating ydata-profiling and streamlit is using streamlit-pandas-profiling and ydata-profiling<=3.6.2, which apparently requires pandas==1.3.4. There are binary wheels for python from 3.7 to 3.10 so I guess you are using python 3.11?
Anyway streamlit-pandas-profiling seems to be a dead end…
Yes, I use python 3.11 and I need ydata-profiling and streamlit-pandas-profiling and found the ydata version limitation. So, I guess, I need to play with the versions to see which one is good or write the EDA from scratch, like old-school But, it works on my local machine with python 3.11. Will recheck the versions of everything.
Here are some (not quite ideal) alternatives to the pretty much obsolete streamlit-pandas-profiling:
Display the report inside an html or iframe component. It works but unfortunately the height of the component must be hardcoded, which causes ugly scrolling behavior.
Display the report using st.markdown with unsafe_allow_html=True. Doesn’t seem to work. It kills my browser, probably because of the javascript. Is it possible to get rid of it?
Display the report in its own browser tab. There is a lot of information in these reports so having a dedicated tab actually improves the UX in some ways. It may detract from it in other ways, though, but it is worth giving it a thought.
If you are ready to code, depending on your inclination, you might have more fun modernizing streamlit-pandas-profiling than writing yet another EDA framework.
By writing from scratch I meant to have a standalone page with a full EDA python code, but your last item sounds like a fun! Will definitely look into that option.
Thanks for your involvement!
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.