我在 jupyter notebook 中安装 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-learn(来自 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 '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(代码,文件,'"'"'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
错误:shap 的构建轮失败
为 shap 运行 setup.py clean
无法构建形状
安装收集的包: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/解释器/其他
copying shap/explainers/other/coefficent.py -> build/lib.linux-x86_64-
3.7/shap/解释器/其他
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/解释器/其他
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-prototypes -fPIC -I/snap/jupyter/6/include/python3.7m -I/home/kv/snap/jupyter/common/lib/python3.7/站点包/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'"'"'; 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(代码,文件,'"'"'exec'"'"'))' install --record /tmp/pip-record-tt70qus_/install-record.
注意:您可能需要重新启动内核才能使用更新的软件包。