ModuleNotFoundError: psycopg2, the data connection works on local drive, but not on Streamlit Cloud

Hi @frances :wave:

Streamlit looks at your requirements file’s filename to determine which Python dependency manager to use in the order below. Streamlit will stop and install the first requirements file found.

Filename Dependency Manager Documentation
Pipfile pipenv docs
environment.yml conda docs
requirements.txt pip docs
pyproject.toml poetry docs

What’s happening is that Streamlit parses your Pipfile containing no packages, and exits the installation process – entirely skipping your requirements.txt.

Once you delete the Pipfile from your repo, Streamlit will install the Python dependencies specified in requirements.txt, including the psycog2-binary package.

Source: App dependencies - Streamlit Docs

Happy Streamlit-ing! :balloon:
Snehan

2 Likes