alexandrosstergiou / SoftPool

[ICCV 2021] Code for approximated exponential maximum pooling

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question for installation

kimo20200 opened this issue · comments

Hi Alex,

I just got a problem for installation. The error is: 'RuntimeError: Error compiling objects for extension'. I am using pytorch 1,7 and cuda 10.1. I do not know if it is related to my Pytorch or CUDA version. Do you have any advice?

Best wishes,
Qing

Hi Qing,

Can you post the entire error message? It would be more helpful for debugging.

Best,
Alex

Hi Alex,

Sorry for that, I will attach my error message below. And I used Anaconda. I do not know if it is fine.

Best wishes,
Qing

Error message:

Microsoft Windows [Version 10.0.18363.1316]
(c) 2019 Microsoft Corporation. All rights reserved.

C:\Users\Manticket>cd SoftPool/pytorch

C:\Users\Manticket\SoftPool\pytorch>set CUDA_HOME=/usr/local/cuda

C:\Users\Manticket\SoftPool\pytorch>python setup.py install
running install
running bdist_egg
running egg_info
writing SoftPool.egg-info\PKG-INFO
writing dependency_links to SoftPool.egg-info\dependency_links.txt
writing top-level names to SoftPool.egg-info\top_level.txt
reading manifest file 'SoftPool.egg-info\SOURCES.txt'
writing manifest file 'SoftPool.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
D:\DL\lib\site-packages\torch\utils\cpp_extension.py:287: UserWarning: Error checking compiler version for cl: [WinError 2] The system cannot find the file specified
warnings.warn('Error checking compiler version for {}: {}'.format(compiler, error))
building 'softpool_cuda' extension
Emitting ninja build file C:\Users\Manticket\SoftPool\pytorch\build\temp.win-amd64-3.8\Release\build.ninja...
Compiling objects...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
[1/2] /usr/local/cuda\bin\nvcc --use-local-env -Xcompiler /MD -Xcompiler /wd4819 -Xcompiler /wd4251 -Xcompiler /wd4244 -Xcompiler /wd4267 -Xcompiler /wd4275 -Xcompiler /wd4018 -Xcompiler /wd4190 -Xcompiler /EHsc -Xcudafe --diag_suppress=base_class_has_different_dll_interface -Xcudafe --diag_suppress=field_without_dll_interface -Xcudafe --diag_suppress=dll_interface_conflict_none_assumed -Xcudafe --diag_suppress=dll_interface_conflict_dllexport_assumed -ID:\DL\lib\site-packages\torch\include -ID:\DL\lib\site-packages\torch\include\torch\csrc\api\include -ID:\DL\lib\site-packages\torch\include\TH -ID:\DL\lib\site-packages\torch\include\THC -I/usr/local/cuda\include -ID:\DL\include -ID:\DL\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" -c C:\Users\Manticket\SoftPool\pytorch\CUDA\softpool_cuda_kernel.cu -o C:\Users\Manticket\SoftPool\pytorch\build\temp.win-amd64-3.8\Release\CUDA/softpool_cuda_kernel.obj -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=softpool_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_75,code=sm_75
FAILED: C:/Users/Manticket/SoftPool/pytorch/build/temp.win-amd64-3.8/Release/CUDA/softpool_cuda_kernel.obj
/usr/local/cuda\bin\nvcc --use-local-env -Xcompiler /MD -Xcompiler /wd4819 -Xcompiler /wd4251 -Xcompiler /wd4244 -Xcompiler /wd4267 -Xcompiler /wd4275 -Xcompiler /wd4018 -Xcompiler /wd4190 -Xcompiler /EHsc -Xcudafe --diag_suppress=base_class_has_different_dll_interface -Xcudafe --diag_suppress=field_without_dll_interface -Xcudafe --diag_suppress=dll_interface_conflict_none_assumed -Xcudafe --diag_suppress=dll_interface_conflict_dllexport_assumed -ID:\DL\lib\site-packages\torch\include -ID:\DL\lib\site-packages\torch\include\torch\csrc\api\include -ID:\DL\lib\site-packages\torch\include\TH -ID:\DL\lib\site-packages\torch\include\THC -I/usr/local/cuda\include -ID:\DL\include -ID:\DL\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" -c C:\Users\Manticket\SoftPool\pytorch\CUDA\softpool_cuda_kernel.cu -o C:\Users\Manticket\SoftPool\pytorch\build\temp.win-amd64-3.8\Release\CUDA/softpool_cuda_kernel.obj -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=softpool_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_75,code=sm_75
CreateProcess failed: The system cannot find the file specified.
ninja: fatal: ReadFile: The handle is invalid.

Traceback (most recent call last):
File "D:\DL\lib\site-packages\torch\utils\cpp_extension.py", line 1533, in _run_ninja_build
subprocess.run(
File "D:\DL\lib\subprocess.py", line 512, 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 4, in
setup(
File "D:\DL\lib\site-packages\setuptools_init_.py", line 163, in setup
return distutils.core.setup(**attrs)
File "D:\DL\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "D:\DL\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "D:\DL\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "D:\DL\lib\site-packages\setuptools\command\install.py", line 67, in run
self.do_egg_install()
File "D:\DL\lib\site-packages\setuptools\command\install.py", line 109, in do_egg_install
self.run_command('bdist_egg')
File "D:\DL\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "D:\DL\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "D:\DL\lib\site-packages\setuptools\command\bdist_egg.py", line 175, in run
cmd = self.call_command('install_lib', warn_dir=0)
File "D:\DL\lib\site-packages\setuptools\command\bdist_egg.py", line 161, in call_command
self.run_command(cmdname)
File "D:\DL\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "D:\DL\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "D:\DL\lib\site-packages\setuptools\command\install_lib.py", line 11, in run
self.build()
File "D:\DL\lib\distutils\command\install_lib.py", line 107, in build
self.run_command('build_ext')
File "D:\DL\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "D:\DL\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "D:\DL\lib\site-packages\setuptools\command\build_ext.py", line 87, in run
_build_ext.run(self)
File "D:\DL\lib\distutils\command\build_ext.py", line 340, in run
self.build_extensions()
File "D:\DL\lib\site-packages\torch\utils\cpp_extension.py", line 670, in build_extensions
build_ext.build_extensions(self)
File "D:\DL\lib\distutils\command\build_ext.py", line 449, in build_extensions
self._build_extensions_serial()
File "D:\DL\lib\distutils\command\build_ext.py", line 474, in _build_extensions_serial
self.build_extension(ext)
File "D:\DL\lib\site-packages\setuptools\command\build_ext.py", line 208, in build_extension
_build_ext.build_extension(self, ext)
File "D:\DL\lib\distutils\command\build_ext.py", line 528, in build_extension
objects = self.compiler.compile(sources,
File "D:\DL\lib\site-packages\torch\utils\cpp_extension.py", line 643, in win_wrap_ninja_compile
_write_ninja_file_and_compile_objects(
File "D:\DL\lib\site-packages\torch\utils\cpp_extension.py", line 1250, in _write_ninja_file_and_compile_objects
_run_ninja_build(
File "D:\DL\lib\site-packages\torch\utils\cpp_extension.py", line 1555, in _run_ninja_build
raise RuntimeError(message) from e
RuntimeError: Error compiling objects for extension

Hi Qing,

From this line: D:\DL\lib\site-packages\torch\utils\cpp_extension.py:287: UserWarning: Error checking compiler version for cl: [WinError 2] The system cannot find the file specified. I am assuming that the problem is with the compiler cl not being found by torch for cpp_extension. Since I have not tested the install for Windows I can only suggest a couple of things:

  • Check your CUDA/cuDNN/PyTorch installations and versions.
  • Use a different Visual Studio version as suggested here
  • The installation fails somewhere here lines 294-297 in cpp_extension.py so you could debug it and see which of the four lines fails (the filepath based on the error is "D:\DL\lib\site-packages\torch\utils\cpp_extension.py")

Hope that any of the above helps!

Best,
Alex

Hi Alex,

Thank you for your answer. I will try by myself.

Best wishes,
Qing

Will close this for now, but feel free to re-open it if the issue re-occurs.

Best,
Alex