If you are running superset inside a virtualenv, try to install psycopg2 at system level. Also, install psycopg2-binary package.

Answer from motilio on Stack Overflow
🌐
GitHub
github.com › apache › superset › discussions › 31431
ModuleNotFoundError: No module named 'psycopg2' during k8 installation · apache/superset · Discussion #31431
To resolve the "ModuleNotFoundError: No module named 'psycopg2'" error during the deployment of Superset using a Helm chart, you should ensure that the correct version of psycopg2 is pinned.
Author   apache
Discussions

superset 6.0.0rc1 use External database ,error。ModuleNotFoundError: No module named 'psycopg2'
Bug description use helm chart . loded your LOCAL configuration at [/app/pythonpath/superset_config.py] 2025-09-02 13:38:46,517:ERROR:superset.app:Failed to create app Traceback (most recent call l... More on github.com
🌐 github.com
3
September 2, 2025
Helm upgrade from 4.0.2 -> 4.1.1 fails as psycopg2 is no longer bundled into lean Superset image
Loaded your LOCAL configuration ...cts/postgresql/psycopg2.py", line 811, in dbapi import psycopg2 ModuleNotFoundError: No module named 'psycopg2' Traceback (most recent call last): File "/usr/local/bin/superset", line 8, in sys.exit(superset()) File "/usr/local/lib/python3.... More on github.com
🌐 github.com
25
November 22, 2024
superset:latest image "No module named 'psycopg2'"
Bug description image id: 60e7a563bf20 Screenshots/recordings No response Superset version master / latest-dev Python version 3.9 Node version 16 Browser Chrome Additional context No response Check... More on github.com
🌐 github.com
9
February 11, 2025
Docker image for 4.1.1rc1 is missing python dependencies
Bug description Running the docker image for version 4.1.1rc1 fails with ModuleNotFoundError: No module named 'psycopg2'. Screenshots/recordings No response Superset version 4.1.0 Python ve... More on github.com
🌐 github.com
3
November 20, 2024
🌐
GitHub
github.com › apache › superset › issues › 32364
Docker compose No module named 'psycopg2' - 5.0.0rc1 · Issue #32364 · apache/superset
February 24, 2025 - Bug description During upgrading to new 5.0.0rc1 version is not possible due to No module named 'psycopg2'. Error: superset | File "/app/.venv/lib/python3.10/site-packages/sqlalchemy/dialects/postgresql/psycopg2.py", line 811, in dbapi s...
Author   apache
🌐
GitHub
github.com › apache › superset › issues › 34986
superset 6.0.0rc1 use External database ,error。ModuleNotFoundError: No module named 'psycopg2' · Issue #34986 · apache/superset
September 2, 2025 - superset 6.0.0rc1 use External database ,error。ModuleNotFoundError: No module named 'psycopg2'#34986
Author   apache
🌐
GitHub
github.com › apache › superset › issues › 31026
Helm upgrade from 4.0.2 -> 4.1.1 fails as psycopg2 is no longer bundled into lean Superset image · Issue #31026 · apache/superset
November 22, 2024 - Helm upgrade from 4.0.2 -> 4.1.1 fails as psycopg2 is no longer bundled into lean Superset image#31026
Author   apache
🌐
GitHub
github.com › apache › superset › issues › 32217
superset:latest image "No module named 'psycopg2'" · Issue #32217 · apache/superset
February 11, 2025 - Bug description image id: 60e7a563bf20 Screenshots/recordings No response Superset version master / latest-dev Python version 3.9 Node version 16 Browser Chrome Additional context No response Check...
Author   apache
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-fix-modulenotfounderror-no-module-named-psycopg2-in-python
How to Fix 'ModuleNotFoundError: No Module Named psycopg2' in Python - GeeksforGeeks
July 23, 2025 - Another reason for the error might be a typo or incorrect naming when trying to import the psycopg2 module. Python is case-sensitive, so ensure that the module name is spelled correctly. ... Below, are the approaches to solve “Modulenotfounderror: No Module Named ‘psycopg2′”.
🌐
Cloudera Community
community.cloudera.com › t5 › Support-Questions › Superset-No-module-named-psycopg2 › td-p › 211213
Solved: [Superset]: No module named psycopg2 - Cloudera Community - 211213
September 19, 2022 - Alternatively, We package superset with pygresql and you can change the connection URI to use that - postgresql+pygresql://user:password@host:port/dbname ... Thank you @Nishant Bangarwa! "No module psycopg2" solved! Though I am getting another error now: Error: Fatal: no pg_hba.conf entry for host "x.x.x.x", user "x", database "x", SSL off.
Find elsewhere
🌐
GitHub
github.com › apache › superset › discussions › 34186
ModuleNotFoundError: No module named 'psycopg2'" still not work · apache/superset · Discussion #34186
July 16, 2025 - RUN pip install --upgrade pip && pip install --no-cache-dir gevent psycopg2-binary redis pydoris pymysql
Author   apache
🌐
GitHub
github.com › apache › superset › issues › 30989
Docker image for 4.1.1rc1 is missing python dependencies · Issue #30989 · apache/superset
November 20, 2024 - Bug description Running the docker image for version 4.1.1rc1 fails with ModuleNotFoundError: No module named 'psycopg2'. Screenshots/recordings No response Superset version 4.1.0 Python ve...
Author   apache
🌐
Reddit
reddit.com › r/aws › no module named 'psycopg2._psycopg' when migrating lambda function from x86_64 to arm_64 architecture
r/aws on Reddit: No module named 'psycopg2._psycopg' when migrating lambda function from X86_64 to ARM_64 architecture
April 1, 2024 -

Has anyone experienced this before, I have a FastAPI python 3.11 server running on lambda and everything works fine when I have the architecture set to x86. Tried migrating to ARM though and now I see this error for some of my endpoints:

Runtime.ImportModuleError: Unable to import module 'main': No module named 'psycopg2.\_psycopg' Traceback
🌐
The Mail Archive
mail-archive.com › notifications@superset.apache.org › msg225580.html
Re: [I] ModuleNotFoundError: No module named 'psycopg2'" still not work [superset]
ckhatton-pvfscaffolding commented on issue #34185: URL: https://github.com/apache/superset/issues/34185#issuecomment-3275022605 · For anyone stumbling across this issue ticket, I found just running `uv pip install psycopg2-binary` as root inside the container got it working.
🌐
Reddit
reddit.com › r/django › why am i getting 'modulenotfounderror' after installing psycopg2 and running 'python manage.py migrate' in my django project?
Why am I getting 'ModuleNotFoundError' after installing psycopg2 and running 'python manage.py migrate' in my Django project? : r/django
November 25, 2024 - I think the package name was exactly `psycopg`, I'll check the project dependencies and edit the comment if it's wrong. ... I had something similar recently, and I needed libpq, which I installed with Homebrew: https://stackoverflow.com/questions/44654216/correct-way-to-install-psql-without-full-postgres-on-macos ... Why don’t you post the whole error traceback? It tells you which module was not found and why.
🌐
The Mail Archive
mail-archive.com › notifications@superset.apache.org › msg214903.html
Re: [D] ModuleNotFoundError: No module named 'psycopg2' during k8 installation [superset]
GitHub user NAJ8ry added a comment to the discussion: ModuleNotFoundError: No module named 'psycopg2' during k8 installation · There is a simple answer if you are hosting it with docker-compose - using the command option. Works a treat - my services is defined: remeody_superset: container_name: remeody_superset image: apache/superset:4.1.2 environment: - SUPERSET_CONFIG_PATH=/app/pythonpath/superset_config.py - POSTGRES_DB=${REMEODY_SUPERSET_DB} - POSTGRES_USER=${REMEODY_POSTGRES_USER} - POSTGRES_PASSWORD=${REMEODY_POSTGRES_PASSWORD} - POSTGRES_HOST=${REMEODY_POSTGRES_IP} - REDIS_HOST=remeody_redis - GUNICORN_CMD_ARGS="--timeout 300 --workers 2" # NB.
🌐
The Mail Archive
mail-archive.com › notifications@superset.apache.org › msg206455.html
Re: [I] Docker compose No module named 'psycopg2' - 5.0.0rc1 [superset]
February 24, 2025 - kenyodenes commented on issue #32364: URL: https://github.com/apache/superset/issues/32364#issuecomment-2680644398
🌐
The Mail Archive
mail-archive.com › notifications@superset.apache.org › msg219400.html
[I] ModuleNotFoundError: No module named 'psycopg2'" still not work [superset]
this is my Dockerfile below: -- ... that in Superset 5.0.0, uv is installed system-wide, not inside the virtual environment. You should just call uv directly, not with a path." but still show: "File "/app/.venv/lib/python3.10/site-packages/sqlalchemy/dialects/postgresql/psycopg2.py", line 811, in dbapi import psycopg2 ModuleNotFoundError: No module named 'psycopg2'" ...