Closed zhuqunxi closed 1 year ago
I think the crucial part is:
Your compiler (c++) is not compatible with the compiler Pytorch was
built with for this platform, which is g++ on linux. Please
use g++ to to compile your extension. Alternatively, you may
compile PyTorch from source using c++, and then you can also use
c++ to compile your extension.
Do you have g++ installed on your machine?
If not, please install it and try again.
The error might have also arisen from the following:
The detected CUDA version (11.4) has a minor version mismatch with the version that was used to compile PyTorch (11.3). Most likely this shouldn't be a problem.
Please also report the OS you are using + OS version.
If you have g++ installed, but it is not the default, you can do the following before installing:
export CXX=g++
For more details, see https://github.com/NVIDIA/apex/issues/974
Please comment whether this has resolved your issue.
I cannot install the package via ‘pip install difflogic’.
WARNING: Ignoring invalid distribution -rllib3 (/share/apps/anaconda3/lib/python3.8/site-packages) WARNING: Ignoring invalid distribution -ix (/share/apps/anaconda3/lib/python3.8/site-packages) WARNING: Ignoring invalid distribution -hreadpoolctl (/share/apps/anaconda3/lib/python3.8/site-packages) WARNING: Ignoring invalid distribution -ensorflow (/share/apps/anaconda3/lib/python3.8/site-packages) WARNING: Ignoring invalid distribution -cipy (/share/apps/anaconda3/lib/python3.8/site-packages) WARNING: Ignoring invalid distribution -rllib3 (/share/apps/anaconda3/lib/python3.8/site-packages) WARNING: Ignoring invalid distribution -ix (/share/apps/anaconda3/lib/python3.8/site-packages) WARNING: Ignoring invalid distribution -hreadpoolctl (/share/apps/anaconda3/lib/python3.8/site-packages) WARNING: Ignoring invalid distribution -ensorflow (/share/apps/anaconda3/lib/python3.8/site-packages) WARNING: Ignoring invalid distribution -cipy (/share/apps/anaconda3/lib/python3.8/site-packages) Collecting difflogic Downloading difflogic-0.1.0.tar.gz (21 kB) Requirement already satisfied: torch>=1.6.0 in /share/apps/anaconda3/lib/python3.8/site-packages (from difflogic) (1.10.1+cu113) Requirement already satisfied: numpy in /share/apps/anaconda3/lib/python3.8/site-packages (from difflogic) (1.22.4) Requirement already satisfied: typing-extensions in /share/apps/anaconda3/lib/python3.8/site-packages (from torch>=1.6.0->difflogic) (4.4.0) Building wheels for collected packages: difflogic Building wheel for difflogic (setup.py) ... error ERROR: Command errored out with exit status 1: command: /share/apps/anaconda3/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-2kdyj6yz/difflogic_5e93d0b6e91c4072903ae9977bcff83b/setup.py'"'"'; file='"'"'/tmp/pip-install-2kdyj6yz/difflogic_5e93d0b6e91c4072903ae9977bcff83b/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-3v72d69e cwd: /tmp/pip-install-2kdyj6yz/difflogic_5e93d0b6e91c4072903ae9977bcff83b/ Complete output (106 lines): running bdist_wheel running build running build_py creating build creating build/lib.linux-x86_64-3.8 creating build/lib.linux-x86_64-3.8/difflogic copying difflogic/difflogic.py -> build/lib.linux-x86_64-3.8/difflogic copying difflogic/compiled_model.py -> build/lib.linux-x86_64-3.8/difflogic copying difflogic/init.py -> build/lib.linux-x86_64-3.8/difflogic copying difflogic/functional.py -> build/lib.linux-x86_64-3.8/difflogic copying difflogic/packbitstensor.py -> build/lib.linux-x86_64-3.8/difflogic running build_ext /share/apps/anaconda3/lib/python3.8/site-packages/torch/utils/cpp_extension.py:782: UserWarning: The detected CUDA version (11.4) has a minor version mismatch with the version that was used to compile PyTorch (11.3). Most likely this shouldn't be a problem. warnings.warn(CUDA_MISMATCH_WARN.format(cuda_str_version, torch.version.cuda)) building 'difflogic_cuda' extension creating /tmp/pip-install-2kdyj6yz/difflogic_5e93d0b6e91c4072903ae9977bcff83b/build/temp.linux-x86_64-3.8 creating /tmp/pip-install-2kdyj6yz/difflogic_5e93d0b6e91c4072903ae9977bcff83b/build/temp.linux-x86_64-3.8/difflogic creating /tmp/pip-install-2kdyj6yz/difflogic_5e93d0b6e91c4072903ae9977bcff83b/build/temp.linux-x86_64-3.8/difflogic/cuda /share/apps/anaconda3/lib/python3.8/site-packages/torch/utils/cpp_extension.py:295: UserWarning:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Your compiler (c++) is not compatible with the compiler Pytorch was built with for this platform, which is g++ on linux. Please use g++ to to compile your extension. Alternatively, you may compile PyTorch from source using c++, and then you can also use c++ to compile your extension.
See https://github.com/pytorch/pytorch/blob/master/CONTRIBUTING.md for help with compiling PyTorch from source. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Emitting ninja build file /tmp/pip-install-2kdyj6yz/difflogic_5e93d0b6e91c4072903ae9977bcff83b/build/temp.linux-x86_64-3.8/build.ninja... Compiling objects... Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N) [1/2] /share/apps/cuda-11.4/bin/nvcc -I/share/apps/anaconda3/lib/python3.8/site-packages/torch/include -I/share/apps/anaconda3/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/share/apps/anaconda3/lib/python3.8/site-packages/torch/include/TH -I/share/apps/anaconda3/lib/python3.8/site-packages/torch/include/THC -I/share/apps/cuda-11.4/include -I/share/apps/anaconda3/include/python3.8 -c -c /tmp/pip-install-2kdyj6yz/difflogic_5e93d0b6e91c4072903ae9977bcff83b/difflogic/cuda/difflogic_kernel.cu -o /tmp/pip-install-2kdyj6yz/difflogic_5e93d0b6e91c4072903ae9977bcff83b/build/temp.linux-x86_64-3.8/difflogic/cuda/difflogic_kernel.o -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_BFLOAT16_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -lineinfo -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=difflogic_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_75,code=compute_75 -gencode=arch=compute_75,code=sm_75 -std=c++14 FAILED: /tmp/pip-install-2kdyj6yz/difflogic_5e93d0b6e91c4072903ae9977bcff83b/build/temp.linux-x86_64-3.8/difflogic/cuda/difflogic_kernel.o /share/apps/cuda-11.4/bin/nvcc -I/share/apps/anaconda3/lib/python3.8/site-packages/torch/include -I/share/apps/anaconda3/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/share/apps/anaconda3/lib/python3.8/site-packages/torch/include/TH -I/share/apps/anaconda3/lib/python3.8/site-packages/torch/include/THC -I/share/apps/cuda-11.4/include -I/share/apps/anaconda3/include/python3.8 -c -c /tmp/pip-install-2kdyj6yz/difflogic_5e93d0b6e91c4072903ae9977bcff83b/difflogic/cuda/difflogic_kernel.cu -o /tmp/pip-install-2kdyj6yz/difflogic_5e93d0b6e91c4072903ae9977bcff83b/build/temp.linux-x86_64-3.8/difflogic/cuda/difflogic_kernel.o -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_BFLOAT16_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -lineinfo -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=difflogic_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_75,code=compute_75 -gencode=arch=compute_75,code=sm_75 -std=c++14 gcc: fatal error: cannot execute 'cc1plus': execvp: No such file or directory compilation terminated. nvcc fatal : Failed to preprocess host compiler properties. [2/2] c++ -MMD -MF /tmp/pip-install-2kdyj6yz/difflogic_5e93d0b6e91c4072903ae9977bcff83b/build/temp.linux-x86_64-3.8/difflogic/cuda/difflogic.o.d -pthread -B /share/apps/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/share/apps/anaconda3/lib/python3.8/site-packages/torch/include -I/share/apps/anaconda3/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/share/apps/anaconda3/lib/python3.8/site-packages/torch/include/TH -I/share/apps/anaconda3/lib/python3.8/site-packages/torch/include/THC -I/share/apps/cuda-11.4/include -I/share/apps/anaconda3/include/python3.8 -c -c /tmp/pip-install-2kdyj6yz/difflogic_5e93d0b6e91c4072903ae9977bcff83b/difflogic/cuda/difflogic.cpp -o /tmp/pip-install-2kdyj6yz/difflogic_5e93d0b6e91c4072903ae9977bcff83b/build/temp.linux-x86_64-3.8/difflogic/cuda/difflogic.o -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=difflogic_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14 cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ ninja: build stopped: subcommand failed. Traceback (most recent call last): File "/share/apps/anaconda3/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1717, in _run_ninja_build subprocess.run( File "/share/apps/anaconda3/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 "", line 1, in
File "/tmp/pip-install-2kdyj6yz/difflogic_5e93d0b6e91c4072903ae9977bcff83b/setup.py", line 7, in
setup(
File "/share/apps/anaconda3/lib/python3.8/site-packages/setuptools/init.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/share/apps/anaconda3/lib/python3.8/distutils/core.py", line 148, in setup
dist.run_commands()
File "/share/apps/anaconda3/lib/python3.8/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/share/apps/anaconda3/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/share/apps/anaconda3/lib/python3.8/site-packages/wheel/bdist_wheel.py", line 299, in run
self.run_command('build')
File "/share/apps/anaconda3/lib/python3.8/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/share/apps/anaconda3/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/share/apps/anaconda3/lib/python3.8/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/share/apps/anaconda3/lib/python3.8/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/share/apps/anaconda3/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/share/apps/anaconda3/lib/python3.8/site-packages/setuptools/command/build_ext.py", line 79, in run
_build_ext.run(self)
File "/share/apps/anaconda3/lib/python3.8/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run
_build_ext.build_ext.run(self)
File "/share/apps/anaconda3/lib/python3.8/distutils/command/build_ext.py", line 340, in run
self.build_extensions()
File "/share/apps/anaconda3/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 735, in build_extensions
build_ext.build_extensions(self)
File "/share/apps/anaconda3/lib/python3.8/site-packages/Cython/Distutils/old_build_ext.py", line 195, in build_extensions
_build_ext.build_ext.build_extensions(self)
File "/share/apps/anaconda3/lib/python3.8/distutils/command/build_ext.py", line 449, in build_extensions
self._build_extensions_serial()
File "/share/apps/anaconda3/lib/python3.8/distutils/command/build_ext.py", line 474, in _build_extensions_serial
self.build_extension(ext)
File "/share/apps/anaconda3/lib/python3.8/site-packages/setuptools/command/build_ext.py", line 202, in build_extension
_build_ext.build_extension(self, ext)
File "/share/apps/anaconda3/lib/python3.8/distutils/command/build_ext.py", line 528, in build_extension
objects = self.compiler.compile(sources,
File "/share/apps/anaconda3/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 556, in unix_wrap_ninja_compile
_write_ninja_file_and_compile_objects(
File "/share/apps/anaconda3/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1399, in _write_ninja_file_and_compile_objects
_run_ninja_build(
File "/share/apps/anaconda3/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
ERROR: Failed building wheel for difflogic Running setup.py clean for difflogic Failed to build difflogic WARNING: Ignoring invalid distribution -rllib3 (/share/apps/anaconda3/lib/python3.8/site-packages) WARNING: Ignoring invalid distribution -ix (/share/apps/anaconda3/lib/python3.8/site-packages) WARNING: Ignoring invalid distribution -hreadpoolctl (/share/apps/anaconda3/lib/python3.8/site-packages) WARNING: Ignoring invalid distribution -ensorflow (/share/apps/anaconda3/lib/python3.8/site-packages) WARNING: Ignoring invalid distribution -cipy (/share/apps/anaconda3/lib/python3.8/site-packages) Installing collected packages: difflogic Running setup.py install for difflogic ... error ERROR: Command errored out with exit status 1: command: /share/apps/anaconda3/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-2kdyj6yz/difflogic_5e93d0b6e91c4072903ae9977bcff83b/setup.py'"'"'; file='"'"'/tmp/pip-install-2kdyj6yz/difflogic_5e93d0b6e91c4072903ae9977bcff83b/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'"'"'))' install --record /tmp/pip-record-644wjaxj/install-record.txt --single-version-externally-managed --compile --install-headers /share/apps/anaconda3/include/python3.8/difflogic cwd: /tmp/pip-install-2kdyj6yz/difflogic_5e93d0b6e91c4072903ae9977bcff83b/ Complete output (108 lines): running install running build running build_py creating build creating build/lib.linux-x86_64-3.8 creating build/lib.linux-x86_64-3.8/difflogic copying difflogic/difflogic.py -> build/lib.linux-x86_64-3.8/difflogic copying difflogic/compiled_model.py -> build/lib.linux-x86_64-3.8/difflogic copying difflogic/init.py -> build/lib.linux-x86_64-3.8/difflogic copying difflogic/functional.py -> build/lib.linux-x86_64-3.8/difflogic copying difflogic/packbitstensor.py -> build/lib.linux-x86_64-3.8/difflogic running build_ext /share/apps/anaconda3/lib/python3.8/site-packages/torch/utils/cpp_extension.py:782: UserWarning: The detected CUDA version (11.4) has a minor version mismatch with the version that was used to compile PyTorch (11.3). Most likely this shouldn't be a problem. warnings.warn(CUDA_MISMATCH_WARN.format(cuda_str_version, torch.version.cuda)) building 'difflogic_cuda' extension creating /tmp/pip-install-2kdyj6yz/difflogic_5e93d0b6e91c4072903ae9977bcff83b/build/temp.linux-x86_64-3.8 creating /tmp/pip-install-2kdyj6yz/difflogic_5e93d0b6e91c4072903ae9977bcff83b/build/temp.linux-x86_64-3.8/difflogic creating /tmp/pip-install-2kdyj6yz/difflogic_5e93d0b6e91c4072903ae9977bcff83b/build/temp.linux-x86_64-3.8/difflogic/cuda /share/apps/anaconda3/lib/python3.8/site-packages/torch/utils/cpp_extension.py:295: UserWarning:
ERROR: Command errored out with exit status 1: /share/apps/anaconda3/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-2kdyj6yz/difflogic_5e93d0b6e91c4072903ae9977bcff83b/setup.py'"'"'; file='"'"'/tmp/pip-install-2kdyj6yz/difflogic_5e93d0b6e91c4072903ae9977bcff83b/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'"'"'))' install --record /tmp/pip-record-644wjaxj/install-record.txt --single-version-externally-managed --compile --install-headers /share/apps/anaconda3/include/python3.8/difflogic Check the logs for full command output. WARNING: Ignoring invalid distribution -rllib3 (/share/apps/anaconda3/lib/python3.8/site-packages) WARNING: Ignoring invalid distribution -ix (/share/apps/anaconda3/lib/python3.8/site-packages) WARNING: Ignoring invalid distribution -hreadpoolctl (/share/apps/anaconda3/lib/python3.8/site-packages) WARNING: Ignoring invalid distribution -ensorflow (/share/apps/anaconda3/lib/python3.8/site-packages) WARNING: Ignoring invalid distribution -cipy (/share/apps/anaconda3/lib/python3.8/site-packages) WARNING: Ignoring invalid distribution -rllib3 (/share/apps/anaconda3/lib/python3.8/site-packages) WARNING: Ignoring invalid distribution -ix (/share/apps/anaconda3/lib/python3.8/site-packages) WARNING: Ignoring invalid distribution -hreadpoolctl (/share/apps/anaconda3/lib/python3.8/site-packages) WARNING: Ignoring invalid distribution -ensorflow (/share/apps/anaconda3/lib/python3.8/site-packages) WARNING: Ignoring invalid distribution -cipy (/share/apps/anaconda3/lib/python3.8/site-packages) WARNING: Ignoring invalid distribution -rllib3 (/share/apps/anaconda3/lib/python3.8/site-packages) WARNING: Ignoring invalid distribution -ix (/share/apps/anaconda3/lib/python3.8/site-packages) WARNING: Ignoring invalid distribution -hreadpoolctl (/share/apps/anaconda3/lib/python3.8/site-packages) WARNING: Ignoring invalid distribution -ensorflow (/share/apps/anaconda3/lib/python3.8/site-packages) WARNING: Ignoring invalid distribution -cipy (/share/apps/anaconda3/lib/python3.8/site-packages)