Limitations on package installation (indsl library) when making Streamlit apps in CDF
we're trying to build an app in streamlit (integrated in cognite). We will be having some calculations on timeseries using indsl library and building some dashboards on top of it in this app
When we try to install indsl package in streamlit we're getting the below error:
"
Error during booting up
Traceback (most recent call last):
File "/lib/python3.11/site-packages/micropip/_commands/install.py", line 146, in install
raise ValueError(
ValueError: Can't find a pure Python 3 wheel for: 'pandas<2.3.0,>=2.2.0'
we understand in general there is some limitation when using streamlit in cognite apps due to it being based on pyodide for packages as mentioned in below topic:
This is what we're planning to do instead of having everything in streamlit: Use Cognite functions to compute things using indsl library and write result somewhere and use it in streamlit to make dashboards
We wanted confirmation if there is any better way than this
Page 1 / 1
.
yes, thank you!
Hi @Sangavi M,
Did the above information was helpful ?
Hi Sangavi,
As you've noted, importing InDSL into Pyodide-based environments (like Streamlit) is challenging due to the dependencies that are not readily available on Pyodide. We're aware of this limitation and understand the inconvenience it causes.
Your proposed solution to use Cognite Functions to handle computations with the InDSL library and then use the results in Streamlit for dashboarding is a valid approach. This method utilizes Cognite Functions as a backend service, where you can perform your calculations and then visualize the results in Streamlit.
That being said, there are some workarounds to bypass the import limitations directly within Streamlit, although they are not very elegant. Here’s an example code snippet that manages to import indsl into streamlit (you’ll have to add plotly as a dependency before trying this out):
You might need to adapt the time series filter to the particular CDF project where you are testing this in. Here's a screenshot of how this looks like: