Eureka! I pulled my hair out for 2 days trying to get this to work. Enlightenment came from this SO Question. Simply stated, you probably installed psycopg2 x64 version like I did, not realizing your python version was 32-bit. Unistall your current psycopg2, then:

Download: psycopg2-2.6.1.win32-py3.4-pg9.4.4-release.exe from HERE, then run the following in a Terminal:

C:\path\to\project> easy_install /path/to/psycopg2-2.6.1.win32-py3.4-pg9.4.4-release.exe
C:\path\to\project> python manage.py makemigrations
C:\path\to\project> python manage.py migrate

You may also need to (re)create super user with:

C:\path\to\project> python manage.py createsuperuser
Answer from Matthew Weber on Stack Overflow
Discussions

ModuleNotFoundError: No module named 'psycopg2._psycopg'. Please check the requirements.txt file for the missing module.
Hi Team, When tested locally, the python function app referring to the library psycopg(2) is working fine, but while deploying the same function app via CI/CD pipeline, we are getting the below error , while testing it ModuleNotFoundError: No module… More on learn.microsoft.com
🌐 learn.microsoft.com
1
0
July 7, 2023
Error loading psycopg2 module: No module named 'psycopg2'
Hi all, First of all, I've read all the posts I could find about this problem to no avail :( I've got an up&running default webapp with python3 and django already working with default d... More on github.com
🌐 github.com
9
May 26, 2021
Python 3.11.0 ModuleNotFoundError: No module named 'psycopg2._psycopg' 🐛
Bug Report At what date and time did you most recently experience the problem? 2022-12-22T15:52:45.994388013Z Where did you experience the problem? E.g. Azure Web Apps, Azure Functions, Azure Conta... More on github.com
🌐 github.com
21
December 22, 2022
Why am I getting 'ModuleNotFoundError' after installing psycopg2 and running 'python manage.py migrate' in my Django project?
163K subscribers in the django community. News and links for the Django community. More on reddit.com
🌐 r/django
14
2
November 25, 2024
🌐
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′”.
🌐
Microsoft Learn
learn.microsoft.com › en-us › answers › questions › 1326206 › modulenotfounderror-no-module-named-psycopg2-psyco
ModuleNotFoundError: No module named 'psycopg2._psycopg'. Please check the requirements.txt file for the missing module. - Microsoft Q&A
July 7, 2023 - python3.9 -m venv worker_venv source worker_venv/bin/activate sudo apt-get update sudo pip3 install --upgrade pip sudo apt install build-essential libpq-dev python3-dev sudo pip3 install psycopg2 --upgrade sudo pip3 install psycopg2-binary --upgrade sudo pip3 install --target="./.python_packages/lib/site-packages" psycopg2 --upgrade sudo pip3 install --target="./.python_packages/lib/site-packages" psycopg2-binary --upgrade sudo pip3 install --target="./.python_packages/lib/site-packages" -r ./requirements.txt --upgrade
🌐
GitHub
github.com › psycopg › psycopg2 › issues › 1282
Error loading psycopg2 module: No module named 'psycopg2' · Issue #1282 · psycopg/psycopg2
May 26, 2021 - (env) PS D:\Users\llagos.NB-KEYONE15\Visual Studio projects\ecommerce-psql> python manage.py makemigrations Traceback (most recent call last): File "D:\Users\llagos.NB-KEYONE15\Visual Studio projects\ecommerce-psql\env\lib\site-packages\django\db\backends\postgresql\base.py", line 25, in import psycopg2 as Database ModuleNotFoundError: No module named 'psycopg2' ...
Author   psycopg
🌐
GitHub
github.com › microsoft › Oryx › issues › 1767
Python 3.11.0 ModuleNotFoundError: No module named 'psycopg2._psycopg' 🐛 · Issue #1767 · microsoft/Oryx
December 22, 2022 - Bug Report At what date and time did you most recently experience the problem? 2022-12-22T15:52:45.994388013Z Where did you experience the problem? E.g. Azure Web Apps, Azure Functions, Azure Conta...
Author   microsoft
Find elsewhere
🌐
Bobby Hadz
bobbyhadz.com › blog › python-no-module-named-psycopg2
ModuleNotFoundError: No module named 'psycopg2' in Python | bobbyhadz
April 8, 2024 - The Python "ModuleNotFoundError: No module named 'psycopg2'" occurs when we forget to install the psycopg2-binary module before importing it or install it in an incorrect environment.
🌐
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 - Despite the lack of number in the package name, this package is the successor of psycopg2. Please use the psycopg2 package if you are maintaining an existing program using psycopg2 as a dependency. If you are developing something new, Psycopg 3 is the most current implementation of the adapter.
🌐
Django Forum
forum.djangoproject.com › using django › deployment
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: No module named 'psycopg2._psycopg' - Deployment - Django Forum
November 11, 2022 - My site was working well in cpanel. when i add it to google search console for seo, after one day I am seeing such error: We’re sorry, but something went wrong. The issue has been logged for investigation. Please try again later. Here is my Passengers.py file My os is Windows.
🌐
AWS re:Post
repost.aws › questions › QUfcS3lCR0RX6mWp7MVj3b0w › cannot-seem-to-import-psycopg2-in-aws-glue-3-0
Cannot seem to import psycopg2 in AWS Glue 3.0 | AWS re:Post
May 11, 2022 - If you prefer to avoid building psycopg2 from source, please install the PyPI 'psycopg2-binary' package instead.
🌐
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
🌐
GitHub
github.com › jkehler › awslambda-psycopg2 › issues › 47
Lambda Import Error: No module named 'psycopg2._psycopg' · Issue #47 · jkehler/awslambda-psycopg2
August 2, 2019 - FROM lambci/lambda:build-python3.7 ENV \ POSTGRES_VER=11.4 \ PSYCOPG_VER=2.8 \ PSYCOPG_VER_PATH=PSYCOPG-2-8 \ PYTHON_VER=3.7 RUN yum install -y wget tar makecache fast automake16 #setup output dir for library extraction RUN mkdir /var/output # PSYCOPG2 WORKDIR /var/psycopg RUN wget -nv https://ftp.postgresql.org/pub/source/v${POSTGRES_VER}/postgresql-${POSTGRES_VER}.tar.gz RUN tar -zxf postgresql-${POSTGRES_VER}.tar.gz RUN wget -nv http://initd.org/psycopg/tarballs/${PSYCOPG_VER_PATH}/psycopg2-${PSYCOPG_VER}.tar.gz RUN tar -zxf psycopg2-${PSYCOPG_VER}.tar.gz # build postgres RUN cd postgresql-
Author   jkehler
🌐
Dynatrace Community
community.dynatrace.com › t5 › Extensions › Error-No-module-named-psycopg2-psycopg › m-p › 199379
Solved: Re: Error: No module named 'psycopg2._psycopg' - Dynatrace Community
November 29, 2022 - You need to use python 3.8 to build your extension, because that is the python version that is bundled with the Activegate and OneAgent.
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-fix-no-module-named-psycopg2-in-python-aws
How to Fix 'No Module Named psycopg2' in Python AWS - GeeksforGeeks
July 23, 2025 - The error "No module named psycopg2" in AWS Lambda occurs when the Lambda function is unable to locate the psycopg2 library, which is essential for interacting with PostgreSQL databases from Python code.
🌐
YouTube
youtube.com › watch
How to Resolve ModuleNotFoundError: No module named 'psycopg2._psycopg' in Python - YouTube
Having trouble with the error "ModuleNotFoundError: No module named 'psycopg2._psycopg'" in Python? Discover the steps to resolve it, especially on Windows.-...
Published   January 20, 2025
Views   62
🌐
Django Forum
forum.djangoproject.com › using django › mystery errors
psycopg2 Error loading psycopg2 or pyscopg module - Mystery Errors - Django Forum
May 12, 2024 - Hello, im trying to use postgres to my django app and im following a tutorial, im on an activated virtual enviroment and i’ve installed psycopg2==2.9.9 psycopg2-binary==2.9.9 (this is from my requirements.txt file) then i modified the settings from my project to this DATABASES = { ‘default’: ...
🌐
Tutorial Reference
tutorialreference.com › python › examples › faq › python-error-modulenotfounderror-no-module-named-psycopg2
How to Resolve "ModuleNotFoundError: No module named 'psycopg2'" in Python | Tutorial Reference
The ModuleNotFoundError: No module named 'psycopg2' is a common Python error indicating that the interpreter can not find the psycopg2 library, which is the most popular PostgreSQL database adapter for Python. This usually means the necessary package hasn't been installed correctly in the active ...