97👍
For some reason, the file is missing on the system.
As you’re using apt-get
, the system is dpkg
based, presumably Debian or it’s derivative. You can try the Ubuntu’s package search to get which package contains a file with name ending in libpq-fe.h
.
I found the package is libpq-dev
and file’s absolute path is /usr/include/postgresql/libpq-fe.h
.
FWIW, on a dpkg
based system, you can check which package gives a file if you know the file’s absolute path:
% dpkg -S /usr/include/postgresql/libpq-fe.h
libpq-dev: /usr/include/postgresql/libpq-fe.h
Also, unlike find
, locate
keeps a cache of found files (mlocate.db
) that is created everyday via cron
; so if the file happens to be removed after the last run, you can run locate libfq-fe.h
to get the absolute path to the file without needing to check the Ubuntu package search online.
So the package is libpq-dev
. Now, reinstalling it will get everything to the default state i.e. all relevant files will be copied to the right places. As it is only a library package, no user/system level configurations will be overridden (and dpkg
will prompt you for action for any package that does that).
To reinstall the package:
sudo apt-get install --reinstall libpq-dev
3👍
For me, I realized it was trying to use the deprecated setup.py so I installed wheel (pip install wheel
) and that sorted it all out.
- [Django]-Pagination in Django-Rest-Framework using API-View
- [Django]-How to drop all tables from the database with manage.py CLI in Django?
- [Django]-Django render_to_string missing information
1👍
You need to create a LD_LIBRARY_PATH
that indicates the path of your library /user/pgsql-11/lib
Source: The 3rd point of build prerequisites at https://www.psycopg.org/docs/install.html#build-prerequisites
- [Django]-How to get the currently logged in user's id in Django?
- [Django]-Getting 'DatabaseOperations' object has no attribute 'geo_db_type' error when doing a syncdb
- [Django]-Reload django object from database
1👍
Well after installing these libraries
sudo dnf install python-virtualenv openssl-devel gcc libffi-devel libxslt-devel
issue was not gone.
I used mlocate
to find where libpq-fe.h
file is located. On my system (Fedora 32) it was located at /usr/pgsql-10/include/libpq-fe.h
yum install mlocate
sudo updateb
locate libpq-fe.h
After all added this line to ~/.bash_profile
nano ~/.bash_profile
export PATH=/usr/pgsql-10/bin/:$PATH
Works fine, I can easily install psycopg2
without any trouble.
- [Django]-How to allow only one radio button to be checked?
- [Django]-Django template includes slow?
- [Django]-Difference between objects.create() and object.save() in django orm