unable to install psycopg2 on python3 - python

I'm trying to install psycopg2 module on python3 on a CentOS Linux 7 and getting the following error
In file included from psycopg/psycopgmodule.c:28:0:
./psycopg/psycopg.h:36:22: fatal error: libpq-fe.h: No such file or directory
#include <libpq-fe.h>
^
compilation terminated.
It appears you are missing some prerequisite to build the package from source.
You may install a binary package by installing 'psycopg2-binary' from PyPI.
If you want to install psycopg2 from source, please install the packages
required for the build and try again.
For further information please check the 'doc/src/install.rst' file (also at
<https://www.psycopg.org/docs/install.html>).
error: command 'gcc' failed with exit status 1
Any ideas as to what the solution would be?
Thanks

Related

Issues installing python package on windows

I'm trying to install python-rocksdb on a windows 10 machine and I'm coming across some issues with the install.
I have successfully installed rocksdb first using the vcpkg method.
When running pip install python-rocksdb I get the following error:
cl : Command line error D8021 : invalid numeric argument '/Wextra'
error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
Looking around suggested attempting to install with GCC or G++, so I downloaded cygwin and then attempted to install the python package using
pip install --global-option build_ext --global-option --compiler=cygwin python-rocksdb which yielded the following error:
gcc: error: unrecognized command-line option ‘-mcygwin’
error: command 'C:\\cygwin64\\bin\\gcc.exe' failed with exit code 1
This post seems to suggest that you need to use g++ specifically, but it looks like the cygwin command is defaulting to gcc.
Just note that I'm not using the virtual env with python.
Any assistance is greatly appreciated.

pip install CrossMap failing on OSX: cannot find os/rand.c?

Just trying to run a
pip install CrossMap
on OSX 10.11.6 with a brew installed python (version 2.7.12) and pip (version 9.0.1) and running into this error:
htslib/hts_os.c:30:10: fatal error: 'os/rand.c' file not found
#include "os/rand.c"
^
1 error generated.
error: command 'clang' failed with exit status 1
I have looked everywhere for information on this error and it has come up empty. Where does this dependency come from and how do I install it?
Thanks!
CrossMap depends on pysam which is a wrapper for sam tools. You need to install htslib before compiling pysam.

pip install pyscipopt on mac - scip.h file not found

Initial Question
I've installed scipopsuite by following these instructions: http://scip.zib.de/doc/html/MAKE.php#BRIEFINSTALL
Make tests - complete without error.
Then when I try pip install pyscipopt I get the following error.
src/pyscipopt/scip.c:467:10: fatal error: 'scip/scip.h' file not found
#include "scip/scip.h"
^
1 error generated.
error: command 'gcc' failed with exit status 1
Specs: Anaconda Python 2.7, latest OSX
Follow Up
In response to comments(#mattmilten), I've done the following.
(1) Installed the make file - When i tried to run the install it failed because the name of the O.darwin.x86_64.gnu.shared.opt folder was set to 'static' instead of shared. I changed that name and then the install completed but did have these warnings:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: lib/libscipopt-4.0.0.darwin.x86_64.gnu.opt.a(stkchk.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: lib/libscipopt-4.0.0.darwin.x86_64.gnu.opt.a(stkchk.o) has no symbols
When i try:
>>> import pyscipopt
, I now get the following error.
Any suggestions would be appreciated.
ImportError: dlopen(/Users/"local"/anaconda/lib/python2.7/site-packages/pyscipopt/scip.so, 2): Symbol not found: ___gmp_version
Referenced from: /Users/"local"/anaconda/lib/python2.7/site-packages/pyscipopt/scip.so
Expected in: flat namespace in /Users/"local"/anaconda/lib/python2.7/site-packages/pyscipopt/scip.so
I'm guessing these things are linked - thanks.
As explained in the PySCIPOpt INSTALL you need to tell Python where you installed the SCIP Opt Suite: export SCIPOPTDIR=<path_to_install_dir>
The setup.py looks for this environment variable so you need to set it before you run pip install pyscipopt
Edit:
You need to install the SCIP Opt Suite (this basically copies the compiled files to some directory) as also explained in the INSTALL file

Unable to install psycopg2 on OSX Anaconda

This is what I am getting:
Adnans-MBP:~ AdnanAhmad$ easy_install psycopg2
Searching for psycopg2
Reading https://pypi.python.org/simple/psycopg2/
Downloading https://pypi.python.org/packages/7b/a8/dc2d50a6f37c157459cd18bab381c8e6134b9381b50fbe969997b2ae7dbc/psycopg2-2.6.2.tar.gz#md5=4a392949ba31a378a18ed3e775a4693f
Best match: psycopg2 2.6.2
Processing psycopg2-2.6.2.tar.gz
Writing /var/folders/d3/t5c58nx570ggzzknhm4zpjnw0000gn/T/easy_install-66rCLK/psycopg2-2.6.2/setup.cfg
Running psycopg2-2.6.2/setup.py -q bdist_egg --dist-dir /var/folders/d3/t5c58nx570ggzzknhm4zpjnw0000gn/T/easy_install-66rCLK/psycopg2-2.6.2/egg-dist-tmp-Vu8qsu
In file included from psycopg/psycopgmodule.c:27:
./psycopg/psycopg.h:31:10: fatal error: 'libpq-fe.h' file not found
#include <libpq-fe.h>
^
1 error generated.
error: Setup script exited with error: command 'gcc' failed with exit status 1
I am using PostgreSql.app
well, since you are using anaconda anyways, might as well take advantage of their binary packages! They have one for PostgreSQL! just type
conda install psycopg2

Can't install package inside virtualenv

I have the following environment:
Linux Mint17.1 which comes pre-installed with python 2.7.6.
I setup an altinstall for python 3.3.5
Using python 3.3 I created a virtualenv
I am trying to install TA-Lib in the virtual env but am not having any success.
If I try to install with:
./easy_install TA-Lib
I get the following error:
Searching for TA-Lib
Reading https://pypi.python.org/simple/TA-Lib/
Reading http://github.com/mrjbq7/ta-lib
Reading https://github.com/mrjbq7/ta-lib/releases
Best match: TA-Lib 0.4.8
Downloading https://github.com/mrjbq7/ta-lib/archive/TA_Lib-0.4.8.zip
Processing TA_Lib-0.4.8.zip
Writing /tmp/easy_install-67a3vk/ta-lib-TA_Lib-0.4.8/setup.cfg
Running ta-lib-TA_Lib-0.4.8/setup.py -q bdist_egg --dist-dir/tmp/easy_install-67a3vk/ta-lib-TA_Lib-0.4.8/egg-dist-tmp-w24p9n
/tmp/easy_install-67a3vk/ta-lib-TA_Lib-0.4.8/setup.py:49: UserWarning: Cannot find ta-lib library, installation may fail.
warnings.warn('Cannot find ta-lib library, installation may fail.')
talib/common.c:314:28: fatal error: ta-lib/ta_defs.h: No such file or directory
#include "ta-lib/ta_defs.h"
^
compilation terminated.
error: Setup script exited with error: command 'gcc' failed with exit status 1
If I try to install with:
./pip install https://github.com/mrjbq7/ta-lib/archive/TA_Lib-0.4.8.tar.gz
I get the following error:
Downloading/unpacking https://github.com/mrjbq7/ta-lib/archive/TA_Lib-0.4.8.tar.gz
Downloading TA_Lib-0.4.8.tar.gz (unknown size): 544kB downloaded
Running setup.py (path:/tmp/pip-rxvyyh-build/setup.py) egg_info for package from https://github.com/mrjbq7/ta-lib/archive/TA_Lib-0.4.8.tar.gz
/tmp/pip-rxvyyh-build/setup.py:49: UserWarning: Cannot find ta-lib library, installation may fail.
warnings.warn('Cannot find ta-lib library, installation may fail.')
Installing collected packages: TA-Lib
Running setup.py install for TA-Lib
...removed to make post shorter...
compilation terminated.
/tmp/pip-rxvyyh-build/setup.py:49: UserWarning: Cannot find ta-lib library, installation may fail.
warnings.warn('Cannot find ta-lib library, installation may fail.')
error: command 'gcc' failed with exit status 1
So basically both approaches result in a final error of:
command 'gcc' failed with exit status 1
I have no problem installing other packages such as numpy, pandas, matplotlib etc in the virtualenv. It is just TA-Lib that is not working.
You don't have installed underlying ta-lib library. You can find more info on the project site https://github.com/mrjbq7/ta-lib :
Sometimes installation will produce build errors like this:
func.c:256:28: fatal error: ta-lib/ta_libc.h: No such file or directory compilation terminated.
This typically means that it can't find the underlying TA-Lib library, a dependency which needs to be installed.

Categories

Resources