0
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: No module named 'psycopg2'

how can resolv this issue .im alrady install psycopg2 in my vertualenv

AKX
  • 152,115
  • 15
  • 115
  • 172
  • 1
    If that happens and you're absolutely sure you've installed `psycopg2`, then your Django installation is not using that virtualenv. – AKX Nov 03 '21 at 21:19
  • Use `pip freeze` command to verify that required dependencies installed properly. – Shreeyansh Jain Nov 04 '21 at 03:54
  • @HabeebAlbedalkareem I had a similar problem. If you are using Linux the missing package `libpq-dev` may cause the problem. If a different version of `libpq` is installed you have to remove it and install the package `libpq-dev`. `psycopg2` needs the dependency of `libpq-dev`. For building python packages you need `build-essential` as well. However, try activating your virtualenv at first. – Klim Bim Nov 04 '21 at 07:30
  • This is duplicate question, would be good to search existing questions first https://stackoverflow.com/questions/8237842/django-core-exceptions-improperlyconfigured-error-loading-psycopg-module-no-mo – Vikrant Pawar Nov 04 '21 at 12:24

1 Answers1

0

activate your env and do a pip install

cd /path/to/virtualenv

source name-of-vitualenv/bin/activate

pip3 install psycopg2

Suhas Kashyap
  • 398
  • 3
  • 14