[Bug] mmcv._ext not getting built with Pytorch 2.9.0 and Cuda 13.0
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
OrderedDict({'sys.platform': 'linux', 'Python': '3.13.5 | packaged by Anaconda, Inc. | (main, Jun 12 2025, 16:09:02) [GCC 11.2.0]', 'CUDA available': True, 'MUSA available': False, 'numpy_random_seed': np.uint32(2147483648), 'GPU 0': 'NVIDIA GeForce RTX 5090', 'CUDA_HOME': '/usr/local/cuda-13.0', 'NVCC': 'Cuda compilation tools, release 13.0, V13.0.88', 'GCC': 'gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0', 'PyTorch': '2.9.0+cu130', 'PyTorch compiling details': 'PyTorch built with:\n - GCC 13.3\n - C++ Version: 201703\n - Intel(R) oneAPI Math Kernel Library Version 2024.2-Product Build 20240605 for Intel(R) 64 architecture applications\n - Intel(R) MKL-DNN v3.7.1 (Git Hash 8d263e693366ef8db40acc569cc7d8edf644556d)\n - OpenMP 201511 (a.k.a. OpenMP 4.5)\n - LAPACK is enabled (usually provided by MKL)\n - NNPACK is enabled\n - CPU capability usage: AVX2\n - CUDA Runtime 13.0\n - NVCC architecture flags: -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;-gencode;arch=compute_100,code=sm_100;-gencode;arch=compute_120,code=sm_120;-gencode;arch=compute_120,code=compute_120\n - CuDNN 91.3\n - Magma 2.6.1\n - Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, COMMIT_SHA=0fabc3ba44823f257e70ce397d989c8de5e362c1, CUDA_VERSION=13.0, CUDNN_VERSION=9.13.0, CXX_COMPILER=/opt/rh/gcc-toolset-13/root/usr/bin/c++, CXX_FLAGS= -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOROCTRACER -DLIBKINETO_NOXPUPTI=ON -DUSE_FBGEMM -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -O2 -fPIC -DC10_NODEPRECATED -Wall -Wextra -Werror=return-type -Werror=non-virtual-dtor -Werror=range-loop-construct -Werror=bool-operation -Wnarrowing -Wno-missing-field-initializers -Wno-unknown-pragmas -Wno-unused-parameter -Wno-strict-overflow -Wno-strict-aliasing -Wno-stringop-overflow -Wsuggest-override -Wno-psabi -Wno-error=old-style-cast -faligned-new -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-dangling-reference -Wno-error=dangling-reference -Wno-stringop-overflow, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, TORCH_VERSION=2.9.0, USE_CUDA=ON, USE_CUDNN=ON, USE_CUSPARSELT=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_GLOO=ON, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=1, USE_NNPACK=ON, USE_OPENMP=ON, USE_ROCM=OFF, USE_ROCM_KERNEL_ASSERT=OFF, USE_XCCL=OFF, USE_XPU=OFF, \n', 'TorchVision': '0.24.0+cu130', 'OpenCV': '4.12.0', 'MMEngine': '0.10.7', 'MMCV': '2.2.0', 'MMCV Compiler': 'n/a', 'MMCV CUDA Compiler': 'n/a'})
Reproduces the problem - code sample
Building the mmcv codebase with the command "pip install -e . -v"
Reproduces the problem - command or script
pip install -e . -v
Reproduces the problem - error message
I tried building mmcv from source on my Ubuntu 24.04 system with the latest 2.9.0 version of PyTorch and Cuda 13.0. When I run "pip install -e . -v", it says "Successfully installed mmcv-2.2.0", but, it really doesn't build the mmcv._ext extension in spite of my machine having Nvidia GeForce 5090 graphics card and I have installed Cuda 13.0. It doesn't even attempt to compile the ".cpp" and ".cu" files. I added a print statement in setup.py and noticed that the paths of the .cpp and .cu files are indeed getting passed to the "setup" function. Any idea why setuptools doesn't even invoke the compiler for those files?
Here is the full build log.
(train) jaquilio@MyMachine:~/qlabRoot/projects/mmcv$ pip install -e . -v
Using pip 25.2 from /home/jaquilio/miniconda3/envs/train/lib/python3.13/site-packages/pip (python 3.13)
Obtaining file:///home/jaquilio/qlabRoot/projects/mmcv
Running command python setup.py egg_info
/home/jaquilio/qlabRoot/projects/mmcv/setup.py:5: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
from pkg_resources import DistributionNotFound, get_distribution, parse_version
/home/jaquilio/miniconda3/envs/train/lib/python3.13/site-packages/setuptools/dist.py:759: SetuptoolsDeprecationWarning: License classifiers are deprecated.
!!
********************************************************************************
Please consider removing the following classifiers in favor of a SPDX license expression:
License :: OSI Approved :: Apache Software License
See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
********************************************************************************
!!
self._finalize_license_expression()
running egg_info
creating /tmp/pip-pip-egg-info-va_srkcj/mmcv.egg-info
writing /tmp/pip-pip-egg-info-va_srkcj/mmcv.egg-info/PKG-INFO
writing dependency_links to /tmp/pip-pip-egg-info-va_srkcj/mmcv.egg-info/dependency_links.txt
writing requirements to /tmp/pip-pip-egg-info-va_srkcj/mmcv.egg-info/requires.txt
writing top-level names to /tmp/pip-pip-egg-info-va_srkcj/mmcv.egg-info/top_level.txt
writing manifest file '/tmp/pip-pip-egg-info-va_srkcj/mmcv.egg-info/SOURCES.txt'
reading manifest file '/tmp/pip-pip-egg-info-va_srkcj/mmcv.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
adding license file 'LICENSE'
adding license file 'LICENSES.md'
writing manifest file '/tmp/pip-pip-egg-info-va_srkcj/mmcv.egg-info/SOURCES.txt'
Preparing metadata (setup.py) ... done
Requirement already satisfied: addict in /home/jaquilio/miniconda3/envs/train/lib/python3.13/site-packages (from mmcv==2.2.0) (2.4.0)
Requirement already satisfied: mmengine>=0.3.0 in /home/jaquilio/miniconda3/envs/train/lib/python3.13/site-packages (from mmcv==2.2.0) (0.10.7)
Requirement already satisfied: numpy in /home/jaquilio/miniconda3/envs/train/lib/python3.13/site-packages (from mmcv==2.2.0) (2.2.6)
Requirement already satisfied: packaging in /home/jaquilio/miniconda3/envs/train/lib/python3.13/site-packages (from mmcv==2.2.0) (24.2)
Requirement already satisfied: Pillow in /home/jaquilio/miniconda3/envs/train/lib/python3.13/site-packages (from mmcv==2.2.0) (11.3.0)
Requirement already satisfied: pyyaml in /home/jaquilio/miniconda3/envs/train/lib/python3.13/site-packages (from mmcv==2.2.0) (6.0.3)
Requirement already satisfied: yapf in /home/jaquilio/miniconda3/envs/train/lib/python3.13/site-packages (from mmcv==2.2.0) (0.43.0)
Requirement already satisfied: matplotlib in /home/jaquilio/miniconda3/envs/train/lib/python3.13/site-packages (from mmengine>=0.3.0->mmcv==2.2.0) (3.10.7)
Requirement already satisfied: rich in /home/jaquilio/miniconda3/envs/train/lib/python3.13/site-packages (from mmengine>=0.3.0->mmcv==2.2.0) (13.4.2)
Requirement already satisfied: termcolor in /home/jaquilio/miniconda3/envs/train/lib/python3.13/site-packages (from mmengine>=0.3.0->mmcv==2.2.0) (3.1.0)
Requirement already satisfied: opencv-python>=3 in /home/jaquilio/miniconda3/envs/train/lib/python3.13/site-packages (from mmengine>=0.3.0->mmcv==2.2.0) (4.12.0.88)
Requirement already satisfied: contourpy>=1.0.1 in /home/jaquilio/miniconda3/envs/train/lib/python3.13/site-packages (from matplotlib->mmengine>=0.3.0->mmcv==2.2.0) (1.3.3)
Requirement already satisfied: cycler>=0.10 in /home/jaquilio/miniconda3/envs/train/lib/python3.13/site-packages (from matplotlib->mmengine>=0.3.0->mmcv==2.2.0) (0.12.1)
Requirement already satisfied: fonttools>=4.22.0 in /home/jaquilio/miniconda3/envs/train/lib/python3.13/site-packages (from matplotlib->mmengine>=0.3.0->mmcv==2.2.0) (4.60.1)
Requirement already satisfied: kiwisolver>=1.3.1 in /home/jaquilio/miniconda3/envs/train/lib/python3.13/site-packages (from matplotlib->mmengine>=0.3.0->mmcv==2.2.0) (1.4.9)
Requirement already satisfied: pyparsing>=3 in /home/jaquilio/miniconda3/envs/train/lib/python3.13/site-packages (from matplotlib->mmengine>=0.3.0->mmcv==2.2.0) (3.2.5)
Requirement already satisfied: python-dateutil>=2.7 in /home/jaquilio/miniconda3/envs/train/lib/python3.13/site-packages (from matplotlib->mmengine>=0.3.0->mmcv==2.2.0) (2.9.0.post0)
Requirement already satisfied: six>=1.5 in /home/jaquilio/miniconda3/envs/train/lib/python3.13/site-packages (from python-dateutil>=2.7->matplotlib->mmengine>=0.3.0->mmcv==2.2.0) (1.17.0)
Requirement already satisfied: markdown-it-py>=2.2.0 in /home/jaquilio/miniconda3/envs/train/lib/python3.13/site-packages (from rich->mmengine>=0.3.0->mmcv==2.2.0) (4.0.0)
Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /home/jaquilio/miniconda3/envs/train/lib/python3.13/site-packages (from rich->mmengine>=0.3.0->mmcv==2.2.0) (2.19.1)
Requirement already satisfied: mdurl~=0.1 in /home/jaquilio/miniconda3/envs/train/lib/python3.13/site-packages (from markdown-it-py>=2.2.0->rich->mmengine>=0.3.0->mmcv==2.2.0) (0.1.2)
Requirement already satisfied: platformdirs>=3.5.1 in /home/jaquilio/miniconda3/envs/train/lib/python3.13/site-packages (from yapf->mmcv==2.2.0) (4.3.7)
Installing collected packages: mmcv
DEPRECATION: Legacy editable install of mmcv==2.2.0 from file:///home/jaquilio/qlabRoot/projects/mmcv (setup.py develop) is deprecated. pip 25.3 will enforce this behaviour change. A possible replacement is to add a pyproject.toml or enable --use-pep517, and use setuptools >= 64. If the resulting installation is not behaving as expected, try using --config-settings editable_mode=compat. Please consult the setuptools documentation for more information. Discussion can be found at https://github.com/pypa/pip/issues/11457
Running setup.py develop for mmcv
Running command python setup.py develop
/home/jaquilio/qlabRoot/projects/mmcv/setup.py:5: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
from pkg_resources import DistributionNotFound, get_distribution, parse_version
/home/jaquilio/miniconda3/envs/train/lib/python3.13/site-packages/setuptools/dist.py:759: SetuptoolsDeprecationWarning: License classifiers are deprecated.
!!
********************************************************************************
Please consider removing the following classifiers in favor of a SPDX license expression:
License :: OSI Approved :: Apache Software License
See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
********************************************************************************
!!
self._finalize_license_expression()
running develop
/home/jaquilio/miniconda3/envs/train/lib/python3.13/site-packages/setuptools/_distutils/cmd.py:90: DevelopDeprecationWarning: develop command is deprecated.
!!
********************************************************************************
Please avoid running ``setup.py`` and ``develop``.
Instead, use standards-based tools like pip or uv.
By 2025-Oct-31, you need to update your project and remove deprecated calls
or your builds will no longer be supported.
See https://github.com/pypa/setuptools/issues/917 for details.
********************************************************************************
!!
self.initialize_options()
Obtaining file:///home/jaquilio/qlabRoot/projects/mmcv
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Checking if build backend supports build_editable: started
Checking if build backend supports build_editable: finished with status 'done'
Getting requirements to build editable: started
Getting requirements to build editable: finished with status 'done'
Preparing editable metadata (pyproject.toml): started
Preparing editable metadata (pyproject.toml): finished with status 'done'
Building wheels for collected packages: mmcv
Building editable for mmcv (pyproject.toml): started
Building editable for mmcv (pyproject.toml): finished with status 'done'
Created wheel for mmcv: filename=mmcv-2.2.0-0.editable-py2.py3-none-any.whl size=8021 sha256=2b557940e2fbc9d1560a35860b675036af0d3428b05909e36c2db715113d92d2
Stored in directory: /tmp/pip-ephem-wheel-cache-rxx4hilq/wheels/7f/cf/b1/6268c2e00446d84d80fe7511175ea9913bb190e0be5bdad2dc
Successfully built mmcv
Installing collected packages: mmcv
Successfully installed mmcv-2.2.0
Successfully installed mmcv-2.2.0
(train) jaquilio@MyMachine:~/qlabRoot/projects/mmcv$
Additional information
No response
fisrt, you need to 'pip install openmim'
remove mmcv and mmengine, clone repo and install it using pip install -r requirements/build.txt MMCV_WITH_OPS=1 pip install -e . --config-settings editable_mode=compat
Idk why like prev i dont use this to work with mmcv but rn thats the only way for me
Try the following solution. I used this approach to resolve the issue. Please use the commands below to install the precompiled version of mmcv 2.2.0:
pip uninstall mmcv mmdet mmpose mmengine
pip install --extra-index-url https://miropsota.github.io/torch_packages_builder mmcv==2.2.0+pt2.8.0cu128 mmdet mmengine mmpose
Note: This may cause minor compatibility issues. You'll need to adjust mmdet's version constraints to support mmcv 2.2.0, as the precompiled version does not include 2.1.0.