rusty1s / pytorch_cluster

PyTorch Extension Library of Optimized Graph Cluster Algorithms
MIT License
824 stars 148 forks source link

[Installation/Compiling] Building wheel for torch-cluster failed for CUDA 12.1 #210

Closed DylanWaken closed 8 months ago

DylanWaken commented 8 months ago

System Specification:

Operating System: Linux, Ubuntu-22.04 64 bit GPU: NVIDIA RTX 6000 ada CUDA version: Build cuda_12.1.r12.1/compiler.32415258_0 Cuda compilation tools, release 12.1, V12.1.66 Pytorch version: 2.2.0+cu121

Full Error Output:

dylan@dylan-server:~/Documents/Research$ pip install torch-cluster -f https://data.pyg.org/whl/torch-2.2.0+12.1.html
Defaulting to user installation because normal site-packages is not writeable
Looking in links: https://data.pyg.org/whl/torch-2.2.0+12.1.html
Collecting torch-cluster
  Using cached torch_cluster-1.6.3.tar.gz (54 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: scipy in /home/dylan/.local/lib/python3.10/site-packages (from torch-cluster) (1.10.0)
Requirement already satisfied: numpy<1.27.0,>=1.19.5 in /home/dylan/.local/lib/python3.10/site-packages (from scipy->torch-cluster) (1.23.5)
Building wheels for collected packages: torch-cluster
  Building wheel for torch-cluster (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-0bzvpt3d/torch-cluster_4d94d8257ece4577bf981329717ec098/setup.py'"'"'; __file__='"'"'/tmp/pip-install-0bzvpt3d/torch-cluster_4d94d8257ece4577bf981329717ec098/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-3vezoatx
       cwd: /tmp/pip-install-0bzvpt3d/torch-cluster_4d94d8257ece4577bf981329717ec098/
  Complete output (53 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.10
  creating build/lib.linux-x86_64-3.10/torch_cluster
  copying torch_cluster/grid.py -> build/lib.linux-x86_64-3.10/torch_cluster
  copying torch_cluster/nearest.py -> build/lib.linux-x86_64-3.10/torch_cluster
  copying torch_cluster/sampler.py -> build/lib.linux-x86_64-3.10/torch_cluster
  copying torch_cluster/typing.py -> build/lib.linux-x86_64-3.10/torch_cluster
  copying torch_cluster/testing.py -> build/lib.linux-x86_64-3.10/torch_cluster
  copying torch_cluster/radius.py -> build/lib.linux-x86_64-3.10/torch_cluster
  copying torch_cluster/fps.py -> build/lib.linux-x86_64-3.10/torch_cluster
  copying torch_cluster/rw.py -> build/lib.linux-x86_64-3.10/torch_cluster
  copying torch_cluster/graclus.py -> build/lib.linux-x86_64-3.10/torch_cluster
  copying torch_cluster/__init__.py -> build/lib.linux-x86_64-3.10/torch_cluster
  copying torch_cluster/knn.py -> build/lib.linux-x86_64-3.10/torch_cluster
  running egg_info
  writing torch_cluster.egg-info/PKG-INFO
  writing dependency_links to torch_cluster.egg-info/dependency_links.txt
  writing requirements to torch_cluster.egg-info/requires.txt
  writing top-level names to torch_cluster.egg-info/top_level.txt
  reading manifest file 'torch_cluster.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  warning: no previously-included files matching '*' found under directory 'test'
  adding license file 'LICENSE'
  writing manifest file 'torch_cluster.egg-info/SOURCES.txt'
  running build_ext
  /home/dylan/.local/lib/python3.10/site-packages/torch/utils/cpp_extension.py:425: UserWarning: There are no x86_64-linux-gnu-g++ version bounds defined for CUDA version 12.1
    warnings.warn(f'There are no {compiler_name} version bounds defined for CUDA version {cuda_str_version}')
  building 'torch_cluster._grid_cpu' extension
  creating build/temp.linux-x86_64-3.10
  creating build/temp.linux-x86_64-3.10/csrc
  creating build/temp.linux-x86_64-3.10/csrc/cpu
  x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWITH_PYTHON -Icsrc -I/home/dylan/.local/lib/python3.10/site-packages/torch/include -I/home/dylan/.local/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/dylan/.local/lib/python3.10/site-packages/torch/include/TH -I/home/dylan/.local/lib/python3.10/site-packages/torch/include/THC -I/usr/include/python3.10 -c csrc/cpu/grid_cpu.cpp -o build/temp.linux-x86_64-3.10/csrc/cpu/grid_cpu.o -O2 -Wno-sign-compare -DAT_PARALLEL_OPENMP -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="_gcc" -DPYBIND11_STDLIB="_libstdcpp" -DPYBIND11_BUILD_ABI="_cxxabi1011" -DTORCH_EXTENSION_NAME=_grid_cpu -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++17
  x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWITH_PYTHON -Icsrc -I/home/dylan/.local/lib/python3.10/site-packages/torch/include -I/home/dylan/.local/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/dylan/.local/lib/python3.10/site-packages/torch/include/TH -I/home/dylan/.local/lib/python3.10/site-packages/torch/include/THC -I/usr/include/python3.10 -c csrc/grid.cpp -o build/temp.linux-x86_64-3.10/csrc/grid.o -O2 -Wno-sign-compare -DAT_PARALLEL_OPENMP -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="_gcc" -DPYBIND11_STDLIB="_libstdcpp" -DPYBIND11_BUILD_ABI="_cxxabi1011" -DTORCH_EXTENSION_NAME=_grid_cpu -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++17
  x86_64-linux-gnu-g++ -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -g -fwrapv -O2 -Wl,-Bsymbolic-functions -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.10/csrc/cpu/grid_cpu.o build/temp.linux-x86_64-3.10/csrc/grid.o -L/home/dylan/.local/lib/python3.10/site-packages/torch/lib -lc10 -ltorch -ltorch_cpu -ltorch_python -o build/lib.linux-x86_64-3.10/torch_cluster/_grid_cpu.so -s
  building 'torch_cluster._grid_cuda' extension
  creating build/temp.linux-x86_64-3.10/csrc/cuda
  x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DWITH_PYTHON -DWITH_CUDA -Icsrc -I/home/dylan/.local/lib/python3.10/site-packages/torch/include -I/home/dylan/.local/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/dylan/.local/lib/python3.10/site-packages/torch/include/TH -I/home/dylan/.local/lib/python3.10/site-packages/torch/include/THC -I/usr/local/cuda/include -I/usr/include/python3.10 -c csrc/cpu/grid_cpu.cpp -o build/temp.linux-x86_64-3.10/csrc/cpu/grid_cpu.o -O2 -Wno-sign-compare -DAT_PARALLEL_OPENMP -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="_gcc" -DPYBIND11_STDLIB="_libstdcpp" -DPYBIND11_BUILD_ABI="_cxxabi1011" -DTORCH_EXTENSION_NAME=_grid_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++17
  /usr/local/cuda/bin/nvcc -DWITH_PYTHON -DWITH_CUDA -Icsrc -I/home/dylan/.local/lib/python3.10/site-packages/torch/include -I/home/dylan/.local/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/home/dylan/.local/lib/python3.10/site-packages/torch/include/TH -I/home/dylan/.local/lib/python3.10/site-packages/torch/include/THC -I/usr/local/cuda/include -I/usr/include/python3.10 -c csrc/cuda/grid_cuda.cu -o build/temp.linux-x86_64-3.10/csrc/cuda/grid_cuda.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options '-fPIC' -O2 --expt-relaxed-constexpr -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="_gcc" -DPYBIND11_STDLIB="_libstdcpp" -DPYBIND11_BUILD_ABI="_cxxabi1011" -DTORCH_EXTENSION_NAME=_grid_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_89,code=compute_89 -gencode=arch=compute_89,code=sm_89 -std=c++17
  /home/dylan/.local/lib/python3.10/site-packages/torch/include/pybind11/detail/../cast.h: In function ‘typename pybind11::detail::type_caster<typename pybind11::detail::intrinsic_type<T>::type>::cast_op_type<T> pybind11::detail::cast_op(make_caster<T>&)’:
  /home/dylan/.local/lib/python3.10/site-packages/torch/include/pybind11/detail/../cast.h:45:120: error: expected template-name before ‘<’ token
     45 |     return caster.operator typename make_caster<T>::template cast_op_type<T>();
        |                                                                                                                        ^
  /home/dylan/.local/lib/python3.10/site-packages/torch/include/pybind11/detail/../cast.h:45:120: error: expected identifier before ‘<’ token
  /home/dylan/.local/lib/python3.10/site-packages/torch/include/pybind11/detail/../cast.h:45:123: error: expected primary-expression before ‘>’ token
     45 |     return caster.operator typename make_caster<T>::template cast_op_type<T>();
        |                                                                                                                           ^
  /home/dylan/.local/lib/python3.10/site-packages/torch/include/pybind11/detail/../cast.h:45:126: error: expected primary-expression before ‘)’ token
     45 |     return caster.operator typename make_caster<T>::template cast_op_type<T>();
        |                                                                                                                              ^
  error: command '/usr/local/cuda/bin/nvcc' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for torch-cluster
  Running setup.py clean for torch-cluster
Failed to build torch-cluster

Attempts to directly build from git with pip install git+https://github.com/rusty1s/pytorch_cluster.git also failed Please help, thanks!

rusty1s commented 8 months ago

Please use

pip install torch-cluster -f https://data.pyg.org/whl/torch-2.2.0+cu121.html
DylanWaken commented 8 months ago

Fixed, thanks!