繁体   English   中英

Pip 在 Pip 虚拟环境中安装 SHAP 失败

[英]Pip Install SHAP Failed in Pip Virtual Environment

我在 Linux 服务器上的 Python 3.6.3 上使用 pip 虚拟环境。

我尝试 pip 安装 SHAP 但遇到以下错误:

          Building wheel for shap (setup.py) ... error
      ERROR: Complete output from command XXXX/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-aq97v0m2/shap/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-v9vyt50m --python-tag cp36:
      ERROR: running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-3.6
      creating build/lib.linux-x86_64-3.6/shap
      copying shap/common.py -> build/lib.linux-x86_64-3.6/shap
      copying shap/__init__.py -> build/lib.linux-x86_64-3.6/shap
      copying shap/datasets.py -> build/lib.linux-x86_64-3.6/shap
      creating build/lib.linux-x86_64-3.6/shap/explainers
      copying shap/explainers/pytree.py -> build/lib.linux-x86_64-3.6/shap/explainers
      copying shap/explainers/deep.py -> build/lib.linux-x86_64-3.6/shap/explainers
      copying shap/explainers/sampling.py -> build/lib.linux-x86_64-3.6/shap/explainers
      copying shap/explainers/mimic.py -> build/lib.linux-x86_64-3.6/shap/explainers
      copying shap/explainers/__init__.py -> build/lib.linux-x86_64-3.6/shap/explainers
      copying shap/explainers/linear.py -> build/lib.linux-x86_64-3.6/shap/explainers
      copying shap/explainers/gradient.py -> build/lib.linux-x86_64-3.6/shap/explainers
      copying shap/explainers/explainer.py -> build/lib.linux-x86_64-3.6/shap/explainers
      copying shap/explainers/kernel.py -> build/lib.linux-x86_64-3.6/shap/explainers
      copying shap/explainers/tree.py -> build/lib.linux-x86_64-3.6/shap/explainers
      creating build/lib.linux-x86_64-3.6/shap/explainers/other
      copying shap/explainers/other/random.py -> build/lib.linux-x86_64-3.6/shap/explainers/other
      copying shap/explainers/other/__init__.py -> build/lib.linux-x86_64-3.6/shap/explainers/other
      copying shap/explainers/other/coefficent.py -> build/lib.linux-x86_64-3.6/shap/explainers/other
      creating build/lib.linux-x86_64-3.6/shap/plots
      copying shap/plots/colors.py -> build/lib.linux-x86_64-3.6/shap/plots
      copying shap/plots/image.py -> build/lib.linux-x86_64-3.6/shap/plots
      copying shap/plots/dependence.py -> build/lib.linux-x86_64-3.6/shap/plots
      copying shap/plots/summary.py -> build/lib.linux-x86_64-3.6/shap/plots
      copying shap/plots/__init__.py -> build/lib.linux-x86_64-3.6/shap/plots
      copying shap/plots/force.py -> build/lib.linux-x86_64-3.6/shap/plots
      creating build/lib.linux-x86_64-3.6/shap/benchmark
      copying shap/benchmark/plots.py -> build/lib.linux-x86_64-3.6/shap/benchmark
      copying shap/benchmark/__init__.py -> build/lib.linux-x86_64-3.6/shap/benchmark
      copying shap/benchmark/methods.py -> build/lib.linux-x86_64-3.6/shap/benchmark
      copying shap/benchmark/scorers.py -> build/lib.linux-x86_64-3.6/shap/benchmark
      copying shap/benchmark/metrics.py -> build/lib.linux-x86_64-3.6/shap/benchmark
      creating build/lib.linux-x86_64-3.6/shap/plots/resources
      copying shap/plots/resources/logoSmallGray.png -> build/lib.linux-x86_64-3.6/shap/plots/resources
      copying shap/plots/resources/bundle.js -> build/lib.linux-x86_64-3.6/shap/plots/resources
      running build_ext
      numpy.get_include() /usr/local/share/anaconda/anaconda3-5.0.1/lib/python3.6/site-packages/numpy/core/include
      building 'shap._cext' extension
      creating build/temp.linux-x86_64-3.6
      creating build/temp.linux-x86_64-3.6/shap
      gcc -pthread -B /usr/local/share/anaconda/anaconda3-5.0.1/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/XXX/include -I/usr/local/share/anaconda/anaconda3-5.0.1/include/python3.6m -I/usr/local/share/anaconda/anaconda3-5.0.1/lib/python3.6/site-packages/numpy/core/include -c shap/_cext.cc -o build/temp.linux-x86_64-3.6/shap/_cext.o
      gcc: error trying to exec 'cc1plus': execvp: No such file or directory
      error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for shap
  Running setup.py clean for shap
Failed to build shap
Installing collected packages: shap
  Running setup.py install for shap ... error

我浏览了一些类似的问题并尝试通过指定 package 版本来安装 SHAP,但没有任何成功。

你能请教吗? 提前致谢!

使您的安装崩溃的错误是:

error trying to exec 'cc1plus': execvp: No such file or directory

可以通过安装 g++ 来修复:

sudo apt-get install g++

如果显示如下消息:找不到 package,请尝试以下命令:

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install g++

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM