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

时间:2020-04-07 15:05:58

标签: python pip jupyter-notebook shap

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

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

Collecting shap

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

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

已满足要求:/home/kv/snap/jupyter/common/lib/python3.7/site-packages中的scipy(从shap开始)(1.4.1)

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

已满足要求:/home/kv/snap/jupyter/common/lib/python3.7/site-packages中的熊猫(从shap开始)(1.0.3)

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

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

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

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

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

用于收集包裹的构建轮:shap

shap(setup.py)的建筑轮子...错误

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

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

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

完成输出(71行):

运行bdist_wheel

运行版本

运行build_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 / explainers

复制shap / explainers / additive.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_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 / waterfall.py-> build / lib.linux-x86_64-3.7 / shap / plots

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

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

复制shap / plots / force_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

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

复制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 / logoSmallGray.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

复制shap / tree_shap.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

构建“ shap._cext”扩展名

创建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-prototypes -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

无法执行“ gcc”:没有此类文件或目录

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


错误:成型轮失败

运行setup.py进行清理

无法建立形状

安装收集的软件包: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(tokenize,'“'”'open'“'” ',打开)(文件);代码= f.read()。replace('“'”'\ r \ n'“'”,'“'”'\ n'“' “'); f.close(); exec(compile(code, file ,'”'“'exec'”'“'))'安装--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检查完整命令输出的日志。

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

1 个答案:

答案 0 :(得分:0)

无法执行“ gcc”:没有此类文件或目录

您需要安装编译器和构建工具:

sudo apt update
sudo apt install build-essential
gcc --version