Missing `omp.h` error
bd-fauna opened this issue · 2 comments
bd-fauna commented
When install torch-cluster using the command
python3 -m pip install torch-cluster
I get the following error:
Defaulting to user installation because normal site-packages is not writeable
Collecting torch-cluster
Downloading torch_cluster-1.6.3.tar.gz (54 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 54.5/54.5 KB 3.0 MB/s eta 0:00:00
Preparing metadata (setup.py) ... done
Requirement already satisfied: scipy in /usr/lib/python3/dist-packages (from torch-cluster) (1.8.0)
Building wheels for collected packages: torch-cluster
Building wheel for torch-cluster (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [49 lines of output]
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/__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
copying torch_cluster/sampler.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/rw.py -> 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/typing.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/nearest.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/testing.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
/usr/local/lib/python3.10/dist-packages/torch/utils/cpp_extension.py:425: UserWarning: There are no clang++ 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._sampler_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
clang -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/usr/local/lib/python3.10/dist-packages/torch/include -I/usr/local/lib/python3.10/dist-packages/torch/include/torch/csrc/api/include -I/usr/local/lib/python3.10/dist-packages/torch/include/TH -I/usr/local/lib/python3.10/dist-packages/torch/include/THC -I/usr/include/python3.10 -c csrc/cpu/sampler_cpu.cpp -o build/temp.linux-x86_64-3.10/csrc/cpu/sampler_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=_sampler_cpu -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++17
In file included from csrc/cpu/sampler_cpu.cpp:1:
In file included from csrc/cpu/sampler_cpu.h:3:
In file included from csrc/cpu/../extensions.h:2:
In file included from /usr/local/lib/python3.10/dist-packages/torch/include/torch/csrc/api/include/torch/torch.h:3:
In file included from /usr/local/lib/python3.10/dist-packages/torch/include/torch/csrc/api/include/torch/all.h:16:
In file included from /usr/local/lib/python3.10/dist-packages/torch/include/torch/csrc/api/include/torch/nn.h:3:
In file included from /usr/local/lib/python3.10/dist-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:5:
In file included from /usr/local/lib/python3.10/dist-packages/torch/include/torch/csrc/api/include/torch/utils.h:3:
In file included from /usr/local/lib/python3.10/dist-packages/torch/include/ATen/Parallel.h:153:
/usr/local/lib/python3.10/dist-packages/torch/include/ATen/ParallelOpenMP.h:11:10: fatal error: 'omp.h' file not found
#include <omp.h>
^~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for torch-cluster
Running setup.py clean for torch-cluster
Failed to build torch-cluster
Installing collected packages: torch-cluster
Running setup.py install for torch-cluster ... error
error: subprocess-exited-with-error
× Running setup.py install for torch-cluster did not run successfully.
│ exit code: 1
╰─> [49 lines of output]
running install
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/__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
copying torch_cluster/sampler.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/rw.py -> 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/typing.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/nearest.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/testing.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
/usr/local/lib/python3.10/dist-packages/torch/utils/cpp_extension.py:425: UserWarning: There are no clang++ 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._sampler_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
clang -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/usr/local/lib/python3.10/dist-packages/torch/include -I/usr/local/lib/python3.10/dist-packages/torch/include/torch/csrc/api/include -I/usr/local/lib/python3.10/dist-packages/torch/include/TH -I/usr/local/lib/python3.10/dist-packages/torch/include/THC -I/usr/include/python3.10 -c csrc/cpu/sampler_cpu.cpp -o build/temp.linux-x86_64-3.10/csrc/cpu/sampler_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=_sampler_cpu -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++17
In file included from csrc/cpu/sampler_cpu.cpp:1:
In file included from csrc/cpu/sampler_cpu.h:3:
In file included from csrc/cpu/../extensions.h:2:
In file included from /usr/local/lib/python3.10/dist-packages/torch/include/torch/csrc/api/include/torch/torch.h:3:
In file included from /usr/local/lib/python3.10/dist-packages/torch/include/torch/csrc/api/include/torch/all.h:16:
In file included from /usr/local/lib/python3.10/dist-packages/torch/include/torch/csrc/api/include/torch/nn.h:3:
In file included from /usr/local/lib/python3.10/dist-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:5:
In file included from /usr/local/lib/python3.10/dist-packages/torch/include/torch/csrc/api/include/torch/utils.h:3:
In file included from /usr/local/lib/python3.10/dist-packages/torch/include/ATen/Parallel.h:153:
/usr/local/lib/python3.10/dist-packages/torch/include/ATen/ParallelOpenMP.h:11:10: fatal error: 'omp.h' file not found
#include <omp.h>
^~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> torch-cluster
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
I do have libomp-dev
installed and I can locate omp.h
at
> find /usr -name omp.h
/usr/lib/gcc/x86_64-linux-gnu/11/include/omp.h
/usr/lib/llvm-14/lib/clang/14.0.0/include/omp.h
Any idea what I should do to build the package?
Thanks in advance!
bd-fauna commented
One solution I found to work is to not use pip install torch-cluster
but use one of the wheels, e.g., pip install https://data.pyg.org/whl/torch-2.2.0%2Bcu121/torch_cluster-1.6.3%2Bpt22cu121-cp310-cp310-linux_x86_64.whl
.