Python3.8 无法安装 shap、llvmlite 或 numba
Python3.8 cannot install shap, llvmlite, or numba
我正在尝试安装快照:
sudo -H python3.8 -m pip install shap
但这会产生
Warning: Can't read registry to find the necessary compiler setting
Make sure that Python modules winreg, win32api or win32con are installed.
C compiler: 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
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/numba
compile options: '-I/usr/include/python3.8 -c'
x86_64-linux-gnu-gcc: numba/_dynfuncmod.c
In file included from numba/_dynfunc.c:6:0,
from numba/_dynfuncmod.c:1:
numba/_pymodule.h:6:10: fatal error: Python.h: No such file or directory
#include <Python.h>
^~~~~~~~~~
compilation terminated.
error: Command "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/usr/include/python3.8 -c numba/_dynfuncmod.c -o build/temp.linux-x86_64-3.8/numba/_dynfuncmod.o" failed with exit status 1
----------------------------------------
Failed building wheel for numba
Running setup.py clean for numba
Running setup.py bdist_wheel for llvmlite ... error
Complete output from command /usr/bin/python3.8 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-g2j9vqik/llvmlite/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/tmpeqdilkydpip-wheel- --python-tag cp38:
running bdist_wheel
/usr/bin/python3.8 /tmp/pip-build-g2j9vqik/llvmlite/ffi/build.py
LLVM version... Traceback (most recent call last):
File "/tmp/pip-build-g2j9vqik/llvmlite/ffi/build.py", line 105, in main_posix
out = subprocess.check_output([llvm_config, '--version'])
File "/usr/lib/python3.8/subprocess.py", line 411, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/usr/lib/python3.8/subprocess.py", line 489, in run
with Popen(*popenargs, **kwargs) as process:
File "/usr/lib/python3.8/subprocess.py", line 854, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.8/subprocess.py", line 1702, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'llvm-config'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/pip-build-g2j9vqik/llvmlite/ffi/build.py", line 191, in <module>
main()
File "/tmp/pip-build-g2j9vqik/llvmlite/ffi/build.py", line 181, in main
main_posix('linux', '.so')
File "/tmp/pip-build-g2j9vqik/llvmlite/ffi/build.py", line 107, in main_posix
raise RuntimeError("%s failed executing, please point LLVM_CONFIG "
RuntimeError: llvm-config failed executing, please point LLVM_CONFIG to the path for llvm-config
error: command '/usr/bin/python3.8' failed with exit status 1
----------------------------------------
Failed building wheel for llvmlite
Running setup.py clean for llvmlite
Failed to build shap numba llvmlite
Installing collected packages: llvmlite, numba, python-dateutil, pandas, slicer, tqdm, shap
Running setup.py install for llvmlite ... error
Complete output from command /usr/bin/python3.8 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-g2j9vqik/llvmlite/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-o_ke5g0q-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
got version from file /tmp/pip-build-g2j9vqik/llvmlite/llvmlite/_version.py {'version': '0.35.0', 'full': 'ea23b026930cc00824c907172383f54c9d438e6b'}
running build_ext
/usr/bin/python3.8 /tmp/pip-build-g2j9vqik/llvmlite/ffi/build.py
LLVM version... Traceback (most recent call last):
File "/tmp/pip-build-g2j9vqik/llvmlite/ffi/build.py", line 105, in main_posix
out = subprocess.check_output([llvm_config, '--version'])
File "/usr/lib/python3.8/subprocess.py", line 411, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/usr/lib/python3.8/subprocess.py", line 489, in run
with Popen(*popenargs, **kwargs) as process:
File "/usr/lib/python3.8/subprocess.py", line 854, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.8/subprocess.py", line 1702, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'llvm-config'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/pip-build-g2j9vqik/llvmlite/ffi/build.py", line 191, in <module>
main()
File "/tmp/pip-build-g2j9vqik/llvmlite/ffi/build.py", line 181, in main
main_posix('linux', '.so')
File "/tmp/pip-build-g2j9vqik/llvmlite/ffi/build.py", line 107, in main_posix
raise RuntimeError("%s failed executing, please point LLVM_CONFIG "
RuntimeError: llvm-config failed executing, please point LLVM_CONFIG to the path for llvm-config
error: command '/usr/bin/python3.8' failed with exit status 1
----------------------------------------
Command "/usr/bin/python3.8 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-g2j9vqik/llvmlite/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-o_ke5g0q-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-g2j9vqik/llvmlite/
我在 numba
和 llvm
中遇到了类似的错误
当我在 CPAN 中遇到这样的错误时,通常会建议我安装 Ubuntu 软件包,例如 sudo apt install somepackage
,但我在错误消息中没有看到类似的内容。
据我所知,我使用的是最新版本的 pip
:
con@V:~/Scripts/python3$ sudo -H python3.8 -m pip install --upgrade pip --no-cache-dir
Requirement already satisfied: pip in /usr/local/lib/python3.8/dist-packages (21.0.1)
如何改变我的系统来安装 shap
?
这里的问题是有这么多不同的潜在不兼容版本的库,这完全是一团糟。
解决方法:
sudo -H python3.8 -m pip install --upgrade pip wheel setuptools
sudo -H python3.8 -m pip install colorama --upgrade
sudo -H python3.8 -m pip install shap
此解决方案不那么明显的原因是因为 none 在错误消息中提到了这一点。
我正在尝试安装快照:
sudo -H python3.8 -m pip install shap
但这会产生
Warning: Can't read registry to find the necessary compiler setting
Make sure that Python modules winreg, win32api or win32con are installed.
C compiler: 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
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/numba
compile options: '-I/usr/include/python3.8 -c'
x86_64-linux-gnu-gcc: numba/_dynfuncmod.c
In file included from numba/_dynfunc.c:6:0,
from numba/_dynfuncmod.c:1:
numba/_pymodule.h:6:10: fatal error: Python.h: No such file or directory
#include <Python.h>
^~~~~~~~~~
compilation terminated.
error: Command "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/usr/include/python3.8 -c numba/_dynfuncmod.c -o build/temp.linux-x86_64-3.8/numba/_dynfuncmod.o" failed with exit status 1
----------------------------------------
Failed building wheel for numba
Running setup.py clean for numba
Running setup.py bdist_wheel for llvmlite ... error
Complete output from command /usr/bin/python3.8 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-g2j9vqik/llvmlite/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/tmpeqdilkydpip-wheel- --python-tag cp38:
running bdist_wheel
/usr/bin/python3.8 /tmp/pip-build-g2j9vqik/llvmlite/ffi/build.py
LLVM version... Traceback (most recent call last):
File "/tmp/pip-build-g2j9vqik/llvmlite/ffi/build.py", line 105, in main_posix
out = subprocess.check_output([llvm_config, '--version'])
File "/usr/lib/python3.8/subprocess.py", line 411, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/usr/lib/python3.8/subprocess.py", line 489, in run
with Popen(*popenargs, **kwargs) as process:
File "/usr/lib/python3.8/subprocess.py", line 854, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.8/subprocess.py", line 1702, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'llvm-config'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/pip-build-g2j9vqik/llvmlite/ffi/build.py", line 191, in <module>
main()
File "/tmp/pip-build-g2j9vqik/llvmlite/ffi/build.py", line 181, in main
main_posix('linux', '.so')
File "/tmp/pip-build-g2j9vqik/llvmlite/ffi/build.py", line 107, in main_posix
raise RuntimeError("%s failed executing, please point LLVM_CONFIG "
RuntimeError: llvm-config failed executing, please point LLVM_CONFIG to the path for llvm-config
error: command '/usr/bin/python3.8' failed with exit status 1
----------------------------------------
Failed building wheel for llvmlite
Running setup.py clean for llvmlite
Failed to build shap numba llvmlite
Installing collected packages: llvmlite, numba, python-dateutil, pandas, slicer, tqdm, shap
Running setup.py install for llvmlite ... error
Complete output from command /usr/bin/python3.8 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-g2j9vqik/llvmlite/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-o_ke5g0q-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
got version from file /tmp/pip-build-g2j9vqik/llvmlite/llvmlite/_version.py {'version': '0.35.0', 'full': 'ea23b026930cc00824c907172383f54c9d438e6b'}
running build_ext
/usr/bin/python3.8 /tmp/pip-build-g2j9vqik/llvmlite/ffi/build.py
LLVM version... Traceback (most recent call last):
File "/tmp/pip-build-g2j9vqik/llvmlite/ffi/build.py", line 105, in main_posix
out = subprocess.check_output([llvm_config, '--version'])
File "/usr/lib/python3.8/subprocess.py", line 411, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/usr/lib/python3.8/subprocess.py", line 489, in run
with Popen(*popenargs, **kwargs) as process:
File "/usr/lib/python3.8/subprocess.py", line 854, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.8/subprocess.py", line 1702, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'llvm-config'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/pip-build-g2j9vqik/llvmlite/ffi/build.py", line 191, in <module>
main()
File "/tmp/pip-build-g2j9vqik/llvmlite/ffi/build.py", line 181, in main
main_posix('linux', '.so')
File "/tmp/pip-build-g2j9vqik/llvmlite/ffi/build.py", line 107, in main_posix
raise RuntimeError("%s failed executing, please point LLVM_CONFIG "
RuntimeError: llvm-config failed executing, please point LLVM_CONFIG to the path for llvm-config
error: command '/usr/bin/python3.8' failed with exit status 1
----------------------------------------
Command "/usr/bin/python3.8 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-g2j9vqik/llvmlite/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-o_ke5g0q-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-g2j9vqik/llvmlite/
我在 numba
和 llvm
当我在 CPAN 中遇到这样的错误时,通常会建议我安装 Ubuntu 软件包,例如 sudo apt install somepackage
,但我在错误消息中没有看到类似的内容。
据我所知,我使用的是最新版本的 pip
:
con@V:~/Scripts/python3$ sudo -H python3.8 -m pip install --upgrade pip --no-cache-dir
Requirement already satisfied: pip in /usr/local/lib/python3.8/dist-packages (21.0.1)
如何改变我的系统来安装 shap
?
这里的问题是有这么多不同的潜在不兼容版本的库,这完全是一团糟。
解决方法:
sudo -H python3.8 -m pip install --upgrade pip wheel setuptools
sudo -H python3.8 -m pip install colorama --upgrade
sudo -H python3.8 -m pip install shap
此解决方案不那么明显的原因是因为 none 在错误消息中提到了这一点。