Pytorch_geometric: Fail to install torch-scatter

Created on 2 May 2019  Â·  3Comments  Â·  Source: rusty1s/pytorch_geometric

📚 Installation

I use pip install torch-scatter to install torch-scatter but get the following error:

`Collecting torch-scatter
Downloading https://files.pythonhosted.org/packages/07/c0/f7ac424496f4a3bcb31aa993fba29077a6d42fc2624c66e90b58a566a98e/torch_scatter-1.2.0.tar.gz
Building wheels for collected packages: torch-scatter
Running setup.py bdist_wheel for torch-scatter ... error
Complete output from command /opt/conda/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-vhg1cu0p/torch-scatter/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-ht0ib55j --python-tag cp36:
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/test
copying test/utils.py -> build/lib.linux-x86_64-3.6/test
copying test/test_backward.py -> build/lib.linux-x86_64-3.6/test
copying test/test_multi_gpu.py -> build/lib.linux-x86_64-3.6/test
copying test/test_std.py -> build/lib.linux-x86_64-3.6/test
copying test/__init__.py -> build/lib.linux-x86_64-3.6/test
copying test/test_forward.py -> build/lib.linux-x86_64-3.6/test
creating build/lib.linux-x86_64-3.6/torch_scatter
copying torch_scatter/div.py -> build/lib.linux-x86_64-3.6/torch_scatter
copying torch_scatter/min.py -> build/lib.linux-x86_64-3.6/torch_scatter
copying torch_scatter/max.py -> build/lib.linux-x86_64-3.6/torch_scatter
copying torch_scatter/std.py -> build/lib.linux-x86_64-3.6/torch_scatter
copying torch_scatter/mul.py -> build/lib.linux-x86_64-3.6/torch_scatter
copying torch_scatter/__init__.py -> build/lib.linux-x86_64-3.6/torch_scatter
copying torch_scatter/mean.py -> build/lib.linux-x86_64-3.6/torch_scatter
copying torch_scatter/add.py -> build/lib.linux-x86_64-3.6/torch_scatter
copying torch_scatter/sub.py -> build/lib.linux-x86_64-3.6/torch_scatter
creating build/lib.linux-x86_64-3.6/torch_scatter/utils
copying torch_scatter/utils/gen.py -> build/lib.linux-x86_64-3.6/torch_scatter/utils
copying torch_scatter/utils/ext.py -> build/lib.linux-x86_64-3.6/torch_scatter/utils
copying torch_scatter/utils/__init__.py -> build/lib.linux-x86_64-3.6/torch_scatter/utils
running build_ext
building 'torch_scatter.scatter_cpu' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/cpu
gcc -pthread -B /opt/conda/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/opt/conda/lib/python3.6/site-packages/torch/lib/include -I/opt/conda/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include -I/opt/conda/lib/python3.6/site-packages/torch/lib/include/TH -I/opt/conda/lib/python3.6/site-packages/torch/lib/include/THC -I/opt/conda/include/python3.6m -c cpu/scatter.cpp -o build/temp.linux-x86_64-3.6/cpu/scatter.o -Wno-unused-variable -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=scatter_cpu -std=c++11
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from /opt/conda/lib/python3.6/site-packages/torch/lib/include/ATen/ATen.h:9:0,
from /opt/conda/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include/torch/types.h:3,
from /opt/conda/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
from /opt/conda/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include/torch/data/dataloader.h:3,
from /opt/conda/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include/torch/data.h:3,
from /opt/conda/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include/torch/all.h:4,
from /opt/conda/lib/python3.6/site-packages/torch/lib/include/torch/extension.h:4,
from cpu/scatter.cpp:1:
cpu/scatter.cpp: In lambda function:
cpu/scatter.cpp:8:40: error: invalid initialization of reference of type ‘const at::Type&’ from expression of type ‘c10::ScalarType’
AT_DISPATCH_ALL_TYPES(src.scalar_type(), "scatter_mul", [&] {
^
/opt/conda/lib/python3.6/site-packages/torch/lib/include/ATen/Dispatch.h:70:32: note: in definition of macro ‘AT_DISPATCH_ALL_TYPES’
const at::Type& the_type = TYPE; \
^
cpu/scatter.cpp: In lambda function:
cpu/scatter.cpp:21:40: error: invalid initialization of reference of type ‘const at::Type&’ from expression of type ‘c10::ScalarType’
AT_DISPATCH_ALL_TYPES(src.scalar_type(), "scatter_div", [&] {
^
/opt/conda/lib/python3.6/site-packages/torch/lib/include/ATen/Dispatch.h:70:32: note: in definition of macro ‘AT_DISPATCH_ALL_TYPES’
const at::Type& the_type = TYPE; \
^
cpu/scatter.cpp: In lambda function:
cpu/scatter.cpp:34:40: error: invalid initialization of reference of type ‘const at::Type&’ from expression of type ‘c10::ScalarType’
AT_DISPATCH_ALL_TYPES(src.scalar_type(), "scatter_max", [&] {
^
/opt/conda/lib/python3.6/site-packages/torch/lib/include/ATen/Dispatch.h:70:32: note: in definition of macro ‘AT_DISPATCH_ALL_TYPES’
const at::Type& the_type = TYPE; \
^
cpu/scatter.cpp: In lambda function:
cpu/scatter.cpp:51:40: error: invalid initialization of reference of type ‘const at::Type&’ from expression of type ‘c10::ScalarType’
AT_DISPATCH_ALL_TYPES(src.scalar_type(), "scatter_min", [&] {
^
/opt/conda/lib/python3.6/site-packages/torch/lib/include/ATen/Dispatch.h:70:32: note: in definition of macro ‘AT_DISPATCH_ALL_TYPES’
const at::Type& the_type = TYPE; \
^
cpu/scatter.cpp: In lambda function:
cpu/scatter.cpp:68:41: error: invalid initialization of reference of type ‘const at::Type&’ from expression of type ‘c10::ScalarType’
AT_DISPATCH_ALL_TYPES(grad.scalar_type(), "index_backward", [&] {
^
/opt/conda/lib/python3.6/site-packages/torch/lib/include/ATen/Dispatch.h:70:32: note: in definition of macro ‘AT_DISPATCH_ALL_TYPES’
const at::Type& the_type = TYPE; \
^
error: command 'gcc' failed with exit status 1


Failed building wheel for torch-scatter
Running setup.py clean for torch-scatter
Failed to build torch-scatter`

Environment

  • OS: ubuntu 16.04
  • Python version: 3.6.7
  • PyTorch version: 1.0.0
  • CUDA/cuDNN version: 10.0.130
  • GCC version: 5.4.0
  • How you tried to install PyTorch Geometric and its extensions (pip, source): I can install pytorch-geometric successfully
  • Any other relevant information:

Additional context

Previously I can install torch-scatter in NVIDIA container image (https://docs.nvidia.com/deeplearning/dgx/pytorch-release-notes/Chunk1210292610.html#rel_18.12). But after I upgrade my own OS from ubuntu 16.04 to ubuntu 18.04, I fail to install it in the same image.

Most helpful comment

Thank you for your suggestion!
I have successfully installed the required packages with former versions for PyTorch 1.0:
torch-scatter==1.1.2
torch-sparse==0.2.4
torch-cluster==1.2.4

All 3 comments

Hi, I updated PyG and all subpackages to work on PyTorch 1.1. Either upgrade PyTorch or install a former version of torch-scatter.

Thank you for your suggestion!
I have successfully installed the required packages with former versions for PyTorch 1.0:
torch-scatter==1.1.2
torch-sparse==0.2.4
torch-cluster==1.2.4

I get this exact error with PyTorch 1.1, gcc 5.5.0 for torch-scatter.

EDIT: oops never mind, I must've had some conflicting version installed somehow. Thanks for the tip

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Raverss picture Raverss  Â·  3Comments

SaschaStenger picture SaschaStenger  Â·  4Comments

Zhangzhk0819 picture Zhangzhk0819  Â·  3Comments

weihua916 picture weihua916  Â·  3Comments

douglasrizzo picture douglasrizzo  Â·  4Comments