Problem deploying my app on streamlit

Hi, I’m trying to deploy a streamlit dashboard and I’m running into an issue I’m hoping can help me with.

In my app I use the SHAP library, which recently got some version issues with numpy, so I have to keep numpy <= 1.24. In my requirements, I ofc precised all of that. I’m also running streamlit with the streamlit-extras library, which requires Altair < 5 and Streamlit == 1.14.0.

Now the issue I’m running into is, all my dependencies get installed properly and should work, however after installing all the packages, Streamlit runs a check “Checking if Streamlit is installed”.
And when that happens, it detects that there already is, but it also notices that for altair to work with my version of streamlit, Altair needs to be < 5.
And so it runs this message :

Found Streamlit version 1.14.0 in the environment

Streamlit 1.14.0 is present which is incompatible with altair>=5.0.0. Installing altair 4.*

And then proceeds to reinstall altair, even though it is already installed with a compatible version, and while doing so reinstalls its dependencies, and in particular, numpy==1.25.0, which then cause my code to crash because this version of numpy is not compatible with the shap library.

I don’t know how I can stop streamlit from reinstalling this as it seems to do it automatically.

Thanks for your help.

Please share your github repo link, otherwise we are poking around in the dark.

Here’s the repositery if that helps, I thought it was more of an issue with the way streamlit works though.

I’m only trying to deploy the dashboard for now

If i am running pip install -r requirements.txt with your file in a clean environment (docker container) i get no conflicts. Therefore i assume that the streamlit cloud runtime enforces the installation of specific versions. Have you tried to delete and re-deploy your app?

Besides your issue i recognized that you are using flask in your repo. AFAIK it is not possible to run an API server on streamlit cloud.

I have yeah,
as I noted in the original post, it seems when streamlit detects that i’m using streamlit==1.14.0, it reinstalls altair==4.2.2 to make sure it’s compatible. I wonder if there’s any way to prevent it from doing that ?

Yeah I’m aware of that and planning on running the API separately.

Still no idea from anyone ? I’m really having a hard time finding an alternative…

I would just need to stop altair from reinstalling with all its dependencies but I have no idea how that’s doable

I think this is related to a bug I’m trying to track down with the cloud team. You can get around it by using the latest version of Streamlit, but pinning an older version of Streamlit causes an error parsing other dependencies.


Hi ! Alright good to know I was not getting crazy and there was actually an issue here. At first I wasn’t using the latest version of streamlit because streamlit-extras specified an older version to keep working, but it seems it still works even with the latest version of streamlit, so everything has been running fine now, thanks a lot !

1 Like

@mathcatsand I wonder if this has been fixed? I also recently notice that my app is running fine locally but not on cloud anymore. Although I specify in the requirements.txt a specific numpy version (1.19.2) it gets overwritten to 1.24.4. I tried some fixes I saw on these forums, e.g., using the most recent streamlit version, but it still enforces numpy above the requirement. Many thanks on your help


I have reported the issue and it’s being tracked, but I don’t have an ETA on when it will be addressed for sure. I was able to further refine my understanding though: this bug is triggered if your requirements file results in streamlit <=1.19. So you should be able to pin as far back as 1.20 without triggering the bug.

What happens when Community Cloud detects Streamlit is version 1.19 or lower is that altair<5 gets installed afterwards, all by itself. So it’s altair’s dependencies in particular that get upgraded, even if altair was already pinned and installed at a compatible version. This is a workaround because altair wasn’t pinned in Streamlit’s dependencies at the time. I’m watching the ticket for when they patch the workaround. The hope is that (once patched) users will be able to avoid the error by pinning the correct version of altair themselves. I will definitely post an update when I get confirmation that it’s fixed or have a definitive schedule.

To prevent Streamlit from automatically reinstalling dependencies, ensure you are using a virtual environment for your app. Specify precise dependency versions in your requirements.txt or pyproject.toml . This prevents Streamlit from updating dependencies unnecessarily and causing compatibility issues.

Just to clarify, the issue is specifically with Streamlit Community Cloud. The container setup has some extra scripts involved which creates this unexpected behavior. At this time, specifying all dependencies and versions won’t be sufficient if using Streamlit version 1.19 or lower; altair<5 will be installed after the fact regardless, even if it’s already installed. I am continuing to watch the ticket for when this can get resolved. Fortunately, as we progress in versions, this issue will become less relevant.

For other deployment systems, yes, a proper list of package requirements through your package manager of choice should be just fine. :smiley:


remove version from streamlit in your requirements.txt file and push into github. it will solve your problem.