Error loading psycopg2 module: No module named 'psycopg2'

617 views
Skip to first unread message

Umar Abdulsattar

unread,
Mar 31, 2020, 8:03:15 PM3/31/20
to Django users
Hello fellows currently i am learning django and try to build and single webpage and also try to connect with postgresql but using adopter psycopg2 i face some problems like i find this error

 " File "C:\Program Files (x86)\Python37-32\lib\site-packages\django\db\backends\postgresql\base.py", line 24, in <module>
    raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: No module named 'psycopg2'"

Kindly guide me how i can fix it .

thank you.
Capture.PNG

Mike Dewhirst

unread,
Mar 31, 2020, 8:58:03 PM3/31/20
to django...@googlegroups.com
You need to install the psycopg2 module. For Windows you need a
pre-compiled binary. In your case it looks like the 32-bit version.

Visit the very generous Christophe Gohlke's page of pre-compiled binary
install kits for Windows at ..

https://www.lfd.uci.edu/~gohlke/pythonlibs/

You should bookmark that page.

Cheers

Mike

>
> Kindly guide me how i can fix it .
>
> thank you.
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users...@googlegroups.com
> <mailto:django-users...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/fabd9a82-b3de-4bab-923d-5366eee2dec4%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/fabd9a82-b3de-4bab-923d-5366eee2dec4%40googlegroups.com?utm_medium=email&utm_source=footer>.

Mike Dewhirst

unread,
Mar 31, 2020, 10:48:52 PM3/31/20
to django...@googlegroups.com
On 1/04/2020 11:56 am, Mike Dewhirst wrote:
> On 1/04/2020 10:53 am, Umar Abdulsattar wrote:
>> Hello fellows currently i am learning django and try to build and
>> single webpage and also try to connect with postgresql but using
>> adopter psycopg2 i face some problems like i find this error
>>
>>  " File "C:\Program Files
>> (x86)\Python37-32\lib\site-packages\django\db\backends\postgresql\base.py",
>> line 24, in <module>
>>     raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e)
>> django.core.exceptions.ImproperlyConfigured: Error loading psycopg2
>> module: No module named 'psycopg2'"
>
> You need to install the psycopg2 module. For Windows you need a
> pre-compiled binary. In your case it looks like the 32-bit version.
>
> Visit the very generous Christophe Gohlke's page of pre-compiled
> binary install kits for Windows at ..
>
> https://www.lfd.uci.edu/~gohlke/pythonlibs/

Maybe I should have pointed out that the install kit from that page you
probably want to download is ...

psycopg2‑2.8.4‑cp37‑cp37m‑win32.whl

The next step is to install it. Try this ...

>pip install --upgrade
%USERPROFILE%\Downloads\psycopg2‑2.8.4‑cp37‑cp37m‑win32.whl

... where %USERPROFILE% is (usually) substituted with your Windows home
directory. In my case it is C:\Users\Mike
Reply all
Reply to author
Forward
0 new messages