Psycopg2 import issue | spent 2 days wrestling with this

Hi everyone!

When I run my app locally, it’s all good!

I’m trying to deploy my app on cloud and getting this error:

ModuleNotFoundError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you're on Streamlit Cloud, click on 'Manage app' in the lower right of your app).
Traceback:
File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script
    exec(code, module.__dict__)
File "/app/streamlit_news/app.py", line 5, in <module>
    import psycopg2

I tried adding it to my requirements.txt:

psycopg2-binary==2.8.6

My folder structure is:

streamlit_app

.streamlit
.gitignore
app.py
requirements.txt

I feel like I did everything correctly! What’s the problem here? My import statements look like this:
app.py

import streamlit as st
import pandas as pd
import warnings
import datetime
import psycopg2

Please help! Thank you so much!

Hey @ccglz,

Can you share the full contents of your requirements.txt file so we can try to reproduce the issue?