Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Could not build wheels for mmcv, which is required to install pyproject.toml-based projects #2938

Open
2 tasks done
rbli-john opened this issue Sep 19, 2023 · 43 comments
Assignees

Comments

@rbli-john
Copy link

Prerequisite

Environment

Please see open-mmlab/mmdetection#10873

Reproduces the problem - code sample

Please see open-mmlab/mmdetection#10873 for details.

Reproduces the problem - command or script

Please see open-mmlab/mmdetection#10873 for details.

Reproduces the problem - error message

Traceback (most recent call last):
File "", line 2, in
File "", line 34, in
File "/private/var/folders/dv/wbjrnyb94pv5djk1y4dkb_bc0000gp/T/pip-install-dqtzkf49/mmcv_6a35770b2d544b4d877baaec1726bc41/setup.py", line 437, in
setup(
File "/Users/rongbin/anaconda3/envs/openmmlab/lib/python3.8/site-packages/setuptools/init.py", line 155, in setup
return distutils.core.setup(**attrs)
File "/Users/rongbin/anaconda3/envs/openmmlab/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 148, in setup
return run_commands(dist)
File "/Users/rongbin/anaconda3/envs/openmmlab/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 163, in run_commands
dist.run_commands()
File "/Users/rongbin/anaconda3/envs/openmmlab/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 967, in run_commands
self.run_command(cmd)
File "/Users/rongbin/anaconda3/envs/openmmlab/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
cmd_obj.run()
File "/Users/rongbin/anaconda3/envs/openmmlab/lib/python3.8/site-packages/wheel/bdist_wheel.py", line 325, in run
self.run_command("build")
File "/Users/rongbin/anaconda3/envs/openmmlab/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/Users/rongbin/anaconda3/envs/openmmlab/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
cmd_obj.run()
File "/Users/rongbin/anaconda3/envs/openmmlab/lib/python3.8/site-packages/setuptools/_distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/Users/rongbin/anaconda3/envs/openmmlab/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/Users/rongbin/anaconda3/envs/openmmlab/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
cmd_obj.run()
File "/Users/rongbin/anaconda3/envs/openmmlab/lib/python3.8/site-packages/setuptools/command/build_ext.py", line 79, in run
_build_ext.run(self)
File "/Users/rongbin/anaconda3/envs/openmmlab/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py", line 339, in run
self.build_extensions()
File "/Users/rongbin/anaconda3/envs/openmmlab/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 848, in build_extensions
build_ext.build_extensions(self)
File "/Users/rongbin/anaconda3/envs/openmmlab/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py", line 448, in build_extensions
self._build_extensions_serial()
File "/Users/rongbin/anaconda3/envs/openmmlab/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py", line 473, in _build_extensions_serial
self.build_extension(ext)
File "/Users/rongbin/anaconda3/envs/openmmlab/lib/python3.8/site-packages/setuptools/command/build_ext.py", line 202, in build_extension
_build_ext.build_extension(self, ext)
File "/Users/rongbin/anaconda3/envs/openmmlab/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py", line 528, in build_extension
objects = self.compiler.compile(sources,
File "/Users/rongbin/anaconda3/envs/openmmlab/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 663, in unix_wrap_ninja_compile
_write_ninja_file_and_compile_objects(
File "/Users/rongbin/anaconda3/envs/openmmlab/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1578, in _write_ninja_file_and_compile_objects
_run_ninja_build(
File "/Users/rongbin/anaconda3/envs/openmmlab/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1921, in _run_ninja_build
raise RuntimeError(message) from e
RuntimeError: Error compiling objects for extension
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for mmcv
Running setup.py clean for mmcv
Failed to build mmcv
ERROR: Could not build wheels for mmcv, which is required to install pyproject.toml-based projects

Additional information

No response

@zhouzaida
Copy link
Member

zhouzaida commented Sep 20, 2023

Hi @rbli-john , could you try to install wheel first?

@rbli-john
Copy link
Author

@zhouzaida You mean pip install wheel?

@zhouzaida
Copy link
Member

@zhouzaida You mean pip install wheel?

yes

@tomarvimal
Copy link

i am also facing the same issue. tried installing wheel first but it was already installed so it did not help.

@p0wned17
Copy link

p0wned17 commented Oct 6, 2023

I also have the same error

@fanqiNO1
Copy link
Collaborator

fanqiNO1 commented Oct 7, 2023

This issue may be caused by that the version of pytorch you have is 2.1.0. We will release a pre-compiled mmcv package that supports pytorch 2.1.0 in about a week, until then you can try to solve the problem by lowering your pytorch version to 2.0 or by compiling mmcv from source.

Help documentation for compiling mmcv from source: https://mmcv.readthedocs.io/en/latest/get_started/build.html

@fanqiNO1
Copy link
Collaborator

fanqiNO1 commented Oct 8, 2023

I am also facing the same issue, not able to build from source also and I am using torch version-1.11.0, even then I am facing this issue. This is my nvcc version: nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2022 NVIDIA Corporation Built on Wed_Sep_21_10:33:58_PDT_2022 Cuda compilation tools, release 11.8, V11.8.89 Build cuda_11.8.r11.8/compiler.31833905_0 how to solve this problem.

Can you provide more information? Such as the command or script did you run and the error traceback?

@fanqiNO1
Copy link
Collaborator

fanqiNO1 commented Oct 9, 2023

I am also facing the same issue, not able to build from source also and I am using torch version-1.11.0, even then I am facing this issue. This is my nvcc version: nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2022 NVIDIA Corporation Built on Wed_Sep_21_10:33:58_PDT_2022 Cuda compilation tools, release 11.8, V11.8.89 Build cuda_11.8.r11.8/compiler.31833905_0 how to solve this problem.

Can you provide more information? Such as the command or script did you run and the error traceback?

I am facing the same issue. The command is, as follows:

pip install -U openmim mim install mmengine mim install 'mmcv>=2.0.0rc1'

Also enclosed please kindly find the error message: mmcv_installation _error

I am also facing the same issue, not able to build from source also and I am using torch version-1.11.0, even then I am facing this issue. This is my nvcc version: nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2022 NVIDIA Corporation Built on Wed_Sep_21_10:33:58_PDT_2022 Cuda compilation tools, release 11.8, V11.8.89 Build cuda_11.8.r11.8/compiler.31833905_0 how to solve this problem.

Can you provide more information? Such as the command or script did you run and the error traceback?

I am facing the same issue. The command is, as follows:

pip install -U openmim mim install mmengine mim install 'mmcv>=2.0.0rc1'

Also enclosed please kindly find the error message: mmcv_installation _error

Sorry, I cannot reproduce the error. But you can check the version of gcc.

@whut-zhangwx
Copy link

I encountered this problem too. And I solved it by pip installation regardless of mim. You can refer to their official documentation: customize-installation

@fanqiNO1
Copy link
Collaborator

I am also facing the same issue, not able to build from source also and I am using torch version-1.11.0, even then I am facing this issue. This is my nvcc version: nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2022 NVIDIA Corporation Built on Wed_Sep_21_10:33:58_PDT_2022 Cuda compilation tools, release 11.8, V11.8.89 Build cuda_11.8.r11.8/compiler.31833905_0 how to solve this problem.

You can try to install mmcv from source. https://mmcv.readthedocs.io/en/latest/get_started/build.html#build-mmcv

@shhn1
Copy link

shhn1 commented Oct 11, 2023

I am also facing the same issue, not able to build from source also and I am using torch version-1.11.0, even then I am facing this issue. This is my nvcc version: nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2022 NVIDIA Corporation Built on Wed_Sep_21_10:33:58_PDT_2022 Cuda compilation tools, release 11.8, V11.8.89 Build cuda_11.8.r11.8/compiler.31833905_0 how to solve this problem.

You can try to install mmcv from source. https://mmcv.readthedocs.io/en/latest/get_started/build.html#build-mmcv

I have install mmcv from source, and it does show success. However, when I import mmcv, it throws an error.
Successfully installed oncy
Why does this happen? I desperately want to know how I can solve this problem. Thanks!

@LongboV
Copy link

LongboV commented Oct 11, 2023

I am also facing the same issue, what's happening?
[
屏幕截图 2023-10-11 204607
屏幕截图 2023-10-11 204539

I need help, please!

@chenscottus
Copy link

Same issue here.
When will release a pre-compiled mmcv package that supports pytorch 2.1.0 ?
Thanks!

@LongboV
Copy link

LongboV commented Oct 12, 2023

I am also facing the same issue, what's happening? [ 屏幕截图 2023-10-11 204607 屏幕截图 2023-10-11 204539

I need help, please!

I have solved the problem by lowering the pytorch version. thanks

@changjingzhi
Copy link

This is a version incompatibility issue and you may need to replace your pytorch version

@YonghuiTAN22
Copy link

我也面临同样的问题,请问这是怎么回事?[屏幕截图 2023-10-11 204607 屏幕截图 2023-10-11 204539
我需要帮助,拜托!

我已经通过降低pytorch版本解决了这个问题。谢谢

请问你是降级到哪个pytorch版本解决这个问题的呢

@AnjanaWijesinghe
Copy link

This helped conda install pytorch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 pytorch-cuda=11.7 -c pytorch -c nvidia

@chenscottus
Copy link

I have built successfully with CUDA 12.2 and PyTourch 2.1.0+cu121

https://mmcv.readthedocs.io/en/latest/get_started/build.html

pip3 install -r requirements/optional.txt

pip3 install -e . -v

Validate the installation
python3 .dev_scripts/check_installation.py

sys.platform: win32
Python: 3.11.5 (tags/v3.11.5:cce6ba9, Aug 24 2023, 14:38:34) [MSC v.1936 64 bit (AMD64)]
CUDA available: True
numpy_random_seed: 2147483648
GPU 0: NVIDIA RTX A6000
CUDA_HOME: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.2
NVCC: Cuda compilation tools, release 12.2, V12.2.140
MSVC: Microsoft (R) C/C++ Optimizing Compiler Version 19.37.32825 for x64
GCC: n/a
PyTorch: 2.1.0+cu121
PyTorch compiling details: PyTorch built with:

  • C++ Version: 199711
  • MSVC 192930151
  • Intel(R) Math Kernel Library Version 2020.0.2 Product Build 20200624 for Intel(R) 64 architecture applications
  • Intel(R) MKL-DNN v3.1.1 (Git Hash 64f6bcbcbab628e96f33a62c3e975f8535a7bde4)
  • OpenMP 2019
  • LAPACK is enabled (usually provided by MKL)
  • CPU capability usage: AVX512
  • CUDA Runtime 12.1
  • NVCC architecture flags: -gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_80,code=sm_80;-gencode;arch=compute_86,code=sm_86;-gencode;arch=compute_90,code=sm_90
  • CuDNN 8.8.1 (built against CUDA 12.0)
  • Magma 2.5.4
  • Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=12.1, CUDNN_VERSION=8.8.1, CXX_COMPILER=C:/actions-runner/_work/pytorch/pytorch/builder/windows/tmp_bin/sccache-cl.exe, CXX_FLAGS=/DWIN32 /D_WINDOWS /GR /EHsc /bigobj /FS -DUSE_PTHREADPOOL -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOCUPTI -DLIBKINETO_NOROCTRACER -DUSE_FBGEMM -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE /utf-8 /wd4624 /wd4068 /wd4067 /wd4267 /wd4661 /wd4717 /wd4244 /wd4804 /wd4273, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_DISABLE_GPU_ASSERTS=OFF, TORCH_VERSION=2.1.0, USE_CUDA=ON, USE_CUDNN=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=OFF, USE_NNPACK=OFF, USE_OPENMP=ON, USE_ROCM=OFF,

TorchVision: 0.16.0+cu121
OpenCV: 4.8.1
MMEngine: 0.7.3
MMCV: 2.1.0
MMCV Compiler: MSVC 193732825
MMCV CUDA Compiler: 12.2

@chogerlate
Copy link

This issue may be caused by that the version of pytorch you have is 2.1.0. We will release a pre-compiled mmcv package that supports pytorch 2.1.0 in about a week, until then you can try to solve the problem by lowering your pytorch version to 2.0 or by compiling mmcv from source.

Help documentation for compiling mmcv from source: https://mmcv.readthedocs.io/en/latest/get_started/build.html

This work for me

I attempted to reinstall wheel with pip install wheel, but the error persisted. I then try lowering my Python version to 2.0.0, and it works.
pip install torch==2.0.0 torchvision==0.15.1
Note that I am using mmdetection on Google Colab

@shingszelam
Copy link

I have the same problem. I'm trying to run mit/bevfusion, but when configuring the environment I use
pip install mmcv-full==1.4.0 -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.10.1/index.html
build wheel failed.
My environment configuration is as follows:
CUDA 11.3
Pytorch 1.10.1
gcc/g++ 7
Has anyone encountered the same problem and solved it? urgent need.

@fanqiNO1
Copy link
Collaborator

fanqiNO1 commented Oct 30, 2023

I have the same problem. I'm trying to run mit/bevfusion, but when configuring the environment I use pip install mmcv-full==1.4.0 -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.10.1/index.html build wheel failed. My environment configuration is as follows: CUDA 11.3 Pytorch 1.10.1 gcc/g++ 7 Has anyone encountered the same problem and solved it? urgent need.

It's because we do not provide the pre-complied MMCV package with torch1.10.1 and CUDA 11.3. You can try pip install mmcv-full==1.4.0 -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.10/index.html

@shingszelam
Copy link

I have the same problem. I'm trying to run mit/bevfusion, but when configuring the environment I use pip install mmcv-full==1.4.0 -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.10.1/index.html build wheel failed. My environment configuration is as follows: CUDA 11.3 Pytorch 1.10.1 gcc/g++ 7 Has anyone encountered the same problem and solved it? urgent need.

It's because we do not provide the pre-complied MMCV package with torch1.10.1 and CUDA 11.3. You can try pip install mmcv-full==1.4.0 -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.10/index.html

Thank you for your reply. After waiting for a long time, it built successfully.

@klinsc
Copy link

klinsc commented Nov 15, 2023

This issue may be caused by that the version of pytorch you have is 2.1.0. We will release a pre-compiled mmcv package that supports pytorch 2.1.0 in about a week, until then you can try to solve the problem by lowering your pytorch version to 2.0 or by compiling mmcv from source.
Help documentation for compiling mmcv from source: https://mmcv.readthedocs.io/en/latest/get_started/build.html

This work for me

I attempted to reinstall wheel with pip install wheel, but the error persisted. I then try lowering my Python version to 2.0.0, and it works. pip install torch==2.0.0 torchvision==0.15.1 Note that I am using mmdetection on Google Colab

He means lowering the Pytorch. The word made me confused at first glance 😅

@russell0430
Copy link

Same issue with pytorch@1.12 and pytorch@1.13. I solved this problem several weeks ago, but now just forget what i did

@PRCbubu
Copy link

PRCbubu commented Dec 23, 2023

image
Can anyone please help me here?

for me, wheel could not build wheels for lm-eval, which is required to install pyproject.toml-based projects

@Awfa111
Copy link

Awfa111 commented Jan 2, 2024

I have the same problem. I'm trying to run mit/bevfusion, but when configuring the environment I use pip install mmcv-full==1.4.0 -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.10.1/index.html build wheel failed. My environment configuration is as follows: CUDA 11.3 Pytorch 1.10.1 gcc/g++ 7 Has anyone encountered the same problem and solved it? urgent need.

It's because we do not provide the pre-complied MMCV package with torch1.10.1 and CUDA 11.3. You can try pip install mmcv-full==1.4.0 -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.10/index.html

Thanks, that really helpful, its work finally.

@galaltche
Copy link

I have the same problem. I'm trying to run mit/bevfusion, but when configuring the environment I use pip install mmcv-full==1.4.0 -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.10.1/index.html build wheel failed. My environment configuration is as follows: CUDA 11.3 Pytorch 1.10.1 gcc/g++ 7 Has anyone encountered the same problem and solved it? urgent need.

It's because we do not provide the pre-complied MMCV package with torch1.10.1 and CUDA 11.3. You can try pip install mmcv-full==1.4.0 -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.10/index.html

I have the same issue with insightface package, how can I solve it?

check.warn(importable)
#0 598.1 creating build/lib.linux-x86_64-cpython-39/insightface/data/images
#0 598.1 copying insightface/data/images/Tom_Hanks_54745.png -> build/lib.linux-x86_64-cpython-39/insightface/data/images
#0 598.1 copying insightface/data/images/mask_black.jpg -> build/lib.linux-x86_64-cpython-39/insightface/data/images
#0 598.1 copying insightface/data/images/mask_blue.jpg -> build/lib.linux-x86_64-cpython-39/insightface/data/images
#0 598.1 copying insightface/data/images/mask_green.jpg -> build/lib.linux-x86_64-cpython-39/insightface/data/images
#0 598.1 copying insightface/data/images/mask_white.jpg -> build/lib.linux-x86_64-cpython-39/insightface/data/images
#0 598.1 copying insightface/data/images/t1.jpg -> build/lib.linux-x86_64-cpython-39/insightface/data/images
#0 598.1 creating build/lib.linux-x86_64-cpython-39/insightface/data/objects
#0 598.1 copying insightface/data/objects/meanshape_68.pkl -> build/lib.linux-x86_64-cpython-39/insightface/data/objects
#0 598.1 creating build/lib.linux-x86_64-cpython-39/insightface/thirdparty/face3d/mesh/cython
#0 598.1 copying insightface/thirdparty/face3d/mesh/cython/mesh_core.cpp -> build/lib.linux-x86_64-cpython-39/insightface/thirdparty/face3d/mesh/cython
#0 598.1 copying insightface/thirdparty/face3d/mesh/cython/mesh_core.h -> build/lib.linux-x86_64-cpython-39/insightface/thirdparty/face3d/mesh/cython
#0 598.1 copying insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.c -> build/lib.linux-x86_64-cpython-39/insightface/thirdparty/face3d/mesh/cython
#0 598.1 copying insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.cpp -> build/lib.linux-x86_64-cpython-39/insightface/thirdparty/face3d/mesh/cython
#0 598.1 copying insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.pyx -> build/lib.linux-x86_64-cpython-39/insightface/thirdparty/face3d/mesh/cython
#0 598.1 copying insightface/thirdparty/face3d/mesh/cython/setup.py -> build/lib.linux-x86_64-cpython-39/insightface/thirdparty/face3d/mesh/cython
#0 598.1 running build_ext
#0 598.1 building 'insightface.thirdparty.face3d.mesh.cython.mesh_core_cython' extension
#0 598.1 creating build/temp.linux-x86_64-cpython-39
#0 598.1 creating build/temp.linux-x86_64-cpython-39/insightface
#0 598.1 creating build/temp.linux-x86_64-cpython-39/insightface/thirdparty
#0 598.1 creating build/temp.linux-x86_64-cpython-39/insightface/thirdparty/face3d
#0 598.1 creating build/temp.linux-x86_64-cpython-39/insightface/thirdparty/face3d/mesh
#0 598.1 creating build/temp.linux-x86_64-cpython-39/insightface/thirdparty/face3d/mesh/cython
#0 598.1 gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -Iinsightface/thirdparty/face3d/mesh/cython -I/tmp/pip-build-env-inxjfxz8/overlay/lib/python3.9/site-packages/numpy/core/include -I/var/lang/include/python3.9 -c insightface/thirdparty/face3d/mesh/cython/mesh_core.cpp -o build/temp.linux-x86_64-cpython-39/insightface/thirdparty/face3d/mesh/cython/mesh_core.o
#0 598.1 error: command 'gcc' failed: No such file or directory
#0 598.1 [end of output]
#0 598.1
#0 598.1 note: This error originates from a subprocess, and is likely not a problem with pip.
#0 598.1 ERROR: Failed building wheel for insightface
#0 598.1 Failed to build insightface
#0 598.1 ERROR: Could not build wheels for insightface, which is required to install pyproject.toml-based projects
#0 598.1
#0 598.1 [notice] A new release of pip is available: 23.0.1 -> 23.3.2
#0 598.1 [notice] To update, run: pip install --upgrade pip

ERROR: failed to solve: executor failed running [/bin/sh -c python3.9 -m pip install -r requirements.txt -t .]: exit code: 1

@zhouzaida
Copy link
Member

zhouzaida commented Jan 8, 2024

Hi @galaltche , what is your pytorch and cuda version? BTW, what is your command to install mmcv-full?

@galaltche
Copy link

Hi @galaltche , what is your pytorch and cuda version? BTW, what is your command to install mmcv-full?

torch==2.1.2 and Cuda 9.1

@zhouzaida
Copy link
Member

zhouzaida commented Jan 9, 2024

Hi @galaltche , what is your pytorch and cuda version? BTW, what is your command to install mmcv-full?

torch==2.1.2 and Cuda 9.1

Hi, torch2.1.2 should not provide the pre-built packages for cuda 9.1 so we also do not support it. Could you use cuda11.8 or cuda12.1?

@gmgihub
Copy link

gmgihub commented Jan 16, 2024

Same prob here. I have tried to install MMYOLO twice and both got error when it comes to mim install -v -e . and both lower PyTorch version and compile MMCV methods did not work out.

Solution:
i recommend @chenscottus 's way which is replace mim install -v -e . to pip3 install -e . -v and this works to me.

by the way, in my second try i have facing the problem when i use mim install "mmcv>=2.0.0rc4,<2.1.0" it returns : can't find module Torch, i replaced it to mim install mmcv with no error. But MMCV installed version is 2.1.0 so it needs to modify the source code in mmyolo/mmyolo/__init__.py :

assert (mmcv_version >= digit_version(mmcv_minimum_version)  
        and mmcv_version <= digit_version(mmcv_maximum_version)), \  
    f'MMCV=={mmcv.__version__} is used but incompatible. ' \  
    f'Please install mmcv>={mmcv_minimum_version}, <{mmcv_maximum_version}.'
# add '=' after '<'

here is my workout enviroment:
torch 2.1.2
mmcv 2.1.0
cuda 12.1
mmyolo 0.6.0

@njfuxht
Copy link

njfuxht commented Feb 4, 2024

Except all solution above, please check your gcc. I have resolved by fix gcc env~~ It is linked to my Xcode config, very strange (xcode-select -switch)

@T-Ray35
Copy link

T-Ray35 commented Mar 7, 2024

I also met this issue, my torch is 2.2.0 then I lower it to 2.1.0, issue still exists. So the solution is to lower it to 2.0.0?

@senjacob
Copy link

Same issue here. When will release a pre-compiled mmcv package that supports pytorch 2.1.0 ? Thanks!

Installation guide for cuda 12.1 + torch 2.1.x is here:
https://mmcv.readthedocs.io/en/latest/get_started/installation.html#install-with-pip

@raviakash
Copy link

Same issue here. When will release a pre-compiled mmcv package that supports pytorch 2.1.0 ? Thanks!

Installation guide for cuda 12.1 + torch 2.1.x is here: https://mmcv.readthedocs.io/en/latest/get_started/installation.html#install-with-pip

Hi! @senjacob this link has helped me to build mmcv successfully that supports pytorch 2.1.x. Thanks!

@Marcia-Shiyu
Copy link

Marcia-Shiyu commented May 27, 2024

The same problem was solved by changing the pytorch version:
python == 3.10
torch ==2.0.0+cu117
mmcv==2.2.0
(cuda11.7)
It finally worked.
PS: My previous version:
python==3.12.3
torch==2.3.0
mmcv==2.2.0
cuda12.1

@Marcia-Shiyu
Copy link

The same problem was solved by changing the pytorch version: python == 3.10 torch ==2.0.0+cu117 mmcv==2.2.0 (cuda11.7) It finally worked. PS: My previous version: python==3.12.3 torch==2.3.0 mmcv==2.2.0 cuda12.1

Do not understand why can not BUILD MMCV FROM SOURCE, I used the Install with pip.

@gitgithan
Copy link

gitgithan commented Jun 5, 2024

I also had same error message as this issue title.

Followed instructions on https://mmdetection.readthedocs.io/en/latest/get_started.html
Broke at mim install mmdet.
Same instructions fail on colab too.

Fixed with pip install mmdet
However running the inference demo

from mmdet.apis import init_detector, inference_detector

config_file = 'rtmdet_tiny_8xb32-300e_coco.py'
checkpoint_file = 'rtmdet_tiny_8xb32-300e_coco_20220902_112414-78e30dcc.pth'
model = init_detector(config_file, checkpoint_file, device='cpu')  # or device='cuda:0'
inference_detector(model, 'demo/demo.jpg')

on the same link broke with AssertionError: MMCV==2.2.0 is used but incompatible. Please install mmcv>=2.0.0rc4, <2.2.0
pip install 'mmcv==2.0.0rc4' fails with same error as issue title.

Python 3.10.14
torch: 2.3.0+cu118
nvcc --version: cuda_11.8.r11.8/compiler.31833905_0


Downgrading torch to 2.0.0 worked.
pip install torch==2.0.0 torchvision==0.15.1 torchaudio==2.0.1 --index-url https://download.pytorch.org/whl/cu118

mim install mmdet worked too.
Demo worked too

@lurongkang123
Copy link

You can go to this website, select your operating system and cuda version and torch version and the mmcv version you want to install, and install mmcv using the command generated by it.
https://mmcv.readthedocs.io/en/latest/get_started/installation.html#install-mmcv
image

@hanqi-monarch
Copy link

@lurongkang123
Is there any place documenting compatibilities between mmcv and other application specific modules like mmdet, mmsegmentation etc?

I tried using the selector at https://mmcv.readthedocs.io/en/latest/get_started/installation.html, even though it installs mmcv properly, mmdet is not installable with pytorch 2.3

@lurongkang123
Copy link

@hanqi-monarch

@lurongkang123 Is there any place documenting compatibilities between mmcv and other application specific modules like mmdet, mmsegmentation etc?

I tried using the selector at https://mmcv.readthedocs.io/en/latest/get_started/installation.html, even though it installs mmcv properly, mmdet is not installable with pytorch 2.3

Sorry, I am just a beginner, do not understand this part of the content, may not be able to provide you with any help, I wish you an early solution to the problem

@CodeDetector
Copy link

This helped conda install pytorch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 pytorch-cuda=11.7 -c pytorch -c nvidia

This works

@xiyg33
Copy link

xiyg33 commented Jun 12, 2024

This issue may be caused by that the version of pytorch you have is 2.1.0. We will release a pre-compiled mmcv package that supports pytorch 2.1.0 in about a week, until then you can try to solve the problem by lowering your pytorch version to 2.0 or by compiling mmcv from source.该问题可能是由于您的pytorch版本是2.1.0导致的。我们将在大约一周内发布支持 pytorch 2.1.0 的预编译 mmcv 包,在此之前您可以尝试通过将 pytorch 版本降低到 2.0 或从源代码编译 mmcv 来解决问题。
Help documentation for compiling mmcv from source: https://mmcv.readthedocs.io/en/latest/get_started/build.html从源代码编译mmcv的帮助文档:https://mmcv.readthedocs.io/en/latest/get_started/build.html

This work for me

这对我来说工作
I attempted to reinstall wheel with pip install wheel, but the error persisted. I then try lowering my Python version to 2.0.0, and it works.我尝试使用 pip install wheel 重新安装wheel,但错误仍然存​​在。然后我尝试将 Python 版本降低到 2.0.0,结果成功了。 pip install torch==2.0.0 torchvision==0.15.1 Note that I am using mmdetection on Google Colab请注意,我在 Google Colab 上使用 mmdetection

It really works! Thanks a lot! 🌹

CUDA 11.8

conda install pytorch==2.0.0 torchvision==0.15.0 torchaudio==2.0.0 pytorch-cuda=11.8 -c pytorch -c nvidia
mmcv: 2.0.1
mmdet: 3.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests