python3: can't install psycopg2 [duplicate] - python-3.x

I cannot figure this out for the life of me.
When I pip install django-tenant-schemas it tries to install the dependency psycopg2 which requires the Python headers and gcc. I have all this installed and still keep getting this error!
./psycopg/psycopg.h:35:10: fatal error: libpq-fe.h: No such file or directory
So to install libpq-fe-h I need to sudo apt-get install libpq-dev..
..which returns..
libpq-dev is already the newest version (10.10-0ubuntu0.18.04.1).
Then when I sudo find / libpq-fe.h it doesn't seem to be in my OS.
I am lost at this point. If anyone can help I would highly appreciate it.

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

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.

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.

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

Related

How to remove opencv libraries from Ubuntu?

I installed opencv with sudo apt-get install libopencv-dev
I want to uninstall now, as I already have opencv. So, I now have 2 versions of opencv
You can remove packages if you installed the package using apt-get, by typing apt-get remove "packagename"(remove quotes).
Additionally you can use whereis command(if memory serves me correctly on ubuntu) by using "whereis packagename" and it should point you to where the conflicting package is, sometimes it is installed within the /usr/bin or the /opt directory , so you can remove that directory manually.
Food for thought if your after a particular file you can use the find command to find the library as well "find packagenameoranyfile"

What are the dependencies for installing vscode 1.32 on ubuntu14.04

I want to install the latest vscode on ubuntu 14.04,
what are the dependencies for that?
I don't have sudo so I have to handle all the dependencies manually.
So I thought maybe someone can share all them so I wont have to find out 1 by 1.
You can simply download the zip archive version and extract it to destination folder and then run the startup script usually named code from its bin folder.
I assume that you want to install Visual Studio Code.
So for the latest stable version, just visit the official download page and choose the architecture (64bit or 32bit) you need. By default Ubuntu 14.04LTS uses apt as package manager, so you'll need the .deb file.
Once the download finished, open your download folder (or wherever your downloads are stored). There right click and choose Open in Terminal.
Now you can install VSCode by executing the following command (the file name could differ):
$ sudo dpkg --install code_1.32.2-1552488294_amd64.deb
If there are some unsatisfied dependencies, you will get an error. In this case type in the following:
$ sudo apt -f install
Then apt will automatically install the missing packages and finish the installation of VSCode. It will also add a .list file to your /etc/apt/source.list.d folder, so that VSCode will always be updated from the official repository when you execute sudo apt update and sudo apt upgrade.
Edit:
The dependencies are:
libnotify4
libnss3 (>= 2:3.26)
gnupg
apt
libxkbfile1
libsecret-1-0
libgtk-3-0 (>= 3.10.0)
libxss1

How to install libprotobuf?

By mistake i have deleted these libraries. I couldn't find a right way to reinstall it.
/usr/lib/x86_64-linux-gnu/libprotobuf.so.8
/usr/lib/x86_64-linux-gnu/libprotobuf-c.so.0
To fix it, i tried to follow these instructions, https://github.com/google/protobuf/blob/master/src/README.md
but ended up with different version. Now while compiling my code it throws this error. How can i get my previous version back?
error while loading shared libraries: libprotoc.so.8: cannot open shared object file: No such file or directory
Unknown OS: Installing the three packages providing libprotobuf.so.8, libprotobuf-c.so.0, libprotoc.so.8 →
sudo apt install --reinstall libprotobuf8 libprotobuf-c0 libprotoc8
HOWTO decide a package :
sudo apt install apt-file
apt-file search libprotoc.so.8
http://packages.ubuntu.com/search?keywords=libprotoc&searchon=names

System crash after oracle installation with yum

recently i tried to install oracle on my linux with apt (I never used yum before) using fast manual:
http://www.oracle.com/technetwork/articles/servers-storage-admin/ginnydbinstallonlinux-488779.html
And after command:
sudo yum install oracle-rdbms-server-11gR2-preinstall
I got error:
Failed: ca-certificates.noarch 0:2010.63-3.el6_1.5 chkconfig.x86_64 0:1.3.49.3-2.el6 file-libs.x86_64 0:5.04-15.el6 filesystem.x86_64 0:2.4.30-3.el6
initscripts.x86_64 0:9.03.38-1.0.1.el6_4.2
Complete!
And something gone wrong because command like: ps, top are crashing
login#Ass-K55VJ:/etc/yum/repos.d$ ps -e
ps: relocation error: ps: symbol procps_number_version, version _3_2_5 not defined in file libproc-3.2.8.so with link time reference
login#Ass-K55VJ:/etc/yum/repos.d$ top
Segmentation fault (core dumped)
then I tryied to uninstall oracle and dependencies but after command:
sudo yum remove oracle-rdbms-server-11gR2-preinstall
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:
No module named yum
Please install a package which provides this module, or
verify that the module is installed correctly.
It's possible that the above module doesn't match the
current version of Python, which is:
2.6.6 (r266:84292, Jul 10 2013, 06:42:56) [GCC 4.4.7 20120313 (Red Hat 4.4.7-3)]
If you cannot solve this problem yourself, please go to the yum faq at: http://wiki.linux.duke.edu/YumFaq
So it seems like yum install in my system new libraries but didn't link it correctly? I dont know what do in this moment because it seems like armagedon on my ubuntu...
Does this mean you're on ubuntu and tried to install rpm packages using yum? The manual you used is for Oracle Linux 6, why would you try that on ubuntu?
rpm packages are not compatible with debian based systems like ubuntu, which use deb packages. So you've probably screwed your system big time, overwriting important system libraries with incompatible ones.
If apt-get is still working, then you can try to reinstall (apt-get --reinstall install) the equivalent libraries to the ones mentioned in the install manual you linked to - naming isn't always the same for rpm and deb packages. dpkg -l should help you see which the correct installed libraries are. I'd start with the C libraries (libc) etc.
But if apt-get is screwed also, then you'd need to download the packages manually from an ubuntu mirror and install them using dpkg, but I think a reinstall (or restore from backup if you have one) would be the best option.

/usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directory

I am trying to install roccc 2.0. I have installed required packages. Now while installing it, it is giving me this error:
/usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directory
I searched for gnu/stubs-32.h and came to know, for Linux 64-bit its in glibc-devel and for Linux 32-bit, its in libc6-dev-i386.
I am using Linux 32-bit: i386 GNU/Linux, but couldn't get the lib required to resolve this error.
Can somebody please help me out?
If your Linux distro is Redhat based (Fedora/CentOS/RHEL):
yum install glibc-devel.i686
References
Original post answer solved this problem RHEL x64
Header file gnu/stubs-32.h is under /usr/include/i386-linux-gnu/ but the install script tries to find it in /usr/include/, try this quick fix to complete the installation:
sudo ln -s /usr/include/i386-linux-gnu/gnu/stubs-32.h /usr/include/gnu/stubs-32.h
After installation is finished, you can delete the link.
The package name keeps on changing, just do a
yum list glibc-devel
to find out current package for 32 bit. In my case it only listed 2 packages one for 32 bit and one for 64 bit. I just installed the 32 bit using
yum install glibc-devel.i686
Install 'glibc-devel' package, or whatever it called in your distro. You may also need to install ia32-libs lib32z1-dev lib32bz2-dev (names could be different in your distro).
The script is trying to get stubs-32.h from /usr/include/ where it is not found. To solve this you have to add an "include" path (by default it is /usr/include) like this:
C_INCLUDE_PATH=/usr/include/i386-linux-gnu/
export C_INCLUDE_PATH
OR
export C_INCLUDE_PATH=/usr/include/$(gcc -print-multiarch)
You can visit Error "gnu/stubs-32.h: No such file or directory" while compiling Nachos source code for additional reference.
If on a Red Hat distro such as Fedora/CentOS/RHEL you can do the following to find out what package provides a given file:
$ repoquery -qf */stubs-32.h
glibc-devel-0:2.17-260.el7.i686
And then install it:
$ sudo yum install -y glibc-devel-0:2.17-260.el7.i686

Resources