django.core.exceptions.ImproperlyConfigured: Error loading psycopg module: No module named psycopg
Solution 1:
I had the error as well; although psycopg2
was installed on my system using apt-get
, my virtualenv couldn't find it:
>>> import psycopg2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named psycopg2
It was fixed by doing a pip install psycopg2-binary
inside the virtualenv (or pip install psycopg2
for <2.8 psycopg2 versions).
Solution 2:
I had this problem on a virtualenv
in Ubuntu 18.4.
I solved it by installing psycopg2 v2.7.4:
pip install psycopg2==2.7.4
Solution 3:
type pip install psycopg2-binary
inside the virtualenv worked for me
Solution 4:
Try to use this:
sudo apt-get install python-psycopg2