How to upgrade pip for cloud deployment

Hello,

I am getting an error when deploying my app to the cloud: “ImportError: Numba needs NumPy 1.24 or less”.

This is explained by an earlier error message in the log: “ERROR: pip’s dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.”

Specifically the conflict is: “numba 0.57.1 requires numpy<1.25,>=1.21, but you have numpy 1.25.0 which is incompatible.”

To try to fix this ‘manually’ I put ‘numpy==1.21’ at the top of my requirements.txt file but the same error persists, due to the pip dependency resolver issue. I would like to upgrade the pip version so that it will automatically resolve such dependency issues, but don’t know how to implement the suggestion from the log of: “You should consider upgrading via the ‘/home/appuser/venv/bin/python -m pip install --upgrade pip’ command.” How can I enter such a command when I’m hosting direct from a repo on streamlit cloud?

Failing that, any suggestions for how to manually ‘force’ numpy==1.21 would also be greatly appreciated.

For info it is running on Python 3.9 (and has to for now) and the other warning message from the log shows the pip version: “WARNING: You are using pip version 22.0.3; however, version 23.1.2 is available.”

Thanks in advance, happy to provide more info.

Here’s the requirements.txt file (apologies, project can’t currently be publicly shared):

numpy==1.21
folium>=0.12.1.post1
geopandas==0.10.2
wget==3.2
streamlit==1.11.1
pygeos
jupyter
leafmap==0.10.3
aquacrop>=2.2
streamlit-folium==0.6.14
aquacropeto==0.1.1
stqdm==0.0.4
plotly==5.8.0
earthengine-api==0.1.312
matplotlib
seaborn
geemap==0.16.1
cffi==1.15.0
xarray
zarr
gcsfs
cftime
nc-time-axis
streamlit-aggrid
branca
ipywidgets==8.0.0
pandas==1.5.3
altair==4.2.2
cchardet

I don’t think pip is the problem. The error message is probably misleading. A newer version of pip would not be able to resolve the probably unresolvable conflicts in your dependencies either. But for that we would have to see your project…

Thanks for the quick reply, I’ve included the requirements.txt info if that helps? The app deploys with no problems on localhost and until this week was working well on the cloud deployment. Could it be that dependencies have changed to create unresolvable conflicts?

any update how to resolve this?

so apparently i fix this by upgrading streamlit version to 1.24.0

Yes, thanks for sharing - that fixed it for me too!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.