mmcv icon indicating copy to clipboard operation
mmcv copied to clipboard

An error occurred while compiling and installing mmcv-full 1.7.1, RuntimeError: Error compiling objects for extension

Open Markson-Young opened this issue 2 years ago • 4 comments

Prerequisite

  • [X] I have searched Issues and Discussions but cannot get the expected help.
  • [X] The bug has not been fixed in the latest version(https://github.com/open-mmlab/mmcv).

Environment

{'sys.platform': 'win32', 'Python': '3.8.16 (default, Jan 17 2023, 22:25:28) [MSC v.1916 64 bit (AMD64)]', 'CUDA available': True, 'GPU 0': 'NVIDIA GeForce GTX 1660 Ti', 'CUDA_HOME': 'D:\Python\CUDA\cuda Development', 'NVCC': 'Cuda compilation tools, release 11.1, V11.1.74', 'PyTorch': '1.9.0+cu111', 'TorchVision': '0.10.0', 'OpenCV': '4.7.0', 'MMCV': '1.7.1', 'MMCV Compiler': 'n/a', 'MMCV CUDA Compiler': 'n/a'}

Reproduces the problem - code sample

Follow the official installation mmcv-full documentation(https://mmcv.readthedocs.io/en/latest/get_started/build.html#common-steps). While using python setup.py build_ext.

Reproduces the problem - command or script

python setup.py build_ext

Reproduces the problem - error message

File "D:\Python\Anaconda\anaconda3\envs\mmlab\lib\site-packages\torch\utils\cpp_extension.py", line 1682, in _run_ninja_build raise RuntimeError(message) from e RuntimeError: Error compiling objects for extension

Additional information

No response

Markson-Young avatar Feb 19 '23 07:02 Markson-Young

Hi, the error message provided is not enough to find out the failure reason. BTW, you can install it with the pre-built packages by the following commands.

pip install -U openmim
mim install mmcv-full

zhouzaida avatar Feb 19 '23 15:02 zhouzaida

Hi, the error message provided is not enough to find out the failure reason. BTW, you can install it with the pre-built packages by the following commands.

pip install -U openmim
mim install mmcv-full

Thank you for your reply. I have tried the method you provided. I also tried using pip install mmcv-full==1.6.2 -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9/index.html to install mmcv-full which fits my environment. But while I follow the Official Tutorials to compile mmcv-full with using This command python setup.py build_ext in Anaconda powershell prompt. image It still raise error: Traceback (most recent call last): File "setup.py", line 520, in setup( File "D:\Python\Anaconda\Anaconda3\envs\mmlab\lib\site-packages\setuptools_init_.py", line 108, in setup return distutils.core.setup(**attrs) File "D:\Python\Anaconda\Anaconda3\envs\mmlab\lib\site-packages\setuptools_distutils\core.py", line 185, in setup return run_commands(dist) File "D:\Python\Anaconda\Anaconda3\envs\mmlab\lib\site-packages\setuptools_distutils\core.py", line 201, in run_commands dist.run_commands() File "D:\Python\Anaconda\Anaconda3\envs\mmlab\lib\site-packages\setuptools_distutils\dist.py", line 969, in run_commands self.run_command(cmd) File "D:\Python\Anaconda\Anaconda3\envs\mmlab\lib\site-packages\setuptools\dist.py", line 1221, in run_command super().run_command(command) File "D:\Python\Anaconda\Anaconda3\envs\mmlab\lib\site-packages\setuptools_distutils\dist.py", line 988, in run_command cmd_obj.run() File "D:\Python\Anaconda\Anaconda3\envs\mmlab\lib\site-packages\setuptools\command\build_ext.py", line 84, in run _build_ext.run(self) File "D:\Python\Anaconda\Anaconda3\envs\mmlab\lib\site-packages\Cython\Distutils\old_build_ext.py", line 186, in run _build_ext.build_ext.run(self) File "D:\Python\Anaconda\Anaconda3\envs\mmlab\lib\site-packages\setuptools_distutils\command\build_ext.py", line 345, in run self.build_extensions() File "D:\Python\Anaconda\Anaconda3\envs\mmlab\lib\site-packages\torch\utils\cpp_extension.py", line 709, in build_extensions build_ext.build_extensions(self) File "D:\Python\Anaconda\Anaconda3\envs\mmlab\lib\site-packages\Cython\Distutils\old_build_ext.py", line 195, in build_extensions _build_ext.build_ext.build_extensions(self) File "D:\Python\Anaconda\Anaconda3\envs\mmlab\lib\site-packages\setuptools_distutils\command\build_ext.py", line 467, in build_extensions self._build_extensions_serial() File "D:\Python\Anaconda\Anaconda3\envs\mmlab\lib\site-packages\setuptools_distutils\command\build_ext.py", line 493, in _build_extensions_serial self.build_extension(ext) File "D:\Python\Anaconda\Anaconda3\envs\mmlab\lib\site-packages\setuptools\command\build_ext.py", line 246, in build_extension _build_ext.build_extension(self, ext) File "D:\Python\Anaconda\Anaconda3\envs\mmlab\lib\site-packages\setuptools_distutils\command\build_ext.py", line 548, in build_extension objects = self.compiler.compile( File "D:\Python\Anaconda\Anaconda3\envs\mmlab\lib\site-packages\torch\utils\cpp_extension.py", line 682, in win_wrap_ninja_compile _write_ninja_file_and_compile_objects( File "D:\Python\Anaconda\Anaconda3\envs\mmlab\lib\site-packages\torch\utils\cpp_extension.py", line 1355, in _write_ninja_file_and_compile_objects _run_ninja_build( File "D:\Python\Anaconda\Anaconda3\envs\mmlab\lib\site-packages\torch\utils\cpp_extension.py", line 1682, in _run_ninja_build raise RuntimeError(message) from e RuntimeError: Error compiling objects for extension

Anyway, when I using python .dev_scripts/check_installation.py to validate installation, it work! Here is the output: TorchVision: 0.10.0 OpenCV: 4.7.0 MMCV: 1.6.2 MMCV Compiler: MSVC 192930137 MMCV CUDA Compiler: 11.1

However, this file _ext.cp38-win_amd64.pyd is not in the mmcv folder. I knew it had failed to compile. image

I hope you can help me solve this problem!

Markson-Young avatar Feb 20 '23 13:02 Markson-Young

Could you provide the output of pip show mmcv-full?

zhouzaida avatar Feb 27 '23 03:02 zhouzaida

Hi, the error message provided is not enough to find out the failure reason. BTW, you can install it with the pre-built packages by the following commands.

pip install -U openmim
mim install mmcv-full

OH, MY, GOOOOOOOOOOOOOOD!!! how do you know this command?i mean, i have checked the mmcv doc and follow it, but still failed, but these two command...success!!Although i install both mmcv 2.0.0 and mmcv-full 1.7.1, a liitle wierd but anyway the code runs. YOU ARE SUCH A GENIUS!!

1311894932 avatar Nov 14 '23 10:11 1311894932