Here’s another component featuring Pandas Profiling. The initial request I found came from here: Including Pandas Profiling Report in Streamlit - #6 by noklam.
A small detail about this component: it resizes according to its content thanks to this iframe-resizer project. No need to choose a height to display the report, no scrolling, it embeds seamlessly to the page.
Unfortunately, the navbar does not work as page anchors are not supported from iframes. I’ve disabled it in consequence.
You can find all instructions to install and test the component in my repository:
Are you sure you installed my component in the same python environment where you installed the streamlit wheel?
Thank’s for clarifying now it is work and thank’s for sharing
I tried to run as per the requirements above and I’ve got the following error:
AttributeError: module 'streamlit' has no attribute 'declare_component'
streamlit nightly - not sure whether I needed to be part of the closed Beta for this?
Ah, yes you do need a special build @Charly_Wargnier. But if you’re in this area, then you should be in the beta already.
@tim has been building the Python packages locally, since he and the others were still developing and didn’t want people to be building things on a moving target (other than the people in the beta of course)
Do you have access to this page? https://www.notion.so/streamlit/Components-User-Docs-Public-4cabcc49623e4c8ab71db5a8eb782c3a
Thanks Randy! Yes I can see this page
Hehe yes cheers Randy!
I did a super quick test and had the following error (screenshot below) where Streamlit and Node are on different local hosts, thus expectedly throwing the ModuleNotFoundError
No module named 'streamlit.components':
I also had the another error during the npm install.
Failed to build pyarrow
ERROR: Could not build wheels for pyarrow which use PEP 517 and cannot be installed directly
Not sure whether the latter would have impacted the former.
I’ll try again this weekend!
Ah, bad timing! They were some recent API changes regarding components, and I guess you’re not using the latest beta 5 version. Uninstall your current streamlit version and download the latest components_beta5.zip archive.
As for the
pyarrow error, I haven’t encountered it. You could try to update wheel by doing:
pip install --upgrade wheel
I haven’t updated the wheel package yet, so you had the right idea to test it like you’re doing with node. I’ll try to update everything this week-end.
I updated to Beta 5, updated wheels and pip installed
pep517, yet still have the issue, that is, node and Streamlit sitting on different localhost ports
Not sure whether forcing both to be on the same port would #1 be possible and #2 resolve the issue?
I’ll try again later on a different laptop, see if t changes anything.
The fact that they’re running on different localhost ports is normal. Streamlit gets the component from 3001 and renders it on your page on port 8501. Have you changed the _RELEASE boolean to False ?
Thanks Synode for the precision!
I didn’t change anything yet checking the
__init__ file the boolean is already set to
Oh wait, maybe I haven’t understood what you’re trying to accomplish here. Are you trying to test my pandas profiling component or create a new one?
Hey, no worries!
I wanted to be able to play with this (see screenshot) on my local machine, and why not deploy it if possible!
Alright! Because you’re actually modifying the template code to create new components
If you want to test my component, you can build it like so:
- Make sure you’re inside the python env where you installed components_beta5
- If not done yet, install the dependencies with
pip install numpy pandas pandas-profiling
- Clone my repo
- Go to
streamlit_pandas_profiling/frontend and run
npm install and
- Then go back to the root folder, and run
python setup.py bdist_wheel
- You should now have a
dist/ folder where you’ll find a wheel package. Install it with
Now you can do
streamlit run demo/streamlit_pandas_profiling_demo.py.
That makes sense Synode! Thanks so much for such a detailed explanation, so useful!
I’ll keep you posted as soon as it’s worked. For now I’ve still got the
ModuleNotFoundError: No module named 'pandas_profiling'
Despite having it installed on all folders… Not sure what I’m doing wrong but I shall find out! That’s an excellent Streamlit/Python/Bash training for me!
Glad to see your motivation in this regard! As for pandas_profiling, that means you may have not run
pip install pandas-profiling in your python environment
Thank YOU for being so helpful!
So regarding the Pandas Profiling package, installation seems to freeze with pip. I ran the install for more than 5 minutes and here’s the final page:
I’ve tried that pip install in a clean folder as well. Same outcome, it remains frozen for about 5/10 minutes.
I think I just need to let it run for longer so the install can finish - I’ll try again tonight!
Note that I’ve tried to run
pip install pandas-profiling (hyphen) and not
pip install pandas_profiling (underscore, as you wrote above).
It’s indeed an hyphen, I fixed my previous post.
This freeze is weird. The installation shouldn’t take this long. If by any chance you use anaconda (or miniconda), you could try to install it with:
conda install -c conda-forge pandas-profiling