Error installing shap in jupyter notebook : shap installed on ubuntu system but not on jupyter notebook

I am getting a problem installing shap in jupyter notebook, it is showing the following error, Running setup.py install for shap... error. While shap is getting installed from the terminal without any problem. Please help. I am using: - pip install shap, also I am unable to use conda. Using pip install conda also shows the error of the same kind:- Building wheel for pycosat (setup.py)... error, Running setup.py install for pycosat... error.

The following is the error that I am facing while using pip install shap:-

Collecting shap

Using cached shap-0.35.0.tar.gz (273 kB)

Requirement already satisfied: numpy in /home/kv/snap/jupyter/common/lib/python3.7/site-packages (from shap) (1.18.2)

Requirement already satisfied: scipy in /home/kv/snap/jupyter/common/lib/python3.7/site-packages (from shap) (1.4.1)

Requirement already satisfied: scikit-learn in home/kv/snap/jupyter/common/lib/python3.7/site-packages (from shap) (0.22.2.post1)

Requirement already satisfied: pandas in /home/kv/snap/jupyter/common/lib/python3.7/site-packages (from shap) (1.0.3)

Requirement already satisfied: tqdm>4.25.0 in /home/kv/snap/jupyter/common/lib/python3.7/site-packages (from shap) (4.45.0)

Requirement already satisfied: joblib>=0.11 in /home/kv/snap/jupyter/common/lib/python3.7/site-packages (from scikit-learn->shap) (0.14.1)

Requirement already satisfied: python-dateutil>=2.6.1 in /snap/jupyter/6/lib/python3.7/site-packages (from pandas->shap) (2.8.0)

Requirement already satisfied: pytz>=2017.2 in /home/kv/snap/jupyter/common/lib/python3.7/site-packages (from pandas->shap) (2019.3)

Requirement already satisfied: six>=1.5 in /snap/jupyter/6/lib/python3.7/site-packages (from python-dateutil>=2.6.1->pandas->shap) (1.12.0)

Building wheels for collected packages: shap

Building wheel for shap (setup.py)... 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'"'"'))' bdist_wheel -d /tmp/pip-wheel-1shy2q7c

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

Complete output (71 lines):

running bdist_wheel

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-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

unable to execute 'gcc': 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

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-

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

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

error: command 'gcc' failed with exit status 1

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

ERROR: Command errored out with exit status 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(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 Check the logs for full command output.

Примечание: вам может потребоваться перезапустить ядро, чтобы использовать обновленные пакеты.

1 ответ

невозможно выполнить 'gcc': нет такого файла или каталога

Вам необходимо установить компилятор и инструменты сборки:

sudo apt update
sudo apt install build-essential
gcc --version
Другие вопросы по тегам