Presently, I'm attempting to configure Django for use on a project, and am encountering a persistent error when I try to run python manage.py syncdb
.
File "/x/x/x/x/x/x/base.py", line 23, in ?
raise ImproperlyConfigured("Error loading psycopg module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading psycopg module: No module named psycopg
The other discussions of a similar problem that I have found both here and on other sites ended up being solved by the user downloading and installing psycopg, but unless I'm missing something critical, I've done that several times. I downloaded the tarball, unpacked it on my server, ran python setup.py build
and python setup.py install
with a --prefix directing it to my existing Python Path...I can go and navigate to the folder and see the various psycopg files, but for whatever reason, when I try to get my new project to sync up with the database, it cannot find psycopg and, as a result, won't talk to the db.
Notes: hostmonster.com account, have tried multiple release versions of psycopg2.
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).
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
type pip install psycopg2-binary
inside the virtualenv worked for me
Try to use this:
sudo apt-get install python-psycopg2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With