open-mmlab / mmcv

OpenMMLab Computer Vision Foundation
https://mmcv.readthedocs.io/en/latest/
Apache License 2.0
5.83k stars 1.63k forks source link

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

Open rbli-john opened 1 year ago

rbli-john commented 1 year ago

Prerequisite

Environment

Please see https://github.com/open-mmlab/mmdetection/issues/10873

Reproduces the problem - code sample

Please see https://github.com/open-mmlab/mmdetection/issues/10873 for details.

Reproduces the problem - command or script

Please see https://github.com/open-mmlab/mmdetection/issues/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 commented 1 year ago

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

rbli-john commented 1 year ago

@zhouzaida You mean pip install wheel?

zhouzaida commented 1 year ago

@zhouzaida You mean pip install wheel?

yes

tomarvimal commented 11 months ago

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

p0wned17 commented 11 months ago

I also have the same error

fanqiNO1 commented 11 months ago

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 commented 11 months ago

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 commented 11 months ago

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 commented 11 months ago

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 commented 11 months ago

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 commented 11 months ago

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 commented 11 months ago

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

I need help, please!

chenscottus commented 11 months ago

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

LongboV commented 11 months ago

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 commented 11 months ago

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

YonghuiTAN22 commented 11 months ago

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

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

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

AnjanaWijesinghe commented 11 months ago

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 commented 11 months ago

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:

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 commented 11 months ago

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 commented 10 months ago

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 commented 10 months ago

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 commented 10 months ago

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 commented 10 months ago

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 commented 10 months ago

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 commented 9 months ago

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 commented 8 months ago

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 commented 8 months ago

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 commented 8 months ago

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

galaltche commented 8 months ago

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 commented 8 months ago

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 commented 8 months ago

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 commented 7 months ago

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 commented 6 months ago

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 commented 6 months ago

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 commented 5 months ago

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 commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

@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 commented 3 months ago

@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 commented 3 months ago

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 commented 3 months ago

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

suikei-wang commented 2 months ago

Hi @chenscottus , Thanks for your comment here for cuda12.1. I am wondering if the version you installed here is mmcv-full or not as I follow it but it turns out ModuleNotFoundError: No module named 'mmcv._ext', ImportError: cannot import name 'MultiScaleDeformableAttention' from 'mmcv.cnn.bricks.transformer' in my code which indicates that the mmcv is not full version...

geviolet commented 1 month ago

我解决上述问题的方式是直接下载对应cuda,pytorch版本的mmcv,比如我的环境是cuda 10.2,pytorch 1.12.0,直接在下面链接找对应版本的mmcv的whl文件下载https://download.openmmlab.com/mmcv/dist/cu102/torch1.12/index.html 例如https://download.openmmlab.com/mmcv/dist/cu102/torch1.12.0/mmcv-2.0.0-cp39-cp39-manylinux1_x86_64.whl 然后直接 pip install mmcv-2.1.0-cp39-cp39-manylinux1_x86_64.whl

corgok commented 1 month ago

My impression is that the problem with wheels occurs first after some of the recommended installation steps. For mmocr I follow https://mmocr.readthedocs.io/en/dev-1.x/get_started/install.html and tried several times with some variations on Windows. The last time I tested that mmcv in the required version would install before installing everything else, which it did, but then I tried to reinstall and I get this wheel error again. The reason for another attempt to install was "No module named 'mmcv._ext'" as above and I thought it might be installation order.