在jupyter笔记本中安装shap时出错:shap安装在ubuntu系统上,但未安装在jupyter笔记本上

2024-05-13 07:43:43 发布

您现在位置:Python中文网/ 问答频道 /正文

我在jupyter笔记本电脑中安装shap时遇到问题,它显示以下错误,正在为shap运行setup.py安装。。。错误从终端安装shap时没有任何问题。请帮忙。我正在使用:-pip安装shap,我也无法使用conda。使用pip install conda还显示了相同类型的错误:-为pycosat构建控制盘(setup.py)。。。错误,正在为pycosat运行setup.py安装。。。错误

以下是我在使用pip install shap时遇到的错误:-

Collecting shap

使用缓存的shap-0.35.0.tar.gz(273KB)

已满足要求:numpy in/home/kv/snap/jupyter/common/lib/python3.7/site-packages(来自shap)(1.18.2)

已满足要求:scipy in/home/kv/snap/jupyter/common/lib/python3.7/site-packages(来自shap)(1.4.1)

已满足要求:scikit在家学习/kv/snap/jupyter/common/lib/python3.7/site-packages(来自shap)(0.22.2.post1)

已满足要求:pandas in/home/kv/snap/jupyter/common/lib/python3.7/site-packages(来自shap)(1.0.3)

已满足的要求:tqdm>;4.25.0 in/home/kv/snap/jupyter/common/lib/python3.7/site-packages(来自shap)(4.45.0)

已满足的要求:joblib>=0.11in/home/kv/snap/jupyter/common/lib/python3.7/site-packages(来自scikit学习->;shap)(0.14.1)

已满足要求:python dateutil>=2.6.1 in/snap/jupyter/6/lib/python3.7/site-packages(来自pandas->;shap)(2.8.0)

已满足的要求:pytz>=2017.2 in/home/kv/snap/jupyter/common/lib/python3.7/site-packages(来自pandas->;shap)(2019.3)

已满足的要求:六个>=1.5 in/snap/jupyter/6/lib/python3.7/site-packages(来自python dateutil>;=2.6.1->;pandas->;shap)(1.12.0)

为收集的包构建控制盘:shap

正在为形状构建控制盘(setup.py)。。。错误

错误:命令出错,退出状态为1:

命令:/snap/jupyter/6/bin/python-u-c'import sys、setuptools、tokenize;sys.argv[0]=“””/tmp/pip-install-vla3cytp/shap/setup.py“”文件='“'”/tmp/pip-install-vla3cytp/shap/setup.py'”;f=getattr(标记化,“‘打开’”,打开) (文件);code=f.read().replace(“\r\n”“”、“\n”“”);f、 close();exec(编译(代码,文件,“'exec'”))'bdist_wheel-d/tmp/pip-wheel-1shy2q7c

   cwd: /tmp/pip-install-vla3cytp/shap/

完整输出(71行):

运转的车轮

运行构建

运行build\u py

创建构建

创建build/lib.linux-x86_64-3.7

创建build/lib.linux-x86_64-3.7/shap

复制shap/datasets.py->;build/lib.linux-x86_64-3.7/shap

复制shap/init.py->;build/lib.linux-x86_64-3.7/shap

复制shap/common.py->;build/lib.linux-x86_64-3.7/shap

创建build/lib.linux-x86_64-3.7/shap/explainers

复制shap/explainers/partition.py->;build/lib.linux-x86_64-3.7/shap/explainers

复制shap/explainers/tf_utils.py->;build/lib.linux-x86_64-3.7/shap/explainers

复制shap/explainers/explainer.py->;build/lib.linux-x86_64-3.7/shap/explainers 复制shap/explainers/sampling.py->;build/lib.linux-x86_64-3.7/shap/explainers

复制shap/explainers/mimic.py->;build/lib.linux-x86_64-3.7/shap/explainers

复制shap/explainers/linear.py->;build/lib.linux-x86_64-3.7/shap/explainers

复制shap/explainers/pytree.py->;build/lib.linux-x86_64-3.7/shap/explainers

复制shap/explainers/permutation.py->;build/lib.linux-x86_64-3.7/shap/explainers

复制shap/explainers/init.py->;build/lib.linux-x86_64-3.7/shap/explainers

复制shap/explainers/gradient.py->;build/lib.linux-x86_64-3.7/shap/ex普通人

复制shap/explainers/addition.py->;build/lib.linux-x86_64-3.7/shap/explainers

复制shap/explainers/kernel.py->;build/lib.linux-x86_64-3.7/shap/explainers

复制shap/explainers/tree.py->;build/lib.linux-x86_64-3.7/shap/explainers

复制shap/explainers/bruteforce.py->;build/lib.linux-x86_64-3.7/shap/explainers

创建build/lib.linux-x86_64-3.7/shap/explainers/other

复制shap/explainers/other/treegain.py->;build/lib.linux-x86_64-3.7/shap/explainers/other

复制shap/explainers/other/coefficent.py->;build/lib.linux-x86_64-3.7/shap/explainers/other

复制shap/explainers/other/lime.py->;build/lib.linux-x86_64-3.7/shap/explainers/other

复制shap/explainers/other/maple.py->;build/lib.linux-x86_64-3.7/shap/explainers/other

复制shap/explainers/other/init.py->;build/lib.linux-x86_64-3.7/shap/explainers/other

复制shap/explainers/other/random.py->;build/lib.linux-x86_64-3.7/shap/explainers/other

创建build/lib.linux-x86_64-3.7/shap/explainers/deep

复制shap/explainers/deep/deep\u tf.py->;build/lib.linux-x86_64-3.7/shap/explainers/deep

复制shap/explainers/deep/deep_pytorch.py->;build/lib.linux-x86_64- 3.7/shap/explainers/deep

复制shap/explainers/deep/init.py->;build/lib.linux-x86_64-3.7/shap/explainers/deep

创建build/lib.linux-x86_64-3.7/shap/plots

复制shap/plots/colorconv.py->;build/lib.linux-x86_64-3.7/shap/plots

复制shap/plots/colors.py->;build/lib.linux-x86_64-3.7/shap/plots

复制shap/plots/falter.py->;build/lib.linux-x86_64-3.7/shap/plots

复制shap/plots/monitoring.py->;build/lib.linux-x86_64-3.7/shap/plots

复制形状/绘图/部分相关性.py->;build/lib.linux-x86_64-3.7/shap/plots

复制形状/打印/强制_matplotlib.py->;build/lib.linux-x86_64-3.7/shap/plots

复制shap/plots/embedding.py->;build/lib.linux-x86_64-3.7/shap/plots

复制shap/plots/text.py->;build/lib.linux-x86_64-3.7/shap/plots

复制shap/plots/summary.py->;build/lib.linux-x86_64-3.7/shap/plots

复制shap/plots/image.py->;build/lib.linux-x86_64-3.7/shap/plots

复制shap/plots/decision.py->;build/lib.linux-x86_64-3.7/shap/plots

复制shap/plots/init.py->;build/lib.linux-x86_64-3.7/shap/plots

复制shap/plots/dependence.py->;build/lib.linux-x86_64-3.7/shap/plots

复制形状/绘图/bar.py->;build/lib.linux-x86_64-3.7/shap/plots

复制形状/绘图/force.py->;build/lib.linux-x86_64-3.7/shap/plots

创建build/lib.linux-x86_64-3.7/shap/benchmark

复制shap/benchmark/models.py->;build/lib.linux-x86_64-3.7/shap/benchmark

复制shap/benchmark/methods.py->;build/lib.linux-x86_64-3.7/shap/benchmark

复制shap/benchmark/measures.py->;build/lib.linux-x86_64-3.7/shap/benchmark

复制shap/benchmark/plots.py->;build/lib.linux-x86_64-3.7/shap/benchmark

复制shap/benchmark/metrics.py->;build/lib.linux-x86_64-3.7/shap/benchmark

复制shap/benchmark/init.py->;build/lib.linux-x86_64-3.7/shap/benchmark

复制shap/benchmark/experiments.py->;build/lib.linux-x86_64-3.7/shap/benchmark

创建build/lib.linux-x86_64-3.7/shap/plots/resources

复制shap/plots/resources/logosmalgray.png->;build/lib.linux-x86_64-3.7/shap/plots/resources

复制shap/plots/resources/bundle.js->;build/lib.linux-x86_64-3.7/shap/plots/resources

复制形状/树形状h->;build/lib.linux-x86_64-3.7/shap

运行build_ext

numpy.get_include()/home/kv/snap/jupyter/common/lib/python3.7/site-packages/numpy/core/include

建筑物“形状”扩展

创建build/temp.linux-x86_64-3.7

创建build/temp.linux-x86_64-3.7/shap

gcc-pthread-B/home/filipe/miniconda3/envs/JUPYTER/compiler_compat-Wl,--sysroot=/-Wsign-compare-DNDEBUG-g-fwrapv-O3-Wall-Wstrict原型-fPIC-I/snap/JUPYTER/6/include/python3.7m-I/home/kv/snap/JUPYTER/common/lib/python3.7/site-packages/numpy/core/include-c-shap/_cext.cc-o build/temp.linux-x86-64-3.7/shap

无法执行“gcc”:没有这样的文件或目录

错误:命令“gcc”失败,退出状态为1


错误:无法为形状生成控制盘

运行setup.py clean for shap

未能生成形状

安装收集的软件包:shap

Running setup.py install for shap ... error

ERROR: Command errored out with exit status 1:

 command: /snap/jupyter/6/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-vla3cytp/shap/setup.py'"'"'; __file__='"'"'/tmp/pip-install-vla3cytp/shap/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-tt70qus_/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/kv/snap/jupyter/common/include/python3.7m/shap

     cwd: /tmp/pip-install-vla3cytp/shap/

Complete output (71 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/shap

copying shap/datasets.py -> build/lib.linux-x86_64-3.7/shap

copying shap/__init__.py -> build/lib.linux-x86_64-3.7/shap

copying shap/common.py -> build/lib.linux-x86_64-3.7/shap

creating build/lib.linux-x86_64-3.7/shap/explainers

copying shap/explainers/partition.py -> build/lib.linux-x86_64-3.7/shap/explainers

copying shap/explainers/tf_utils.py -> build/lib.linux-x86_64-3.7/shap/explainers

copying shap/explainers/explainer.py -> build/lib.linux-x86_64-3.7/shap/explainers

copying shap/explainers/sampling.py -> build/lib.linux-x86_64-3.7/shap/explainers

copying shap/explainers/mimic.py -> build/lib.linux-x86_64-3.7/shap/explainers

copying shap/explainers/linear.py -> build/lib.linux-x86_64-3.7/shap/explainers

copying shap/explainers/pytree.py -> build/lib.linux-x86_64-3.7/shap/explainers

copying shap/explainers/permutation.py -> build/lib.linux-x86_64-3.7/shap/explainers

copying shap/explainers/__init__.py -> build/lib.linux-x86_64-3.7/shap/explainers

copying shap/explainers/gradient.py -> build/lib.linux-x86_64-3.7/shap/explainers

copying shap/explainers/additive.py -> build/lib.linux-x86_64-3.7/shap/explainers

copying shap/explainers/kernel.py -> build/lib.linux-x86_64-3.7/shap/explainers

copying shap/explainers/tree.py -> build/lib.linux-x86_64-3.7/shap/explainers

copying shap/explainers/bruteforce.py -> build/lib.linux-x86_64-3.7/shap/explainers

creating build/lib.linux-x86_64-3.7/shap/explainers/other

copying shap/explainers/other/treegain.py -> build/lib.linux-x86_64-

3.7/shap/explainers/other

copying shap/explainers/other/coefficent.py -> build/lib.linux-x86_64-

3.7/shap/explainers/other

copying shap/explainers/other/lime.py -> build/lib.linux-x86_64-3.7/shap/explainers/other

copying shap/explainers/other/maple.py -> build/lib.linux-x86_64-3.7/shap/explainers/other

copying shap/explainers/other/__init__.py -> build/lib.linux-x86_64-

3.7/shap/explainers/other

copying shap/explainers/other/random.py -> build/lib.linux-x86_64-3.7/shap/explainers/other

creating build/lib.linux-x86_64-3.7/shap/explainers/deep

copying shap/explainers/deep/deep_tf.py -> build/lib.linux-x86_64-3.7/shap/explainers/deep

copying shap/explainers/deep/deep_pytorch.py -> build/lib.linux-x86_64-

3.7/shap/explainers/deep

copying shap/explainers/deep/__init__.py -> build/lib.linux-x86_64-3.7/shap/explainers/deep

creating build/lib.linux-x86_64-3.7/shap/plots

copying shap/plots/colorconv.py -> build/lib.linux-x86_64-3.7/shap/plots

copying shap/plots/colors.py -> build/lib.linux-x86_64-3.7/shap/plots

copying shap/plots/waterfall.py -> build/lib.linux-x86_64-3.7/shap/plots

copying shap/plots/monitoring.py -> build/lib.linux-x86_64-3.7/shap/plots

copying shap/plots/partial_dependence.py -> build/lib.linux-x86_64-3.7/shap/plots

copying shap/plots/force_matplotlib.py -> build/lib.linux-x86_64-3.7/shap/plots

copying shap/plots/embedding.py -> build/lib.linux-x86_64-3.7/shap/plots

copying shap/plots/text.py -> build/lib.linux-x86_64-3.7/shap/plots

copying shap/plots/summary.py -> build/lib.linux-x86_64-3.7/shap/plots

copying shap/plots/image.py -> build/lib.linux-x86_64-3.7/shap/plots

copying shap/plots/decision.py -> build/lib.linux-x86_64-3.7/shap/plots

copying shap/plots/__init__.py -> build/lib.linux-x86_64-3.7/shap/plots

copying shap/plots/dependence.py -> build/lib.linux-x86_64-3.7/shap/plots

copying shap/plots/bar.py -> build/lib.linux-x86_64-3.7/shap/plots

copying shap/plots/force.py -> build/lib.linux-x86_64-3.7/shap/plots

creating build/lib.linux-x86_64-3.7/shap/benchmark

copying shap/benchmark/models.py -> build/lib.linux-x86_64-3.7/shap/benchmark

copying shap/benchmark/methods.py -> build/lib.linux-x86_64-3.7/shap/benchmark

copying shap/benchmark/measures.py -> build/lib.linux-x86_64-3.7/shap/benchmark

copying shap/benchmark/plots.py -> build/lib.linux-x86_64-3.7/shap/benchmark

copying shap/benchmark/metrics.py -> build/lib.linux-x86_64-3.7/shap/benchmark

copying shap/benchmark/__init__.py -> build/lib.linux-x86_64-3.7/shap/benchmark

copying shap/benchmark/experiments.py -> build/lib.linux-x86_64-3.7/shap/benchmark

creating build/lib.linux-x86_64-3.7/shap/plots/resources

copying shap/plots/resources/logoSmallGray.png -> build/lib.linux-x86_64-3.7/shap/plots/resources

copying shap/plots/resources/bundle.js -> build/lib.linux-x86_64-3.7/shap/plots/resources

copying shap/tree_shap.h -> build/lib.linux-x86_64-3.7/shap

running build_ext

numpy.get_include() /home/kv/snap/jupyter/common/lib/python3.7/site-packages/numpy/core/include

building 'shap._cext' extension

creating build/temp.linux-x86_64-3.7

creating build/temp.linux-x86_64-3.7/shap

gcc -pthread -B /home/filipe/miniconda3/envs/JUPYTER/compiler_compat -Wl,--sysroot=/ -Wsign-

比较-DNDEBUG-g-fwrapv-O3-Wall-Wstrict原型-fPIC-I/snap/jupyter/6/include/python3.7m-I/home/kv/snap/jupyter/common/lib/python3.7/site-packages/numpy/core/include-c shap/_cext.cc-o build/temp.linux-x86_64-3.7/shap/_cext.o

unable to execute 'gcc': No such file or directory

error: command 'gcc' failed with exit status 1

----------------------------------------

错误:命令出错,退出状态为1:/snap/jupyter/6/bin/python-u-c'import sys、setuptools、tokenize;sys.argv[0]=“””/tmp/pip-install-vla3cytp/shap/setup.py“”文件='“'”/tmp/pip-install-vla3cytp/shap/setup.py'”;f=getattr(标记化,“‘打开’”,打开)(文件);code=f.read().replace(“\r\n”“”、“\n”“”);f、 close();exec(compile(code,file,“'exec'”)'install--record/tmp/pip-record-tt70qus\uu/install-record.txt--single version externally managed--user--prefix=--compile--install headers/home/kv/snap/jupyter/common/include/python3.7m/shap检查日志以获得完整的命令输出

注意:您可能需要重新启动内核以使用更新的软件包


Tags: installpygtbuildlinuxlibjupyterx86
1条回答
网友
1楼 · 发布于 2024-05-13 07:43:43

unable to execute 'gcc': No such file or directory

您需要安装编译器和生成工具:

sudo apt update
sudo apt install build-essential
gcc  version

相关问题 更多 >