legacy-install-failure on installing psycopg2 with pip in venv, Windows 10 - pip

pip version: 22.3.1
Python version: 3.9.11
OS: Windows 10
I create my python project and use venv as virtual enviroment.
Other pip packages have well installed, but only psycopg2 failed.
The log said there is some problem in
./psycopg/win32_support.h:43:6: error: #elif with no expression.
I think msys2 might causes this problem.
pip install psycopg2-binary also has same result, same problem.
Why this happens? Any clues?
(.venv) PS C:\Users\my\proj> pip install psycopg2
Collecting psycopg2
Using cached psycopg2-2.9.5.tar.gz (384 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: psycopg2
Building wheel for psycopg2 (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [44 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build\lib.mingw_x86_64-3.9
creating build\lib.mingw_x86_64-3.9\psycopg2
copying lib\errorcodes.py -> build\lib.mingw_x86_64-3.9\psycopg2
copying lib\errors.py -> build\lib.mingw_x86_64-3.9\psycopg2
copying lib\extensions.py -> build\lib.mingw_x86_64-3.9\psycopg2
copying lib\extras.py -> build\lib.mingw_x86_64-3.9\psycopg2
copying lib\pool.py -> build\lib.mingw_x86_64-3.9\psycopg2
copying lib\sql.py -> build\lib.mingw_x86_64-3.9\psycopg2
copying lib\tz.py -> build\lib.mingw_x86_64-3.9\psycopg2
copying lib\_ipaddress.py -> build\lib.mingw_x86_64-3.9\psycopg2
copying lib\_json.py -> build\lib.mingw_x86_64-3.9\psycopg2
copying lib\_range.py -> build\lib.mingw_x86_64-3.9\psycopg2
copying lib\__init__.py -> build\lib.mingw_x86_64-3.9\psycopg2
running build_ext
building 'psycopg2._psycopg' extension
creating build\temp.mingw_x86_64-3.9
creating build\temp.mingw_x86_64-3.9\psycopg
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O2 -pipe -march=x86-64 -mtune=generic -O2 -pipe -DPSYCOPG_VERSION=2.9.5 (dt dec pq3 ext lo64) -DPSYCOPG_DEBUG=1 -DPG_VERSION_NUM=150001 -DHAVE_LO64=1 -DPSYCOPG_DEBUG=1 -IC:\Users\my\proj\.venv\include -IC:\msys64\mingw64\include\python3.9 -I. -IC:/PROGRA~1/POSTGR~1/15/include -IC:/PROGRA~1/POSTGR~1/15/include/server -c psycopg\adapter_asis.c -o build\temp.mingw_x86_64-3.9\psycopg\adapter_asis.o -O3 -fno-strict-aliasing
In file included from ./psycopg/config.h:164,
from ./psycopg/psycopg.h:38,
from psycopg\adapter_asis.c:28:
./psycopg/win32_support.h:43:6: error: #elif with no expression
43 | #elif
| ^
In file included from ./psycopg/psycopg.h:38,
from psycopg\adapter_asis.c:28:
./psycopg/config.h:108:12: warning: 'pthread_mutex_init' defined but not used [-Wunused-function]
108 | static int pthread_mutex_init(pthread_mutex_t *mutex, void* fake)
| ^~~~~~~~~~~~~~~~~~
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 'C:\\msys64\\mingw64\\bin\\gcc.exe' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for psycopg2
Running setup.py clean for psycopg2
Failed to build psycopg2
Installing collected packages: psycopg2
Running setup.py install for psycopg2 ... error
error: subprocess-exited-with-error
× Running setup.py install for psycopg2 did not run successfully.
│ exit code: 1
╰─> [44 lines of output]
running install
running build
running build_py
creating build
creating build\lib.mingw_x86_64-3.9
creating build\lib.mingw_x86_64-3.9\psycopg2
copying lib\errorcodes.py -> build\lib.mingw_x86_64-3.9\psycopg2
copying lib\errors.py -> build\lib.mingw_x86_64-3.9\psycopg2
copying lib\extensions.py -> build\lib.mingw_x86_64-3.9\psycopg2
copying lib\extras.py -> build\lib.mingw_x86_64-3.9\psycopg2
copying lib\pool.py -> build\lib.mingw_x86_64-3.9\psycopg2
copying lib\sql.py -> build\lib.mingw_x86_64-3.9\psycopg2
copying lib\tz.py -> build\lib.mingw_x86_64-3.9\psycopg2
copying lib\_ipaddress.py -> build\lib.mingw_x86_64-3.9\psycopg2
copying lib\_json.py -> build\lib.mingw_x86_64-3.9\psycopg2
copying lib\_range.py -> build\lib.mingw_x86_64-3.9\psycopg2
copying lib\__init__.py -> build\lib.mingw_x86_64-3.9\psycopg2
running build_ext
building 'psycopg2._psycopg' extension
creating build\temp.mingw_x86_64-3.9
creating build\temp.mingw_x86_64-3.9\psycopg
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O2 -pipe -march=x86-64 -mtune=generic -O2 -pipe -DPSYCOPG_VERSION=2.9.5 (dt dec pq3 ext lo64) -DPSYCOPG_DEBUG=1 -DPG_VERSION_NUM=150001 -DHAVE_LO64=1 -DPSYCOPG_DEBUG=1 -IC:\Users\my\proj\.venv\include -IC:\msys64\mingw64\include\python3.9 -I. -IC:/PROGRA~1/POSTGR~1/15/include -IC:/PROGRA~1/POSTGR~1/15/include/server -c psycopg\adapter_asis.c -o build\temp.mingw_x86_64-3.9\psycopg\adapter_asis.o -O3 -fno-strict-aliasing
In file included from ./psycopg/config.h:164,
from ./psycopg/psycopg.h:38,
from psycopg\adapter_asis.c:28:
./psycopg/win32_support.h:43:6: error: #elif with no expression
43 | #elif
| ^
In file included from ./psycopg/psycopg.h:38,
from psycopg\adapter_asis.c:28:
./psycopg/config.h:108:12: warning: 'pthread_mutex_init' defined but not used [-Wunused-function]
108 | static int pthread_mutex_init(pthread_mutex_t *mutex, void* fake)
| ^~~~~~~~~~~~~~~~~~
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 'C:\\msys64\\mingw64\\bin\\gcc.exe' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> psycopg2
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

Try out below commands
It worked for me
sudo apt-get update
sudo apt-get -y install python3-pip
sudo apt install libpq-dev python3-dev
pip3 install psycopg2

Related

install pycocotools in Mac m1

python 3.9
pip 22.3.1
setuptools 66.0.0
wheel 0.38.4
when install yolox, there is always error in installing pycocotools as below:
× Building wheel for pycocotools (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [33 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.9-universal2-cpython-39
creating build/lib.macosx-10.9-universal2-cpython-39/pycocotools
copying pycocotools/coco.py -> build/lib.macosx-10.9-universal2-cpython-39/pycocotools
copying pycocotools/mask.py -> build/lib.macosx-10.9-universal2-cpython-39/pycocotools
copying pycocotools/init.py -> build/lib.macosx-10.9-universal2-cpython-39/pycocotools
copying pycocotools/cocoeval.py -> build/lib.macosx-10.9-universal2-cpython-39/pycocotools
running build_ext
cythoning pycocotools/_mask.pyx to pycocotools/mask.c
/private/var/folders/g9/4g2rq3px69lbr64qqpmw5_280000gn/T/pip-build-env-kb70uki/overlay/lib/python3.9/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /private/var/folders/g9/4g2rq3px69lbr64qqpmw5_280000gn/T/pip-install-zc58cnkb/pycocotools_f63b404805f6427bb06acdd61bfd63a0/pycocotools/mask.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
building 'pycocotools.mask' extension
creating build/temp.macosx-10.9-universal2-cpython-39
creating build/temp.macosx-10.9-universal2-cpython-39/common
creating build/temp.macosx-10.9-universal2-cpython-39/pycocotools
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -I/private/var/folders/g9/4g2rq3px69lbr64qqpmw5_280000gn/T/pip-build-env-kb70uki/overlay/lib/python3.9/site-packages/numpy/core/include -I./common -I/Users/zhangelaine/env/YOLOX/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -c ./common/maskApi.c -o build/temp.macosx-10.9-universal2-cpython-39/./common/maskApi.o -Wno-cpp -Wno-unused-function -std=c99
./common/maskApi.c:151:32: warning: unused variable 'xp' [-Wunused-variable]
uint h, w, xs, ys, xe, ye, xp, cc; siz j, m;
^
1 warning generated.
./common/maskApi.c:151:32: warning: unused variable 'xp' [-Wunused-variable]
uint h, w, xs, ys, xe, ye, xp, cc; siz j, m;
^
1 warning generated.
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -I/private/var/folders/g9/4g2rq3px69lbr64qqpmw5_280000gn/T/pip-build-env-kb70uki/overlay/lib/python3.9/site-packages/numpy/core/include -I./common -I/Users/zhangelaine/env/YOLOX/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -c pycocotools/_mask.c -o build/temp.macosx-10.9-universal2-cpython-39/pycocotools/_mask.o -Wno-cpp -Wno-unused-function -std=c99
pycocotools/_mask.c:6:10: fatal error: 'Python.h' file not found
#include "Python.h"
^~~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pycocotools
Failed to build pycocotools
ERROR: Could not build wheels for pycocotools, which is required to install pyproject.toml-based projects
so i goto pycocotools website to downlord whl file.
https://pypi.tuna.tsinghua.edu.cn/simple/pycocotools-windows/ and got error as below
ERROR: pycocotools_windows-2.0.0.2-cp37-cp37m-win_amd64.whl is not a supported wheel on this platform.
any suggestion ? thanks a lot
solution : use miniforge to install conda
and install pycocotools with conda in Mac m1. It works, no error anymore
however pip install in conda env is a little bit complicated,
i am tring it.

how to modify the gcc include path when install pycocotools?

I try to install pycocotools using someone else's miniconda environment:
pip install pycocotools
but get the following error message:
Building wheels for collected packages: pycocotools
Building wheel for pycocotools (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for pycocotools (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [21 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-38
creating build/lib.linux-x86_64-cpython-38/pycocotools
copying pycocotools/__init__.py -> build/lib.linux-x86_64-cpython-38/pycocotools
copying pycocotools/coco.py -> build/lib.linux-x86_64-cpython-38/pycocotools
copying pycocotools/cocoeval.py -> build/lib.linux-x86_64-cpython-38/pycocotools
copying pycocotools/mask.py -> build/lib.linux-x86_64-cpython-38/pycocotools
running build_ext
cythoning pycocotools/_mask.pyx to pycocotools/_mask.c
building 'pycocotools._mask' extension
creating build/temp.linux-x86_64-cpython-38
creating build/temp.linux-x86_64-cpython-38/common
creating build/temp.linux-x86_64-cpython-38/pycocotools
/xxx/miniconda3/envs/lidar_env/bin/gcc -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/tmp/pip-build-env-gi3_jjg8/overlay/lib/python3.8/site-packages/numpy/core/include -I./common -I/home/users/wec.shao/miniconda3/include/python3.8 -c ./common/maskApi.c -o build/temp.linux-x86_64-cpython-38/./common/maskApi.o -Wno-cpp -Wno-unused-function -std=c99
cc1: error: /home/users/wec.shao/miniconda3/include/python3.8: Permission denied
/tmp/pip-build-env-gi3_jjg8/overlay/lib/python3.8/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /tmp/pip-install-e5qjj8wx/pycocotools_aa9946ee32e3458698e9390e0140eaa6/pycocotools/_mask.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
error: command '/xxx/miniconda3/envs/lidar_env/bin/gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pycocotools
Failed to build pycocotools
ERROR: Could not build wheels for pycocotools, which is required to install pyproject.toml-based projects
I found that in gcc compile options, there exist such option:
-I/home/users/wec.shao/miniconda3/include/python3.8
and this directory path can not be readable for me, now I want to modify this path, but I don't know how to modify this include path?

Installation of hpbandster and ConfigSpace failed

I created a virtual environment using virtualenv venv -p python3 and source venv/bin/activate under Ubuntu 18.04. Then I tried to install hpbandster which installes ConfigSpace as requirement. The installation of ConfigSpace failes throwing the following error:
Building wheel for ConfigSpace (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/anonymous/Documents/some_folder/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-lp6jkyvm/ConfigSpace/setup.py'"'"'; __file__='"'"'/tmp/pip-install-lp6jkyvm/ConfigSpace/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-aa1hsmn9
cwd: /tmp/pip-install-lp6jkyvm/ConfigSpace/
Complete output (33 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/ConfigSpace
copying ConfigSpace/exceptions.py -> build/lib.linux-x86_64-3.7/ConfigSpace
copying ConfigSpace/__init__.py -> build/lib.linux-x86_64-3.7/ConfigSpace
copying ConfigSpace/__version__.py -> build/lib.linux-x86_64-3.7/ConfigSpace
creating build/lib.linux-x86_64-3.7/ConfigSpace/read_and_write
copying ConfigSpace/read_and_write/__init__.py -> build/lib.linux-x86_64-3.7/ConfigSpace/read_and_write
copying ConfigSpace/read_and_write/pcs.py -> build/lib.linux-x86_64-3.7/ConfigSpace/read_and_write
copying ConfigSpace/read_and_write/irace.py -> build/lib.linux-x86_64-3.7/ConfigSpace/read_and_write
copying ConfigSpace/read_and_write/json.py -> build/lib.linux-x86_64-3.7/ConfigSpace/read_and_write
copying ConfigSpace/read_and_write/pcs_new.py -> build/lib.linux-x86_64-3.7/ConfigSpace/read_and_write
creating build/lib.linux-x86_64-3.7/ConfigSpace/nx
copying ConfigSpace/nx/__init__.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx
copying ConfigSpace/nx/release.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx
copying ConfigSpace/nx/exception.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx
creating build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms
copying ConfigSpace/nx/algorithms/__init__.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms
copying ConfigSpace/nx/algorithms/cycles.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms
copying ConfigSpace/nx/algorithms/dag.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms
creating build/lib.linux-x86_64-3.7/ConfigSpace/nx/classes
copying ConfigSpace/nx/classes/__init__.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/classes
copying ConfigSpace/nx/classes/digraph.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/classes
copying ConfigSpace/nx/classes/graph.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/classes
creating build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms/components
copying ConfigSpace/nx/algorithms/components/__init__.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms/components
copying ConfigSpace/nx/algorithms/components/strongly_connected.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms/components
running build_ext
building 'ConfigSpace.hyperparameters' extension
error: unknown file type '.pyx' (from 'ConfigSpace/hyperparameters.pyx')
----------------------------------------
ERROR: Failed building wheel for ConfigSpace
Running setup.py clean for ConfigSpace
Building wheel for netifaces (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/anonymous/Documents/some_folder/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-lp6jkyvm/netifaces/setup.py'"'"'; __file__='"'"'/tmp/pip-install-lp6jkyvm/netifaces/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-c5zv0th0
cwd: /tmp/pip-install-lp6jkyvm/netifaces/
Complete output (20 lines):
running bdist_wheel
running build
running build_ext
checking for getifaddrs...found.
checking for getnameinfo...found.
checking for IPv6 socket IOCTLs...not found.
checking for optional header files...netash/ash.h netatalk/at.h netax25/ax25.h neteconet/ec.h netipx/ipx.h netpacket/packet.h netrose/rose.h linux/irda.h linux/atm.h linux/llc.h linux/tipc.h linux/dn.h.
checking whether struct sockaddr has a length field...no.
checking which sockaddr_xxx structs are defined...at ax25 in in6 ipx un rose ash ec ll atmpvc atmsvc dn irda llc.
checking for routing socket support...no.
checking for sysctl(CTL_NET...) support...no.
checking for netlink support...yes.
will use netlink to read routing table
building 'netifaces' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DNETIFACES_VERSION=0.10.9 -DHAVE_GETIFADDRS=1 -DHAVE_GETNAMEINFO=1 -DHAVE_NETASH_ASH_H=1 -DHAVE_NETATALK_AT_H=1 -DHAVE_NETAX25_AX25_H=1 -DHAVE_NETECONET_EC_H=1 -DHAVE_NETIPX_IPX_H=1 -DHAVE_NETPACKET_PACKET_H=1 -DHAVE_NETROSE_ROSE_H=1 -DHAVE_LINUX_IRDA_H=1 -DHAVE_LINUX_ATM_H=1 -DHAVE_LINUX_LLC_H=1 -DHAVE_LINUX_TIPC_H=1 -DHAVE_LINUX_DN_H=1 -DHAVE_SOCKADDR_AT=1 -DHAVE_SOCKADDR_AX25=1 -DHAVE_SOCKADDR_IN=1 -DHAVE_SOCKADDR_IN6=1 -DHAVE_SOCKADDR_IPX=1 -DHAVE_SOCKADDR_UN=1 -DHAVE_SOCKADDR_ROSE=1 -DHAVE_SOCKADDR_ASH=1 -DHAVE_SOCKADDR_EC=1 -DHAVE_SOCKADDR_LL=1 -DHAVE_SOCKADDR_ATMPVC=1 -DHAVE_SOCKADDR_ATMSVC=1 -DHAVE_SOCKADDR_DN=1 -DHAVE_SOCKADDR_IRDA=1 -DHAVE_SOCKADDR_LLC=1 -DHAVE_PF_NETLINK=1 -I/home/anonymous/Documents/some_folder/venv/include -I/usr/include/python3.7m -c netifaces.c -o build/temp.linux-x86_64-3.7/netifaces.o
netifaces.c:1:10: fatal error: Python.h: Datei oder Verzeichnis nicht gefunden
#include <Python.h>
^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for netifaces
Running setup.py clean for netifaces
Failed to build ConfigSpace netifaces
Installing collected packages: cython, ConfigSpace, pytz, pandas, patsy, statsmodels, serpent, Pyro4, netifaces, hpbandster
Running setup.py install for ConfigSpace ... error
ERROR: Command errored out with exit status 1:
command: /home/anonymous/Documents/some_folder/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-lp6jkyvm/ConfigSpace/setup.py'"'"'; __file__='"'"'/tmp/pip-install-lp6jkyvm/ConfigSpace/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-c6j8cu8m/install-record.txt --single-version-externally-managed --compile --install-headers /home/anonymous/Documents/some_folder/venv/include/site/python3.7/ConfigSpace
cwd: /tmp/pip-install-lp6jkyvm/ConfigSpace/
Complete output (46 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/ConfigSpace
copying ConfigSpace/exceptions.py -> build/lib.linux-x86_64-3.7/ConfigSpace
copying ConfigSpace/__init__.py -> build/lib.linux-x86_64-3.7/ConfigSpace
copying ConfigSpace/__version__.py -> build/lib.linux-x86_64-3.7/ConfigSpace
creating build/lib.linux-x86_64-3.7/ConfigSpace/read_and_write
copying ConfigSpace/read_and_write/__init__.py -> build/lib.linux-x86_64-3.7/ConfigSpace/read_and_write
copying ConfigSpace/read_and_write/pcs.py -> build/lib.linux-x86_64-3.7/ConfigSpace/read_and_write
copying ConfigSpace/read_and_write/irace.py -> build/lib.linux-x86_64-3.7/ConfigSpace/read_and_write
copying ConfigSpace/read_and_write/json.py -> build/lib.linux-x86_64-3.7/ConfigSpace/read_and_write
copying ConfigSpace/read_and_write/pcs_new.py -> build/lib.linux-x86_64-3.7/ConfigSpace/read_and_write
creating build/lib.linux-x86_64-3.7/ConfigSpace/nx
copying ConfigSpace/nx/__init__.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx
copying ConfigSpace/nx/release.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx
copying ConfigSpace/nx/exception.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx
creating build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms
copying ConfigSpace/nx/algorithms/__init__.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms
copying ConfigSpace/nx/algorithms/cycles.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms
copying ConfigSpace/nx/algorithms/dag.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms
creating build/lib.linux-x86_64-3.7/ConfigSpace/nx/classes
copying ConfigSpace/nx/classes/__init__.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/classes
copying ConfigSpace/nx/classes/digraph.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/classes
copying ConfigSpace/nx/classes/graph.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/classes
creating build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms/components
copying ConfigSpace/nx/algorithms/components/__init__.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms/components
copying ConfigSpace/nx/algorithms/components/strongly_connected.py -> build/lib.linux-x86_64-3.7/ConfigSpace/nx/algorithms/components
running build_ext
cythoning ConfigSpace/hyperparameters.pyx to ConfigSpace/hyperparameters.c
skipping 'ConfigSpace/forbidden.c' Cython extension (up-to-date)
skipping 'ConfigSpace/conditions.c' Cython extension (up-to-date)
skipping 'ConfigSpace/c_util.c' Cython extension (up-to-date)
cythoning ConfigSpace/util.pyx to ConfigSpace/util.c
skipping 'ConfigSpace/configuration_space.c' Cython extension (up-to-date)
building 'ConfigSpace.hyperparameters' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/ConfigSpace
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/anonymous/Documents/some_folder/venv/include -I/usr/include/python3.7m -I/home/anonymous/Documents/some_folder/venv/lib/python3.7/site-packages/numpy/core/include -c ConfigSpace/hyperparameters.c -o build/temp.linux-x86_64-3.7/ConfigSpace/hyperparameters.o
ConfigSpace/hyperparameters.c:4:10: fatal error: Python.h: Datei oder Verzeichnis nicht gefunden
#include "Python.h"
^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /home/anonymous/Documents/some_folder/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-lp6jkyvm/ConfigSpace/setup.py'"'"'; __file__='"'"'/tmp/pip-install-lp6jkyvm/ConfigSpace/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-c6j8cu8m/install-record.txt --single-version-externally-managed --compile --install-headers /home/anonymous/Documents/some_folder/venv/include/site/python3.7/ConfigSpace Check the logs for full command output.
I do not have sudo permission so I have to keep using Python 3.7.5. What causes this problem and how can I fix it?
error: unknown file type '.pyx' (from 'ConfigSpace/hyperparameters.pyx')
There is a bug report 130, still open. The package seems to be broken and is not pip-installable.
Try to install Cython:
pip install Cython
pip install ConfigSpace
fatal error: Python.h: No such file
You should install Python development/header files. Without superuser access install them from Python source code and direct compiler to use your local headers.

issue in installing pylibmodbus and cffi

I am not able to install pylibmodbus library as cffi is not installed.
If I try to install cffi I get the following issue
pi#raspberrypi:~ $ pip3 install cffi Collecting cffi Using cached https://files.pythonhosted.org/packages/93/1a/ab8c62b5838722f29f3daffcc8d4bd61844aa9b5f437341cc890ceee483b/cffi-1.12.3.tar.gz Collecting pycparser (from cffi) Using cached https://www.piwheels.org/simple/pycparser/pycparser-2.19-py2.py3-none-any.whl Building wheels for collected packages: cffi Running setup.py bdist_wheel for cffi ... error Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-pqz_612d/cffi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpzpgl54b1pip-wheel- --python-tag cp35: Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containing `libffi.pc' to the PKG_CONFIG_PATH environment variable No package 'libffi' found Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containing `libffi.pc' to the PKG_CONFIG_PATH environment variable No package 'libffi' found Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containing `libffi.pc' to the PKG_CONFIG_PATH environment variable No package 'libffi' found Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containing `libffi.pc' to the PKG_CONFIG_PATH environment variable No package 'libffi' found Package libffi was not found in the pkg-config search path. Perhaps you should add the directory containing `libffi.pc' to the PKG_CONFIG_PATH environment variable No package 'libffi' found running bdist_wheel running build running build_py creating build creating build/lib.linux-armv7l-3.5 creating build/lib.linux-armv7l-3.5/cffi copying cffi/vengine_cpy.py -> build/lib.linux-armv7l-3.5/cffi copying cffi/model.py -> build/lib.linux-armv7l-3.5/cffi copying cffi/vengine_gen.py -> build/lib.linux-armv7l-3.5/cffi copying cffi/error.py -> build/lib.linux-armv7l-3.5/cffi copying cffi/backend_ctypes.py -> build/lib.linux-armv7l-3.5/cffi copying cffi/verifier.py -> build/lib.linux-armv7l-3.5/cffi copying cffi/lock.py -> build/lib.linux-armv7l-3.5/cffi copying cffi/api.py
-> build/lib.linux-armv7l-3.5/cffi copying cffi/setuptools_ext.py -> build/lib.linux-armv7l-3.5/cffi copying cffi/__init__.py -> build/lib.linux-armv7l-3.5/cffi copying cffi/cffi_opcode.py -> build/lib.linux-armv7l-3.5/cffi copying cffi/ffiplatform.py -> build/lib.linux-armv7l-3.5/cffi copying cffi/recompiler.py -> build/lib.linux-armv7l-3.5/cffi copying cffi/cparser.py -> build/lib.linux-armv7l-3.5/cffi copying cffi/pkgconfig.py -> build/lib.linux-armv7l-3.5/cffi copying cffi/commontypes.py -> build/lib.linux-armv7l-3.5/cffi copying cffi/_cffi_include.h -> build/lib.linux-armv7l-3.5/cffi copying cffi/parse_c_type.h -> build/lib.linux-armv7l-3.5/cffi copying cffi/_embedding.h -> build/lib.linux-armv7l-3.5/cffi copying cffi/_cffi_errors.h -> build/lib.linux-armv7l-3.5/cffi running build_ext building '_cffi_backend' extension creating build/temp.linux-armv7l-3.5 creating build/temp.linux-armv7l-3.5/c arm-linux-gnueabihf-gcc
-pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-RUbMX3/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python3.5m -c c/_cffi_backend.c -o build/temp.linux-armv7l-3.5/c/_cffi_backend.o c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory
#include <ffi.h>
^ compilation terminated. error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
---------------------------------------- Failed building wheel for cffi Running setup.py clean for cffi Failed to build cffi Installing collected packages: pycparser, cffi Running setup.py install for cffi ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-pqz_612d/cffi/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-m_en9z1k-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
running install
running build
running build_py
creating build
creating build/lib.linux-armv7l-3.5
creating build/lib.linux-armv7l-3.5/cffi
copying cffi/vengine_cpy.py -> build/lib.linux-armv7l-3.5/cffi
copying cffi/model.py -> build/lib.linux-armv7l-3.5/cffi
copying cffi/vengine_gen.py -> build/lib.linux-armv7l-3.5/cffi
copying cffi/error.py -> build/lib.linux-armv7l-3.5/cffi
copying cffi/backend_ctypes.py -> build/lib.linux-armv7l-3.5/cffi
copying cffi/verifier.py -> build/lib.linux-armv7l-3.5/cffi
copying cffi/lock.py -> build/lib.linux-armv7l-3.5/cffi
copying cffi/api.py -> build/lib.linux-armv7l-3.5/cffi
copying cffi/setuptools_ext.py -> build/lib.linux-armv7l-3.5/cffi
copying cffi/__init__.py -> build/lib.linux-armv7l-3.5/cffi
copying cffi/cffi_opcode.py -> build/lib.linux-armv7l-3.5/cffi
copying cffi/ffiplatform.py -> build/lib.linux-armv7l-3.5/cffi
copying cffi/recompiler.py -> build/lib.linux-armv7l-3.5/cffi
copying cffi/cparser.py -> build/lib.linux-armv7l-3.5/cffi
copying cffi/pkgconfig.py -> build/lib.linux-armv7l-3.5/cffi
copying cffi/commontypes.py -> build/lib.linux-armv7l-3.5/cffi
copying cffi/_cffi_include.h -> build/lib.linux-armv7l-3.5/cffi
copying cffi/parse_c_type.h -> build/lib.linux-armv7l-3.5/cffi
copying cffi/_embedding.h -> build/lib.linux-armv7l-3.5/cffi
copying cffi/_cffi_errors.h -> build/lib.linux-armv7l-3.5/cffi
running build_ext
building '_cffi_backend' extension
creating build/temp.linux-armv7l-3.5
creating build/temp.linux-armv7l-3.5/c
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-RUbMX3/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python3.5m -c c/_cffi_backend.c -o build/temp.linux-armv7l-3.5/c/_cffi_backend.o
c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory
#include <ffi.h>
^
compilation terminated.
error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
---------------------------------------- Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-pqz_612d/cffi/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-m_en9z1k-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-pqz_612d/cffi/
You seem to be missing one or both of these:
sudo apt-get install python-dev 
sudo apt-get install libffi-dev

Manual install (and easy_install) of MySQLdb-Python ending in error on Mac terminal

As the title says, I have followed multiple instruction but can't get in installed due to an error at the end of processes. The following is the terminal output after: sudo python setup.py install after CD-ing into the un-tar-ed file.
EDIT: After some feedback/testing, I am 99% sure it has something to do with cc -fno-strict-aliasing... and error: command 'cc' failed with exit status 1 at the end of the log. Maybe a problem with my C?
running install
running bdist_egg
running egg_info
writing MySQL_python.egg-info/PKG-INFO
writing top-level names to MySQL_python.egg-info/top_level.txt
writing dependency_links to MySQL_python.egg-info/dependency_links.txt
writing MySQL_python.egg-info/PKG-INFO
writing top-level names to MySQL_python.egg-info/top_level.txt
writing dependency_links to MySQL_python.egg-info/dependency_links.txt
reading manifest file 'MySQL_python.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'MySQL_python.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.9-intel/egg
running install_lib
running build_py
creating build
creating build/lib.macosx-10.9-intel-2.7
copying _mysql_exceptions.py -> build/lib.macosx-10.9-intel-2.7
creating build/lib.macosx-10.9-intel-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.9-intel-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.9-intel-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.9-intel-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.9-intel-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.9-intel-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.9-intel-2.7/MySQLdb
creating build/lib.macosx-10.9-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.9-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.9-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.9-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.9-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.9-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.9-intel-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.9-intel-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.9-intel-2.7
cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -pipe -Dversion_info=(1,2,4,'beta',4) -D__version__=1.2.4b4 -I/usr/local/mysql/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.9-intel-2.7/_mysql.o -Os -g -fno-strict-aliasing -arch x86_64
clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
error: command 'cc' failed with exit status 1
This looks like a problem with your C compiler. I'm not sure exactly how to fix it.
From the gcc documentation:
-mno-fused-madd
Generate code that uses (does not use) the floating-point multiply and accumulate instructions. These instructions are generated by default if hardware floating point is used. The machine-dependent -mfused-madd option is now mapped to the machine-independent -ffp-contract=fast option, and -mno-fused-madd is mapped to -ffp-contract=off.
It looks like the -mno-fused-madd option is not available on your architecture. I would guess the setup file is not configured properly for your machine. Is there a configure script you forgot to run?

Resources