Psycopg2-binary installation issue - python

While installing psycopg2 binary python package, am getting the below error
copg/typecast.c -o build/temp.linux-x86_64-3.7/psycopg/typecast.o -Wdeclaration-after-statement
gcc -pthread -shared -B /data/softwares/AnacondaPackages/anaconda3/compiler_compat -L/data/softwares/AnacondaPackages/anaconda3/lib -Wl,-rpath=/data/softwares/AnacondaPackages/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ -Wl,-O2,--sort-common,--as-needed,-z,relro,-z,now -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -D_FORTIFY_SOURCE=2 -O2 build/temp.linux-x86_64-3.7/psycopg/psycopgmodule.o build/temp.linux-x86_64-3.7/psycopg/green.o build/temp.linux-x86_64-3.7/psycopg/pqpath.o build/temp.linux-x86_64-3.7/psycopg/utils.o build/temp.linux-x86_64-3.7/psycopg/bytes_format.o build/temp.linux-x86_64-3.7/psycopg/libpq_support.o build/temp.linux-x86_64-3.7/psycopg/win32_support.o build/temp.linux-x86_64-3.7/psycopg/solaris_support.o build/temp.linux-x86_64-3.7/psycopg/connection_int.o build/temp.linux-x86_64-3.7/psycopg/connection_type.o build/temp.linux-x86_64-3.7/psycopg/cursor_int.o build/temp.linux-x86_64-3.7/psycopg/cursor_type.o build/temp.linux-x86_64-3.7/psycopg/replication_connection_type.o build/temp.linux-x86_64-3.7/psycopg/replication_cursor_type.o build/temp.linux-x86_64-3.7/psycopg/replication_message_type.o build/temp.linux-x86_64-3.7/psycopg/diagnostics_type.o build/temp.linux-x86_64-3.7/psycopg/error_type.o build/temp.linux-x86_64-3.7/psycopg/lobject_int.o build/temp.linux-x86_64-3.7/psycopg/lobject_type.o build/temp.linux-x86_64-3.7/psycopg/notify_type.o build/temp.linux-x86_64-3.7/psycopg/xid_type.o build/temp.linux-x86_64-3.7/psycopg/adapter_asis.o build/temp.linux-x86_64-3.7/psycopg/adapter_binary.o build/temp.linux-x86_64-3.7/psycopg/adapter_datetime.o build/temp.linux-x86_64-3.7/psycopg/adapter_list.o build/temp.linux-x86_64-3.7/psycopg/adapter_pboolean.o build/temp.linux-x86_64-3.7/psycopg/adapter_pdecimal.o build/temp.linux-x86_64-3.7/psycopg/adapter_pint.o build/temp.linux-x86_64-3.7/psycopg/adapter_pfloat.o build/temp.linux-x86_64-3.7/psycopg/adapter_qstring.o build/temp.linux-x86_64-3.7/psycopg/microprotocols.o build/temp.linux-x86_64-3.7/psycopg/microprotocols_proto.o build/temp.linux-x86_64-3.7/psycopg/typecast.o -L/usr/local/pgsql/lib -lpq -o build/lib.linux-x86_64-3.7/psycopg2/_psycopg.cpython-37m-x86_64-linux-gnu.so
gcc: error: unrecognized command line option ‘-fno-plt’
error: command 'gcc' failed with exit status 1
I found out it is using GCC w.r.t to OS but i want GCC of conda to be used for the installation.
pip install psycopg2-binary.tar.gz (Offline installation)

Related

Missing numpy header while installing sklearn on Alpine Linux

I'm trying to install sklearn on top of a Docker image (FROM astronomerinc/ap-airflow:master-1.10.5-onbuild). Environment coming with the source image:
Alpine Linux v3.10 (kernel 4.9.93-linuxkit-aufs)
Python 3.7.3
numpy==1.17.2
pandas==0.25.1
pandas-gbq==0.11.0
...
I had scipy==1.3.1 in my requirements.txt and had no issues installing it with pip, however when I added scikit-learn to requirements.txt and rebuilt again, I got this error saying a numpy header is missing:
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/sklearn
creating build/temp.linux-x86_64-3.7/sklearn/svm
creating build/temp.linux-x86_64-3.7/sklearn/svm/src
creating build/temp.linux-x86_64-3.7/sklearn/svm/src/libsvm
compile options: '-I/usr/lib/python3.7/site-packages/numpy/core/include -c'
g++: sklearn/svm/src/libsvm/libsvm_template.cpp
ar: adding 1 object files to build/temp.linux-x86_64-3.7/liblibsvm-skl.a
running build_ext
customize UnixCCompiler
customize UnixCCompiler using build_ext
resetting extension 'sklearn.svm.liblinear' language from 'c' to 'c++'.
customize UnixCCompiler
customize UnixCCompiler using build_ext
building 'sklearn.__check_build._check_build' extension
compiling C sources
C compiler: gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -DTHREAD_STACK_SIZE=0x100000 -fPIC
creating build/temp.linux-x86_64-3.7/sklearn/__check_build
compile options: '-I/usr/lib/python3.7/site-packages/numpy/core/include -I/usr/lib/python3.7/site-packages/numpy/core/include -I/usr/include/python3.7m -c'
gcc: sklearn/__check_build/_check_build.c
gcc -shared -Wl,--as-needed -Wl,--as-needed build/temp.linux-x86_64-3.7/sklearn/__check_build/_check_build.o -L/usr/lib -Lbuild/temp.linux-x86_64-3.7 -lpython3.7m -o build/lib.linux-x86_64-3.7/sklearn/__check_build/_check_build.cpython-37m-x86_64-linux-gnu.so
building 'sklearn.cluster._dbscan_inner' extension
compiling C++ sources
C compiler: g++ -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -DTHREAD_STACK_SIZE=0x100000 -fPIC
creating build/temp.linux-x86_64-3.7/sklearn/cluster
compile options: '-I/usr/lib/python3.7/site-packages/numpy/core/include -I/usr/lib/python3.7/site-packages/numpy/core/include -I/usr/include/python3.7m -c'
g++: sklearn/cluster/_dbscan_inner.cpp
sklearn/cluster/_dbscan_inner.cpp:652:10: fatal error: numpy/arrayobject.h: No such file or directory
#include "numpy/arrayobject.h"
^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
error: Command "g++ -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/lib/python3.7/site-packages/numpy/core/include -I/usr/lib/python3.7/site-packages/numpy/core/include -I/usr/include/python3.7m -c sklearn/cluster/_dbscan_inner.cpp -o build/temp.linux-x86_64-3.7/sklearn/cluster/_dbscan_inner.o -MMD -MF build/temp.linux-x86_64-3.7/sklearn/cluster/_dbscan_inner.o.d" failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-o8ktwf40/scikit-learn/setup.py'"'"'; __file__='"'"'/tmp/pip-install-o8ktwf40/scikit-learn/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-p6ejlhi_/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.
WARNING: You are using pip version 19.2.1, however version 19.2.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
The command '/bin/sh -c pip install --no-cache-dir -q -r requirements.txt' returned a non-zero code: 1
Several things I've tried:
upgrading pip
specifying an older version of scikit-learn
"explicitly" installing py3-numpy
None of them worked unfortunately. This post recommends setting the path manually but that just wasn't the answer I was looking for.
Insights? Any help is appreciated!
I suggest you to install py-numpy-dev in your Dockerfile:
RUN apk add py-numpy-dev

Python encountered a configuration problem when installing spams package

I encountered some configuration problems when installing spams package in python
The version of my Visual Studio is 14.0. I made the VERSION of the code in the msvc9compiler.py file equal to 14.0 and solved the problem of not finding the version; and added the distutils.cfg file: [build] compiler=mingw32 solved some bugs. Now I have encountered a missing spams-tst.h file and gcc status 1 problem, cry...
D:\software\anaconda3\anzhuang_k\spams-2.6.1>python setup.py install
running install
running build
running build_py
running build_ext
building '_spams_wrap' extension
C compiler: gcc -g -DDEBUG -DMS_WIN64 -O0 -Wall -Wstrict-prototypes
compile options: '-DNPY_MINGW_USE_CUSTOM_MSVCR -D__MSVCRT_VERSION__=0x1900 -I. -Ispams\linalg -Ispams\prox -Ispams\decomp -Ispams\dictLearn -ID:\software\anaconda3\lib\site-packages\numpy\core\include -ID:\software\anaconda3\include -ID:\software\anaconda3\include -ID:\software\anaconda3\include -ID:\software\anaconda3\include -c'
extra options: '-DNDEBUG -DUSE_BLAS_LIB -fPIC -fopenmp -Wunused-variable -m64'
gcc -g -DDEBUG -DMS_WIN64 -O0 -Wall -Wstrict-prototypes -DNPY_MINGW_USE_CUSTOM_MSVCR -D__MSVCRT_VERSION__=0x1900 -I. -Ispams\linalg -Ispams\prox -Ispams\decomp -Ispams\dictLearn -ID:\software\anaconda3\lib\site-packages\numpy\core\include -ID:\software\anaconda3\include -ID:\software\anaconda3\include -ID:\software\anaconda3\include -ID:\software\anaconda3\include -c spams_wrap.cpp -o build\temp.win-amd64-3.6\Release\spams_wrap.o -DNDEBUG -DUSE_BLAS_LIB -fPIC -fopenmp -Wunused-variable -m64
cc1plus.exe: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++
spams_wrap.cpp:1:0: warning: -fPIC ignored for target (all code is position independent)
/* ----------------------------------------------------------------------------
^
spams_wrap.cpp:3134:23: fatal error: spams-tst.h: No such file or directory
compilation terminated.
error: Command "gcc -g -DDEBUG -DMS_WIN64 -O0 -Wall -Wstrict-prototypes -DNPY_MINGW_USE_CUSTOM_MSVCR -D__MSVCRT_VERSION__=0x1900 -I. -Ispams\linalg -Ispams\prox -Ispams\decomp -Ispams\dictLearn -ID:\software\anaconda3\lib\site-packages\numpy\core\include -ID:\software\anaconda3\include -ID:\software\anaconda3\include -ID:\software\anaconda3\include -ID:\software\anaconda3\include -c spams_wrap.cpp -o build\temp.win-amd64-3.6\Release\spams_wrap.o -DNDEBUG -DUSE_BLAS_LIB -fPIC -fopenmp -Wunused-variable -m64" failed with exit status 1
D:\software\anaconda3\anzhuang_k\spams-2.6.1>
Installation failed

error: command 'c++' failed with exit status 1

So I am trying to install Pyv8 by following instruction from https://andrewwilkinson.wordpress.com/2012/01/23/integrating-python-and-javascript-with-pyv8/
sudo aptitude install scons libboost-python-dev
svn checkout http://v8.googlecode.com/svn/trunk/ v8
svn checkout http://pyv8.googlecode.com/svn/trunk/ pyv8
cd v8
export PyV8=`pwd`
cd ../pyv8
python setup.py build
sudo python setup.py install
Error comes when running second last command about building the setup.
-Wstrict-prototypes -fPIC -DBOOST_PYTHON_STATIC_LIB -
DV8_NATIVE_REGEXP -DENABLE_DEBUGGER_SUPPORT -DV8_TARGET_ARCH_X64 -
I/home/amit/Downloads/pyv8/build/v8_r19632/include -
I/home/amit/Downloads/pyv8/build/v8_r19632 -
I/home/amit/Downloads/pyv8/build/v8_r19632/src -I/usr/local/include -
I/usr/include/python2.7 -c src/PyV8.cpp -o build/temp.linux-x86_64-
2.7/src/PyV8.o -Wno-write-strings -g -O3
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for
C/ObjC but not for C++ [enabled by default]
c++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-
functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
-Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-
buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-
2.7/src/Utils.o build/temp.linux-x86_64-2.7/src/Exception.o
build/temp.linux-x86_64-2.7/src/Context.o build/temp.linux-x86_64-
2.7/src/Engine.o build/temp.linux-x86_64-2.7/src/Wrapper.o
build/temp.linux-x86_64-2.7/src/Debug.o build/temp.linux-x86_64-
2.7/src/Locker.o build/temp.linux-x86_64-2.7/src/AST.o build/temp.linux-
x86_64-2.7/src/PrettyPrinter.o build/temp.linux-x86_64-2.7/src/PyV8.o
L/usr/local/lib -
L/home/amit/Downloads/pyv8/build/v8_r19632/out/x64.release/obj.target/tool
s/gyp/ -lboost_python -lboost_thread -lboost_system -lrt -lv8_base.x64 -
lv8_snapshot -o build/lib.linux-x86_64-2.7/_PyV8.so -fPIC -lrt
/usr/bin/ld: cannot find -lboost_thread
/usr/bin/ld: cannot find -lboost_system
collect2: error: ld returned 1 exit status
error: command 'c++' failed with exit status 1
It is because the version of gcc and g++ is too low for me, as I downgrade it when i install cuda sometime. Just follow the following commands:
$ cd /usr/bin
$ rm gcc
$ ln -s gcc-5 gcc
$ rm g++
$ ln -s g++-5 g++
Done.
I followed the instructions from this link - http://ubuntuforums.org/showthread.php?t=1480282#post_11247864
and installed the libboost_thread package which solved the problem. Thank you https://stackoverflow.com/users/440558/joachim-pileborg

Unable to install MySQL-python under ubuntu 12.04

I'm trying to install mysql-python module in ubuntu 12.04 under virtualenv environment but unexpectedly faced with error below:
building '_mysql' extension
creating build/temp.linux-x86_64-2.7
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
-Wstrict-prototypes -fPIC -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -fPIC -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1
In file included from /usr/include/mysql/mysql.h:64:0,
from _mysql.c:46:
/usr/include/mysql/mysql/client_plugin.h:97:3: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
In file included from /usr/include/mysql/mysql.h:64:0,
from _mysql.c:46:
/usr/include/mysql/mysql/client_plugin.h:107:3: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions
-Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-x86_64-2.7/_mysql.o -L/usr/lib/x86_64-linux-gnu
-lmysqlclient_r -lpthread -lz -lm -lrt -ldl -o build/lib.linux-x86_64-2.7/_mysql.so
/usr/bin/ld: cannot find -lmysqlclient_r
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
I've run:
sudo apt-get install mysql-server mysql-client python-mysqldb libmysqlclient-dev python-dev
but it didn't help.
The problem was that libmysqlclient.so didn't have symlinks described in https://github.com/javer/gentoo-overlay/issues/4#issuecomment-30748799
For me on Centos, the problem was that MySQL-python did not provide the libmysqlclient_r.so but it had the other numbered versions. By uninstalling it and installing Percona-SQL-devel instead, python was able to find the library and build wheel correctly.

Intel Galileo - greenlet.h:8:20: fatal error: Python.h: No such file or directory

I'm running Linux dev-tools image (link at the end) on my intel galileo. I tried to install greenlet but I got an error stating python.h no such file.
root#clanton:/media/realroot/greenlet-0.4.2# python setup.py install
running install
running build
running build_ext
creating /tmp/tmpuKbWhk/tmp
creating /tmp/tmpuKbWhk/tmp/tmpuKbWhk
i586-poky-linux-uclibc-gcc -m32 -march=i586 -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -fno-tree-dominator-opts -I/usr/include/python2.7 -c /tmp/tmpuKbWhk/simple.c -o /tmp/tmpuKbWhk/tmp/tmpuKbWhk/simple.o
/tmp/tmpuKbWhk/simple.c:1:6: warning: function declaration isn't a prototype [-Wstrict-prototypes]
building 'greenlet' extension
creating build
creating build/temp.linux-i586-2.7
i586-poky-linux-uclibc-gcc -m32 -march=i586 -fno-strict-aliasing -O2 -pipe -g -feliminate-unused-debug-types -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -fno-tree-dominator-opts -I/usr/include/python2.7 -c greenlet.c -o build/temp.linux-i586-2.7/greenlet.o
In file included from greenlet.c:5:0:
greenlet.h:8:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'i586-poky-linux-uclibc-gcc' failed with exit status 1**
I know there are many posts with the same python.h error but my problem is the Linux image I have can't run sudo or apt commands
I need to setup python-dev environment onto my Linux image running on Galileo board.
Link to the Linux dev-tools image I'm using is here below.
http://telekinect.media.mit.edu/galileo/image-devtools-1.0.1-2.tar.bz2
p.s. it has gcc and python2.7 already.

Categories