Error deploying my app: NoModule called Psycopg2

Hey, folks

Iโ€™m building an app that collects data from a form and loads into a server DB.

When running in my localhost, everything works just fine, but when I try to deploy on streamlit, I keep on getting this error

2021-11-25 16:24:49.688 Uncaught app exception

Traceback (most recent call last):

  File "/home/appuser/venv/lib/python3.7/site-packages/streamlit/script_runner.py", line 354, in _run_script

    exec(code, module.__dict__)

  File "/app/mdgeo_controle_horas/app.py", line 5, in <module>

    import controllers.HoursController as HoursController

  File "/app/mdgeo_controle_horas/controllers/HoursController.py", line 1, in <module>

    import services.database as db

  File "/app/mdgeo_controle_horas/services/database.py", line 1, in <module>

    import psycopg2

ModuleNotFoundError: No module named 'psycopg2'

See, I uploaded the requeriments file with both psycopg2 and psycopg2-binary, but I keep on getting the error.

Controllers and Services import are .py files that I created and also uploaded with the code, you can see the repository here.

I set everything in my streamlit secrets and as I said above, in my localhost works just fine.

Does anyone know if these error are related to my scripts imports or the psycopg2 library? Is there any solution to this?

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