Dependency Conflict Error in Streamlit - Need Help

Hello everyone,

I’m encountering a Dependency Conflict Error while working on my Streamlit app, and I could really use some help to resolve it.

Error Message:

Streamlit Error: Dependency conflict detected. The package `numpy` version 1.21.0 is incompatible with `pandas` version 1.3.0. Please upgrade or downgrade the necessary packages to resolve the conflict.

I’m trying to run a Streamlit app that involves heavy data manipulation and visualization. My app uses several Python libraries including numpy, pandas, and matplotlib. Here’s my requirements.txt:

streamlit==0.84.0
numpy==1.21.0
pandas==1.3.0
matplotlib==3.4.2

I searched for the error and came across this how to learn Python and according to this I need to check the compatibility of the versions of numpy and pandas on their official documentation. They should theoretically work together, but this error persists. I tried updating all packages to their latest versions using pip install --upgrade. This didn’t resolve the conflict and actually introduced new ones.

I also followed this How to resolve dependency error on streamlit cloud community deployed application, but didn’t get solution.

Are there specific versions of numpy and pandas known to work well together in a Streamlit environment?

Is there a better approach to managing dependencies in Streamlit projects to avoid these conflicts?

Thanks
Wilson

The best approach IMO is not specifying package versions unless you have a good reason to do it. What is your reason for specifying those particular versions?

i don’t think you successfully upgraded. According to ChatGPT:

The most current versions of numpy and pandas as of June 2024 are:

  • NumPy: The latest version is 2.0.0, which was released in June 2024.
  • Pandas: The latest version is 2.2.2, which was released in April 2024.

Hi @wilson
Try to keep numpy and pandas without mention its version in requirements.txt

Whether it is working in your local. Are you trying to deploy in streamlit cloud community

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