I cannot successfully install “torch_scatter”.
When I run the command line : pip3 install torch_scatter, an error always occurs, just like below. I tried to solve the problem, but I don’t find the correct method. Could you help me? Thanks a lot!
The error:
…
cpu/scatter.cpp:1:29: fatal error: torch/extension.h: No such file or directory
compilation terminated.
error: command ‘x86_64-linux-gnu-gcc’ failed with exit status 1
Failed building wheel for torch-scatter
Running setup.py clean for torch-scatter
Failed to build torch-scatter
Installing collected packages: torch-scatter
Running setup.py install for torch-scatter … error
Complete output from command /usr/bin/python3 -u -c “import setuptools, tokenize; file =’/tmp/pip-build-ijd9s63n/torch-scatter/setup.py’;exec(compile(getattr(tokenize, ‘open’, open)( file ).read().replace(’\r\n’, ‘\n’), file , ‘exec’))” install --record /tmp/pip-4tkx7v_s-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.5
creating build/lib.linux-x86_64-3.5/torch_scatter
copying torch_scatter/mul.py -> build/lib.linux-x86_64-3.5/torch_scatter
copying torch_scatter/mean.py -> build/lib.linux-x86_64-3.5/torch_scatter
copying torch_scatter/sub.py -> build/lib.linux-x86_64-3.5/torch_scatter
copying torch_scatter/min.py -> build/lib.linux-x86_64-3.5/torch_scatter
copying torch_scatter/std.py -> build/lib.linux-x86_64-3.5/torch_scatter
copying torch_scatter/ init .py -> build/lib.linux-x86_64-3.5/torch_scatter
copying torch_scatter/max.py -> build/lib.linux-x86_64-3.5/torch_scatter
copying torch_scatter/div.py -> build/lib.linux-x86_64-3.5/torch_scatter
copying torch_scatter/add.py -> build/lib.linux-x86_64-3.5/torch_scatter
creating build/lib.linux-x86_64-3.5/test
copying test/test_multi_gpu.py -> build/lib.linux-x86_64-3.5/test
copying test/utils.py -> build/lib.linux-x86_64-3.5/test
copying test/test_std.py -> build/lib.linux-x86_64-3.5/test
copying test/ init .py -> build/lib.linux-x86_64-3.5/test
copying test/test_forward.py -> build/lib.linux-x86_64-3.5/test
copying test/test_backward.py -> build/lib.linux-x86_64-3.5/test
creating build/lib.linux-x86_64-3.5/torch_scatter/utils
copying torch_scatter/utils/ext.py -> build/lib.linux-x86_64-3.5/torch_scatter/utils
copying torch_scatter/utils/ init .py -> build/lib.linux-x86_64-3.5/torch_scatter/utils
copying torch_scatter/utils/gen.py -> build/lib.linux-x86_64-3.5/torch_scatter/utils
running build_ext
building ‘torch_scatter.scatter_cpu’ extension
creating build/temp.linux-x86_64-3.5
creating build/temp.linux-x86_64-3.5/cpu
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/zgh/.local/lib/python3.5/site-packages/torch/lib/include -I/home/zgh/.local/lib/python3.5/site-packages/torch/lib/include/TH -I/home/zgh/.local/lib/python3.5/site-packages/torch/lib/include/THC -I/usr/include/python3.5m -c cpu/scatter.cpp -o build/temp.linux-x86_64-3.5/cpu/scatter.o -Wno-unused-variable -DTORCH_EXTENSION_NAME=scatter_cpu -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
cpu/scatter.cpp:1:29: fatal error: torch/extension.h: No such file or directory
compilation terminated.
error: command ‘x86_64-linux-gnu-gcc’ failed with exit status 1
----------------------------------------

Command “/usr/bin/python3 -u -c “import setuptools, tokenize; file =’/tmp/pip-build-ijd9s63n/torch-scatter/setup.py’;exec(compile(getattr(tokenize, ‘open’, open)( file ).read().replace(’\r\n’, ‘\n’), file , ‘exec’))” install --record /tmp/pip-4tkx7v_s-record/install-record.txt --single-version-externally-managed --compile” failed with error code 1 in /tmp/pip-build-ijd9s63n/torch-scatter/
You are using pip version 8.1.1, however version 19.1.1 is available.
You should consider upgrading via the ‘pip install --upgrade pip’ command.