我在Ubuntu 18.04下使用virtualenv venv -p python3
和source venv/bin/activate
创建了一个虚拟环境。然后,我尝试安装hpbandster,该软件根据需要安装ConfigSpace。 ConfigSpace的安装失败并引发以下错误:
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.
我没有sudo权限,所以我必须继续使用Python 3.7.5。是什么原因导致此问题,如何解决?
错误:未知文件类型'.pyx'(来自'ConfigSpace / hyperparameters.pyx')]
有一个错误报告130,仍在打开。该软件包似乎已损坏,无法通过pip
安装。
尝试安装Cython:
pip install Cython
pip install ConfigSpace
严重错误:Python.h:没有这样的文件
您应该安装Python开发/头文件。如果没有超级用户访问权限,请从Python源代码安装它们,并直接编译器以使用您的本地标头。