Pytorch-Correlation-extension icon indicating copy to clipboard operation
Pytorch-Correlation-extension copied to clipboard

python setup.py install failed

Open swrdZWJ opened this issue 1 year ago • 4 comments

torch = 1.10 cuda = 11.3 gcc = 9.5.0

running install /home/anaconda3/envs/py38torch110/lib/python3.8/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. warnings.warn( /home/anaconda3/envs/py38torch110/lib/python3.8/site-packages/setuptools/command/easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools. warnings.warn( running bdist_egg running egg_info writing Correlation_Module/spatial_correlation_sampler.egg-info/PKG-INFO writing dependency_links to Correlation_Module/spatial_correlation_sampler.egg-info/dependency_links.txt writing requirements to Correlation_Module/spatial_correlation_sampler.egg-info/requires.txt writing top-level names to Correlation_Module/spatial_correlation_sampler.egg-info/top_level.txt reading manifest file 'Correlation_Module/spatial_correlation_sampler.egg-info/SOURCES.txt' adding license file 'LICENSE' writing manifest file 'Correlation_Module/spatial_correlation_sampler.egg-info/SOURCES.txt' installing library code to build/bdist.linux-x86_64/egg running install_lib running build_py running build_ext building 'spatial_correlation_sampler_backend' extension creating /home/Project_313/Segment-and-Track-Anything-main/Pytorch-Correlation-extension/build/temp.linux-x86_64-cpython-38 creating /home/Project_313/Segment-and-Track-Anything-main/Pytorch-Correlation-extension/build/temp.linux-x86_64-cpython-38/Correlation_Module Emitting ninja build file /home/Project_313/Segment-and-Track-Anything-main/Pytorch-Correlation-extension/build/temp.linux-x86_64-cpython-38/build.ninja... Compiling objects... Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N) [1/3] c++ -MMD -MF /home/Project_313/Segment-and-Track-Anything-main/Pytorch-Correlation-extension/build/temp.linux-x86_64-cpython-38/Correlation_Module/correlation_sampler.o.d -pthread -B /opt/anaconda1anaconda2anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DUSE_CUDA -I/home/anaconda3/envs/py38torch110/lib/python3.8/site-packages/torch/include -I/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/torch/include/TH -I/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/torch/include/THC -I/home/zhuwenjun/anaconda3/envs/py38torch110/include -I/home/zhuwenjun/anaconda3/envs/py38torch110/include/python3.8 -c -c /home/zhuwenjun/Project_313/Segment-and-Track-Anything-main/Pytorch-Correlation-extension/Correlation_Module/correlation_sampler.cpp -o /home/zhuwenjun/Project_313/Segment-and-Track-Anything-main/Pytorch-Correlation-extension/build/temp.linux-x86_64-cpython-38/Correlation_Module/correlation_sampler.o -std=c++17 -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=spatial_correlation_sampler_backend -D_GLIBCXX_USE_CXX11_ABI=0 FAILED: /home/zhuwenjun/Project_313/Segment-and-Track-Anything-main/Pytorch-Correlation-extension/build/temp.linux-x86_64-cpython-38/Correlation_Module/correlation_sampler.o c++ -MMD -MF /home/zhuwenjun/Project_313/Segment-and-Track-Anything-main/Pytorch-Correlation-extension/build/temp.linux-x86_64-cpython-38/Correlation_Module/correlation_sampler.o.d -pthread -B /opt/anaconda1anaconda2anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DUSE_CUDA -I/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/torch/include -I/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/torch/include/TH -I/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/torch/include/THC -I/home/zhuwenjun/anaconda3/envs/py38torch110/include -I/home/zhuwenjun/anaconda3/envs/py38torch110/include/python3.8 -c -c /home/zhuwenjun/Project_313/Segment-and-Track-Anything-main/Pytorch-Correlation-extension/Correlation_Module/correlation_sampler.cpp -o /home/zhuwenjun/Project_313/Segment-and-Track-Anything-main/Pytorch-Correlation-extension/build/temp.linux-x86_64-cpython-38/Correlation_Module/correlation_sampler.o -std=c++17 -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="libstdcpp"' '-DPYBIND11_BUILD_ABI="cxxabi1011"' -DTORCH_EXTENSION_NAME=spatial_correlation_sampler_backend -D_GLIBCXX_USE_CXX11_ABI=0 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ In file included from /home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/torch/include/torch/csrc/python_headers.h:10, from /home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/torch/include/torch/csrc/Device.h:3, from /home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/python.h:8, from /home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/torch/include/torch/extension.h:6, from /home/zhuwenjun/Project_313/Segment-and-Track-Anything-main/Pytorch-Correlation-extension/Correlation_Module/correlation_sampler.cpp:1: /home/zhuwenjun/anaconda3/envs/py38torch110/include/python3.8/Python.h:44:10: fatal error: crypt.h: No such file or directory 44 | #include <crypt.h> | ^~~~~~~~~ compilation terminated. [2/3] c++ -MMD -MF /home/zhuwenjun/Project_313/Segment-and-Track-Anything-main/Pytorch-Correlation-extension/build/temp.linux-x86_64-cpython-38/Correlation_Module/correlation.o.d -pthread -B /opt/anaconda1anaconda2anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DUSE_CUDA -I/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/torch/include -I/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/torch/include/TH -I/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/torch/include/THC -I/home/zhuwenjun/anaconda3/envs/py38torch110/include -I/home/zhuwenjun/anaconda3/envs/py38torch110/include/python3.8 -c -c /home/zhuwenjun/Project_313/Segment-and-Track-Anything-main/Pytorch-Correlation-extension/Correlation_Module/correlation.cpp -o /home/zhuwenjun/Project_313/Segment-and-Track-Anything-main/Pytorch-Correlation-extension/build/temp.linux-x86_64-cpython-38/Correlation_Module/correlation.o -std=c++17 -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="gcc"' '-DPYBIND11_STDLIB="libstdcpp"' '-DPYBIND11_BUILD_ABI="cxxabi1011"' -DTORCH_EXTENSION_NAME=spatial_correlation_sampler_backend -D_GLIBCXX_USE_CXX11_ABI=0 FAILED: /home/zhuwenjun/Project_313/Segment-and-Track-Anything-main/Pytorch-Correlation-extension/build/temp.linux-x86_64-cpython-38/Correlation_Module/correlation.o c++ -MMD -MF /home/zhuwenjun/Project_313/Segment-and-Track-Anything-main/Pytorch-Correlation-extension/build/temp.linux-x86_64-cpython-38/Correlation_Module/correlation.o.d -pthread -B /opt/anaconda1anaconda2anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DUSE_CUDA -I/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/torch/include -I/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/torch/include/TH -I/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/torch/include/THC -I/home/zhuwenjun/anaconda3/envs/py38torch110/include -I/home/zhuwenjun/anaconda3/envs/py38torch110/include/python3.8 -c -c /home/zhuwenjun/Project_313/Segment-and-Track-Anything-main/Pytorch-Correlation-extension/Correlation_Module/correlation.cpp -o /home/zhuwenjun/Project_313/Segment-and-Track-Anything-main/Pytorch-Correlation-extension/build/temp.linux-x86_64-cpython-38/Correlation_Module/correlation.o -std=c++17 -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="gcc"' '-DPYBIND11_STDLIB="libstdcpp"' '-DPYBIND11_BUILD_ABI="cxxabi1011"' -DTORCH_EXTENSION_NAME=spatial_correlation_sampler_backend -D_GLIBCXX_USE_CXX11_ABI=0 cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ In file included from /home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/torch/include/torch/csrc/python_headers.h:10, from /home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/torch/include/torch/csrc/Device.h:3, from /home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/python.h:8, from /home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/torch/include/torch/extension.h:6, from /home/zhuwenjun/Project_313/Segment-and-Track-Anything-main/Pytorch-Correlation-extension/Correlation_Module/correlation.cpp:1: /home/zhuwenjun/anaconda3/envs/py38torch110/include/python3.8/Python.h:44:10: fatal error: crypt.h: No such file or directory 44 | #include <crypt.h> | ^~~~~~~~~ compilation terminated. [3/3] /home/zhuwenjun/anaconda3/envs/py38torch110/bin/nvcc -DUSE_CUDA -I/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/torch/include -I/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/torch/include/TH -I/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/torch/include/THC -I/home/zhuwenjun/anaconda3/envs/py38torch110/include -I/home/zhuwenjun/anaconda3/envs/py38torch110/include/python3.8 -c -c /home/zhuwenjun/Project_313/Segment-and-Track-Anything-main/Pytorch-Correlation-extension/Correlation_Module/correlation_cuda_kernel.cu -o /home/zhuwenjun/Project_313/Segment-and-Track-Anything-main/Pytorch-Correlation-extension/build/temp.linux-x86_64-cpython-38/Correlation_Module/correlation_cuda_kernel.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'"'"'' -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=spatial_correlation_sampler_backend -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_75,code=compute_75 -gencode=arch=compute_75,code=sm_75 -std=c++14 ninja: build stopped: subcommand failed. Traceback (most recent call last): File "/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1717, in _run_ninja_build subprocess.run( File "/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/subprocess.py", line 516, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "setup.py", line 69, in launch_setup() File "setup.py", line 37, in launch_setup setup( File "/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/setuptools/init.py", line 87, in setup return distutils.core.setup(**attrs) File "/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 185, in setup return run_commands(dist) File "/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 201, in run_commands dist.run_commands() File "/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 973, in run_commands self.run_command(cmd) File "/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/setuptools/dist.py", line 1217, in run_command super().run_command(command) File "/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 992, in run_command cmd_obj.run() File "/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/setuptools/command/install.py", line 74, in run self.do_egg_install() File "/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/setuptools/command/install.py", line 123, in do_egg_install self.run_command('bdist_egg') File "/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command self.distribution.run_command(command) File "/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/setuptools/dist.py", line 1217, in run_command super().run_command(command) File "/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 992, in run_command cmd_obj.run() File "/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/setuptools/command/bdist_egg.py", line 165, in run cmd = self.call_command('install_lib', warn_dir=0) File "/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/setuptools/command/bdist_egg.py", line 151, in call_command self.run_command(cmdname) File "/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command self.distribution.run_command(command) File "/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/setuptools/dist.py", line 1217, in run_command super().run_command(command) File "/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 992, in run_command cmd_obj.run() File "/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/setuptools/command/install_lib.py", line 11, in run self.build() File "/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/setuptools/_distutils/command/install_lib.py", line 112, in build self.run_command('build_ext') File "/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command self.distribution.run_command(command) File "/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/setuptools/dist.py", line 1217, in run_command super().run_command(command) File "/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 992, in run_command cmd_obj.run() File "/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/setuptools/command/build_ext.py", line 79, in run _build_ext.run(self) File "/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run _build_ext.build_ext.run(self) File "/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py", line 346, in run self.build_extensions() File "/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 735, in build_extensions build_ext.build_extensions(self) File "/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/Cython/Distutils/old_build_ext.py", line 195, in build_extensions _build_ext.build_ext.build_extensions(self) File "/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py", line 466, in build_extensions self._build_extensions_serial() File "/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py", line 492, in _build_extensions_serial self.build_extension(ext) File "/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/setuptools/command/build_ext.py", line 202, in build_extension _build_ext.build_extension(self, ext) File "/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py", line 547, in build_extension objects = self.compiler.compile( File "/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 556, in unix_wrap_ninja_compile _write_ninja_file_and_compile_objects( File "/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1399, in _write_ninja_file_and_compile_objects _run_ninja_build( File "/home/zhuwenjun/anaconda3/envs/py38torch110/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1733, in _run_ninja_build raise RuntimeError(message) from e RuntimeError: Error compiling objects for extension

swrdZWJ avatar Feb 21 '24 10:02 swrdZWJ

home/zhuwenjun/anaconda3/envs/py38torch110/include/python3.8/Python.h:44:10: fatal error: crypt.h: No such file or directory

Looks like crypt.h is not available on your computer. It's odd, it should be available, it's apparently a very basic file.

You can try to reinstall libcrypt if you are using ubuntu sudo apt install libcrypt-dev

ClementPinard avatar Feb 21 '24 14:02 ClementPinard

Thank you for your prompt reply. In fact, I am using a server(ubuntu22.04, gcc=11.3) that is shared by multiple people. I installed gcc using the “conda install gcc=9.5.0” command in the anaconda environment, and do not have the permission to execute "sudo apt install libcrypt-dev". How should I solve this problem?

swrdZWJ avatar Feb 21 '24 15:02 swrdZWJ

from the log I can see -I/home/zhuwenjun/anaconda3/envs/py38torch110/include -I/home/zhuwenjun/anaconda3/envs/py38torch110/include/python3.8

So you are definitely including headers from anaconda. You can try to install libcrypt directly with anaconda then

https://anaconda.org/conda-forge/libgcrypt

ClementPinard avatar Feb 21 '24 16:02 ClementPinard

Thanks a lot :) I install libcrypt via conda, but the problem is not solved. I finally solve the problem by installing version 7.3 of gcc and g++.

swrdZWJ avatar Feb 22 '24 12:02 swrdZWJ