open-mmlab / mmcv

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

Can't install mmcv 2.1.0 for PyTorch 2.1.0 #3035

Open JavierYepez opened 9 months ago

JavierYepez commented 9 months ago

Prerequisite

Environment

I have a conda yaml file to create this environment:

name: myenv
channels:
    - pytorch
    - nvidia
    - conda-forge
dependencies:
    - python=3.10
    - cudatoolkit=11.8.0
    - pytorch=2.1.0
    - pytorch-cuda=11.8
    - pre-commit=2.20.0
    - torchvision=0.16.0
    - mlflow=2.10.2
    - pytest=7.4.0
    - plotly=5.19.0
    - pip
    - pip:
      - opencv-contrib-python==4.9.0.80
      - openmim==0.3.9
      - fire==0.5.0
      - setuptools==68.2.2

Reproduces the problem - code sample

-

Reproduces the problem - command or script

I run a setup.py file where mim install mmengine==0.10.3 mmcv==2.1.0 mmpretrain==1.0.1 is executed

Reproduces the problem - error message

Looking in links: https://download.openmmlab.com/mmcv/dist/cu118/torch2.1.0/index.html
Collecting mmengine==0.10.3
  Downloading mmengine-0.10.3-py3-none-any.whl.metadata (20 kB)
Collecting addict (from mmengine==0.10.3)
  Downloading addict-2.4.0-py3-none-any.whl (3.8 kB)
Requirement already satisfied: matplotlib in /opt/conda/lib/python3.10/site-packages (from mmengine==0.10.3) (3.8.3)
Requirement already satisfied: numpy in /opt/conda/lib/python3.10/site-packages (from mmengine==0.10.3) (1.26.4)
Requirement already satisfied: pyyaml in /opt/conda/lib/python3.10/site-packages (from mmengine==0.10.3) (6.0.1)
Requirement already satisfied: rich in /opt/conda/lib/python3.10/site-packages (from mmengine==0.10.3) (13.7.0)
Requirement already satisfied: termcolor in /opt/conda/lib/python3.10/site-packages (from mmengine==0.10.3) (2.4.0)
Collecting yapf (from mmengine==0.10.3)
  Downloading yapf-0.40.2-py3-none-any.whl.metadata (45 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 45.4/45.4 kB 352.7 kB/s eta 0:00:00
Collecting opencv-python>=3 (from mmengine==0.10.3)
  Downloading opencv_python-4.9.0.80-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (20 kB)
Requirement already satisfied: contourpy>=1.0.1 in /opt/conda/lib/python3.10/site-packages (from matplotlib->mmengine==0.10.3) (1.2.0)
Requirement already satisfied: cycler>=0.10 in /opt/conda/lib/python3.10/site-packages (from matplotlib->mmengine==0.10.3) (0.12.1)
Requirement already satisfied: fonttools>=4.22.0 in /opt/conda/lib/python3.10/site-packages (from matplotlib->mmengine==0.10.3) (4.49.0)
Requirement already satisfied: kiwisolver>=1.3.1 in /opt/conda/lib/python3.10/site-packages (from matplotlib->mmengine==0.10.3) (1.4.5)
Requirement already satisfied: packaging>=20.0 in /opt/conda/lib/python3.10/site-packages (from matplotlib->mmengine==0.10.3) (23.2)
Requirement already satisfied: pillow>=8 in /opt/conda/lib/python3.10/site-packages (from matplotlib->mmengine==0.10.3) (10.2.0)
Requirement already satisfied: pyparsing>=2.3.1 in /opt/conda/lib/python3.10/site-packages (from matplotlib->mmengine==0.10.3) (3.1.1)
Requirement already satisfied: python-dateutil>=2.7 in /opt/conda/lib/python3.10/site-packages (from matplotlib->mmengine==0.10.3) (2.8.2)
Requirement already satisfied: markdown-it-py>=2.2.0 in /opt/conda/lib/python3.10/site-packages (from rich->mmengine==0.10.3) (3.0.0)
Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /opt/conda/lib/python3.10/site-packages (from rich->mmengine==0.10.3) (2.17.2)
Requirement already satisfied: importlib-metadata>=6.6.0 in /opt/conda/lib/python3.10/site-packages (from yapf->mmengine==0.10.3) (7.0.1)
Requirement already satisfied: platformdirs>=3.5.1 in /opt/conda/lib/python3.10/site-packages (from yapf->mmengine==0.10.3) (3.11.0)
Requirement already satisfied: tomli>=2.0.1 in /opt/conda/lib/python3.10/site-packages (from yapf->mmengine==0.10.3) (2.0.1)
Requirement already satisfied: zipp>=0.5 in /opt/conda/lib/python3.10/site-packages (from importlib-metadata>=6.6.0->yapf->mmengine==0.10.3) (3.17.0)
Requirement already satisfied: mdurl~=0.1 in /opt/conda/lib/python3.10/site-packages (from markdown-it-py>=2.2.0->rich->mmengine==0.10.3) (0.1.2)
Requirement already satisfied: six>=1.5 in /opt/conda/lib/python3.10/site-packages (from python-dateutil>=2.7->matplotlib->mmengine==0.10.3) (1.16.0)
Downloading mmengine-0.10.3-py3-none-any.whl (451 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 451.7/451.7 kB 1.1 MB/s eta 0:00:00
Downloading opencv_python-4.9.0.80-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (62.2 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.2/62.2 MB 681.8 kB/s eta 0:00:00
Downloading yapf-0.40.2-py3-none-any.whl (254 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 254.7/254.7 kB 817.7 kB/s eta 0:00:00
Installing collected packages: addict, opencv-python, yapf, mmengine
Successfully installed addict-2.4.0 mmengine-0.10.3 opencv-python-4.9.0.80 yapf-0.40.2
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Looking in links: https://download.openmmlab.com/mmcv/dist/cu118/torch2.1.0/index.html
Collecting mmcv==2.1.0
  Downloading https://download.openmmlab.com/mmcv/dist/cu118/torch2.1.0/mmcv-2.1.0-cp310-cp310-manylinux1_x86_64.whl (99.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 99.3/99.3 MB 9.4 MB/s eta 0:00:00
Requirement already satisfied: addict in /opt/conda/lib/python3.10/site-packages (from mmcv==2.1.0) (2.4.0)
Requirement already satisfied: mmengine>=0.3.0 in /opt/conda/lib/python3.10/site-packages (from mmcv==2.1.0) (0.10.3)
Requirement already satisfied: numpy in /opt/conda/lib/python3.10/site-packages (from mmcv==2.1.0) (1.26.4)
Requirement already satisfied: packaging in /opt/conda/lib/python3.10/site-packages (from mmcv==2.1.0) (23.2)
Requirement already satisfied: Pillow in /opt/conda/lib/python3.10/site-packages (from mmcv==2.1.0) (10.2.0)
Requirement already satisfied: pyyaml in /opt/conda/lib/python3.10/site-packages (from mmcv==2.1.0) (6.0.1)
Requirement already satisfied: yapf in /opt/conda/lib/python3.10/site-packages (from mmcv==2.1.0) (0.40.2)
Requirement already satisfied: opencv-python>=3 in /opt/conda/lib/python3.10/site-packages (from mmcv==2.1.0) (4.9.0.80)
Requirement already satisfied: matplotlib in /opt/conda/lib/python3.10/site-packages (from mmengine>=0.3.0->mmcv==2.1.0) (3.8.3)
Requirement already satisfied: rich in /opt/conda/lib/python3.10/site-packages (from mmengine>=0.3.0->mmcv==2.1.0) (13.7.0)
Requirement already satisfied: termcolor in /opt/conda/lib/python3.10/site-packages (from mmengine>=0.3.0->mmcv==2.1.0) (2.4.0)
Requirement already satisfied: importlib-metadata>=6.6.0 in /opt/conda/lib/python3.10/site-packages (from yapf->mmcv==2.1.0) (7.0.1)
Requirement already satisfied: platformdirs>=3.5.1 in /opt/conda/lib/python3.10/site-packages (from yapf->mmcv==2.1.0) (3.11.0)
Requirement already satisfied: tomli>=2.0.1 in /opt/conda/lib/python3.10/site-packages (from yapf->mmcv==2.1.0) (2.0.1)
Requirement already satisfied: zipp>=0.5 in /opt/conda/lib/python3.10/site-packages (from importlib-metadata>=6.6.0->yapf->mmcv==2.1.0) (3.17.0)
Requirement already satisfied: contourpy>=1.0.1 in /opt/conda/lib/python3.10/site-packages (from matplotlib->mmengine>=0.3.0->mmcv==2.1.0) (1.2.0)
Requirement already satisfied: cycler>=0.10 in /opt/conda/lib/python3.10/site-packages (from matplotlib->mmengine>=0.3.0->mmcv==2.1.0) (0.12.1)
Requirement already satisfied: fonttools>=4.22.0 in /opt/conda/lib/python3.10/site-packages (from matplotlib->mmengine>=0.3.0->mmcv==2.1.0) (4.49.0)
Requirement already satisfied: kiwisolver>=1.3.1 in /opt/conda/lib/python3.10/site-packages (from matplotlib->mmengine>=0.3.0->mmcv==2.1.0) (1.4.5)
Requirement already satisfied: pyparsing>=2.3.1 in /opt/conda/lib/python3.10/site-packages (from matplotlib->mmengine>=0.3.0->mmcv==2.1.0) (3.1.1)
Requirement already satisfied: python-dateutil>=2.7 in /opt/conda/lib/python3.10/site-packages (from matplotlib->mmengine>=0.3.0->mmcv==2.1.0) (2.8.2)
Requirement already satisfied: markdown-it-py>=2.2.0 in /opt/conda/lib/python3.10/site-packages (from rich->mmengine>=0.3.0->mmcv==2.1.0) (3.0.0)
Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /opt/conda/lib/python3.10/site-packages (from rich->mmengine>=0.3.0->mmcv==2.1.0) (2.17.2)
Requirement already satisfied: mdurl~=0.1 in /opt/conda/lib/python3.10/site-packages (from markdown-it-py>=2.2.0->rich->mmengine>=0.3.0->mmcv==2.1.0) (0.1.2)
Requirement already satisfied: six>=1.5 in /opt/conda/lib/python3.10/site-packages (from python-dateutil>=2.7->matplotlib->mmengine>=0.3.0->mmcv==2.1.0) (1.16.0)
Installing collected packages: mmcv
Successfully installed mmcv-2.1.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Looking in links: https://download.openmmlab.com/mmcv/dist/cu118/torch2.1.0/index.html
Collecting mmpretrain==1.0.1
  Downloading mmpretrain-1.0.1-py2.py3-none-any.whl.metadata (20 kB)
Collecting einops (from mmpretrain==1.0.1)
  Downloading einops-0.7.0-py3-none-any.whl.metadata (13 kB)
Requirement already satisfied: importlib-metadata in /opt/conda/lib/python3.10/site-packages (from mmpretrain==1.0.1) (7.0.1)
Collecting mat4py (from mmpretrain==1.0.1)
  Downloading mat4py-0.6.0-py2.py3-none-any.whl.metadata (2.8 kB)
Requirement already satisfied: matplotlib in /opt/conda/lib/python3.10/site-packages (from mmpretrain==1.0.1) (3.8.3)
Collecting modelindex (from mmpretrain==1.0.1)
  Downloading modelindex-0.0.2-py3-none-any.whl.metadata (756 bytes)
Requirement already satisfied: numpy in /opt/conda/lib/python3.10/site-packages (from mmpretrain==1.0.1) (1.26.4)
Requirement already satisfied: rich in /opt/conda/lib/python3.10/site-packages (from mmpretrain==1.0.1) (13.7.0)
Collecting mmcv<2.1.0,>=2.0.0 (from mmpretrain==1.0.1)
  Downloading mmcv-2.0.1.tar.gz (469 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 469.5/469.5 kB 1.5 MB/s eta 0:00:00
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Requirement already satisfied: mmengine<1.0.0,>=0.8.3 in /opt/conda/lib/python3.10/site-packages (from mmpretrain==1.0.1) (0.10.3)
Requirement already satisfied: addict in /opt/conda/lib/python3.10/site-packages (from mmcv<2.1.0,>=2.0.0->mmpretrain==1.0.1) (2.4.0)
Requirement already satisfied: packaging in /opt/conda/lib/python3.10/site-packages (from mmcv<2.1.0,>=2.0.0->mmpretrain==1.0.1) (23.2)
Requirement already satisfied: Pillow in /opt/conda/lib/python3.10/site-packages (from mmcv<2.1.0,>=2.0.0->mmpretrain==1.0.1) (10.2.0)
Requirement already satisfied: pyyaml in /opt/conda/lib/python3.10/site-packages (from mmcv<2.1.0,>=2.0.0->mmpretrain==1.0.1) (6.0.1)
Requirement already satisfied: yapf in /opt/conda/lib/python3.10/site-packages (from mmcv<2.1.0,>=2.0.0->mmpretrain==1.0.1) (0.40.2)
Requirement already satisfied: termcolor in /opt/conda/lib/python3.10/site-packages (from mmengine<1.0.0,>=0.8.3->mmpretrain==1.0.1) (2.4.0)
Requirement already satisfied: opencv-python>=3 in /opt/conda/lib/python3.10/site-packages (from mmengine<1.0.0,>=0.8.3->mmpretrain==1.0.1) (4.9.0.80)
Requirement already satisfied: zipp>=0.5 in /opt/conda/lib/python3.10/site-packages (from importlib-metadata->mmpretrain==1.0.1) (3.17.0)
Requirement already satisfied: contourpy>=1.0.1 in /opt/conda/lib/python3.10/site-packages (from matplotlib->mmpretrain==1.0.1) (1.2.0)
Requirement already satisfied: cycler>=0.10 in /opt/conda/lib/python3.10/site-packages (from matplotlib->mmpretrain==1.0.1) (0.12.1)
Requirement already satisfied: fonttools>=4.22.0 in /opt/conda/lib/python3.10/site-packages (from matplotlib->mmpretrain==1.0.1) (4.49.0)
Requirement already satisfied: kiwisolver>=1.3.1 in /opt/conda/lib/python3.10/site-packages (from matplotlib->mmpretrain==1.0.1) (1.4.5)
Requirement already satisfied: pyparsing>=2.3.1 in /opt/conda/lib/python3.10/site-packages (from matplotlib->mmpretrain==1.0.1) (3.1.1)
Requirement already satisfied: python-dateutil>=2.7 in /opt/conda/lib/python3.10/site-packages (from matplotlib->mmpretrain==1.0.1) (2.8.2)
Requirement already satisfied: model-index in /opt/conda/lib/python3.10/site-packages (from modelindex->mmpretrain==1.0.1) (0.1.11)
Requirement already satisfied: markdown-it-py>=2.2.0 in /opt/conda/lib/python3.10/site-packages (from rich->mmpretrain==1.0.1) (3.0.0)
Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /opt/conda/lib/python3.10/site-packages (from rich->mmpretrain==1.0.1) (2.17.2)
Requirement already satisfied: mdurl~=0.1 in /opt/conda/lib/python3.10/site-packages (from markdown-it-py>=2.2.0->rich->mmpretrain==1.0.1) (0.1.2)
Requirement already satisfied: six>=1.5 in /opt/conda/lib/python3.10/site-packages (from python-dateutil>=2.7->matplotlib->mmpretrain==1.0.1) (1.16.0)
Requirement already satisfied: markdown in /opt/conda/lib/python3.10/site-packages (from model-index->modelindex->mmpretrain==1.0.1) (3.5.2)
Requirement already satisfied: ordered-set in /opt/conda/lib/python3.10/site-packages (from model-index->modelindex->mmpretrain==1.0.1) (4.1.0)
Requirement already satisfied: click in /opt/conda/lib/python3.10/site-packages (from model-index->modelindex->mmpretrain==1.0.1) (8.1.7)
Requirement already satisfied: platformdirs>=3.5.1 in /opt/conda/lib/python3.10/site-packages (from yapf->mmcv<2.1.0,>=2.0.0->mmpretrain==1.0.1) (3.11.0)
Requirement already satisfied: tomli>=2.0.1 in /opt/conda/lib/python3.10/site-packages (from yapf->mmcv<2.1.0,>=2.0.0->mmpretrain==1.0.1) (2.0.1)
Downloading mmpretrain-1.0.1-py2.py3-none-any.whl (1.5 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.5/1.5 MB 2.2 MB/s eta 0:00:00
Downloading einops-0.7.0-py3-none-any.whl (44 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 44.6/44.6 kB 94.1 kB/s eta 0:00:00
Downloading mat4py-0.6.0-py2.py3-none-any.whl (13 kB)
Downloading modelindex-0.0.2-py3-none-any.whl (2.1 kB)
Building wheels for collected packages: mmcv
  Building wheel for mmcv (setup.py): started
  Building wheel for mmcv (setup.py): finished with status 'error'
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [1821 lines of output]
      /tmp/pip-install-jwtqb6o0/mmcv_6c45e3be4f10446ab007e2200669cde5/setup.py:5: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
        from pkg_resources import DistributionNotFound, get_distribution, parse_version
      Compiling mmcv._ext only with CPU
      running bdist_wheel
      /opt/conda/lib/python3.10/site-packages/torch/utils/cpp_extension.py:502: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
        warnings.warn(msg.format('we could not find ninja.'))
      running build
      running build_py
      creating build
      ........ TRUNCATED ........ 
      writing manifest file 'mmcv.egg-info/SOURCES.txt'
      /opt/conda/lib/python3.10/site-packages/setuptools/command/build_py.py:204: _Warning: Package 'mmcv.ops.csrc.common' is absent from the `packages` configuration.
      !!

              ********************************************************************************
              ############################
              # Package would be ignored #
              ############################
              Python recognizes 'mmcv.ops.csrc.common' as an importable package[^1],
              but it is absent from setuptools' `packages` configuration.

              This leads to an ambiguous overall configuration. If you want to distribute this
              package, please make sure that 'mmcv.ops.csrc.common' is explicitly added
              to the `packages` configuration field.
              ********************************************************************************

      !!
        check.warn(importable)
      /opt/conda/lib/python3.10/site-packages/setuptools/command/build_py.py:204: _Warning: Package 'mmcv.ops.csrc.common.cuda' is absent from the `packages` configuration.
      !!

              ********************************************************************************
              ############################
              # Package would be ignored #
              ############################
              Python recognizes 'mmcv.ops.csrc.common.cuda' as an importable package[^1],
              but it is absent from setuptools' `packages` configuration.

              This leads to an ambiguous overall configuration. If you want to distribute this
              package, please make sure that 'mmcv.ops.csrc.common.cuda' is explicitly added
              to the `packages` configuration field.

              Alternatively, you can also rely on setuptools' discovery methods
              (for example by using `find_namespace_packages(...)`/`find_namespace:`
              instead of `find_packages(...)`/`find:`).

              You can read more about "package discovery" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

              If you don't want 'mmcv.ops.csrc.common.cuda' to be distributed and are
              already explicitly excluding 'mmcv.ops.csrc.common.cuda' via
              `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
              you can try to use `exclude_package_data`, or `include-package-data=False` in
              combination with a more fine grained `package-data` configuration.

              You can read more about "package data files" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/datafiles.html

              [^1]: For Python, any directory (with suitable naming) can be imported,
                    even if it does not contain any `.py` files.
                    On the other hand, currently there is no concept of package data
                    directory, all directories are treated like packages.
              ********************************************************************************
      ........ TRUNCATED ........ 
        check.warn(importable)
      /opt/conda/lib/python3.10/site-packages/setuptools/command/build_py.py:204: _Warning: Package 'mmcv.ops.csrc.pytorch.cuda' is absent from the `packages` configuration.
      !!

              ********************************************************************************
              ############################
              # Package would be ignored #
              ############################
              Python recognizes 'mmcv.ops.csrc.pytorch.cuda' as an importable package[^1],
              but it is absent from setuptools' `packages` configuration.

              This leads to an ambiguous overall configuration. If you want to distribute this
              package, please make sure that 'mmcv.ops.csrc.pytorch.cuda' is explicitly added
              to the `packages` configuration field.

              Alternatively, you can also rely on setuptools' discovery methods
              (for example by using `find_namespace_packages(...)`/`find_namespace:`
              instead of `find_packages(...)`/`find:`).

              You can read more about "package discovery" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

              If you don't want 'mmcv.ops.csrc.pytorch.cuda' to be distributed and are
              already explicitly excluding 'mmcv.ops.csrc.pytorch.cuda' via
              `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
              you can try to use `exclude_package_data`, or `include-package-data=False` in
              combination with a more fine grained `package-data` configuration.

              You can read more about "package data files" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/datafiles.html

              [^1]: For Python, any directory (with suitable naming) can be imported,
                    even if it does not contain any `.py` files.
                    On the other hand, currently there is no concept of package data
                    directory, all directories are treated like packages.
              ********************************************************************************
        check.warn(importable)
      creating build/lib.linux-x86_64-cpython-310/mmcv/ops/csrc
      creating build/lib.linux-x86_64-cpython-310/mmcv/ops/csrc/common
      ........ TRUNCATED ........ 
      creating build/temp.linux-x86_64-cpython-310/mmcv/ops/csrc/pytorch
      creating build/temp.linux-x86_64-cpython-310/mmcv/ops/csrc/pytorch/cpu
      gcc -pthread -B /opt/conda/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /opt/conda/include -fPIC -O2 -isystem /opt/conda/include -fPIC -I/tmp/pip-install-jwtqb6o0/mmcv_6c45e3be4f10446ab007e2200669cde5/mmcv/ops/csrc/common -I/opt/conda/lib/python3.10/site-packages/torch/include -I/opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/opt/conda/lib/python3.10/site-packages/torch/include/TH -I/opt/conda/lib/python3.10/site-packages/torch/include/THC -I/opt/conda/include/python3.10 -c ./mmcv/ops/csrc/pytorch/active_rotated_filter.cpp -o build/temp.linux-x86_64-cpython-310/./mmcv/ops/csrc/pytorch/active_rotated_filter.o -std=c++14 -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -DTORCH_EXTENSION_NAME=_ext -D_GLIBCXX_USE_CXX11_ABI=0
      In file included from /opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
                       from /tmp/pip-install-jwtqb6o0/mmcv_6c45e3be4f10446ab007e2200669cde5/mmcv/ops/csrc/common/pytorch_cpp_helper.hpp:3,
                       from ./mmcv/ops/csrc/pytorch/active_rotated_filter.cpp:5:
      /opt/conda/lib/python3.10/site-packages/torch/include/ATen/ATen.h:4:2: error: #error C++17 or later compatible compiler is required to use ATen.
          4 | #error C++17 or later compatible compiler is required to use ATen.
            |  ^~~~~
      In file included from /opt/conda/lib/python3.10/site-packages/torch/include/c10/util/string_view.h:4,
                       from /opt/conda/lib/python3.10/site-packages/torch/include/c10/util/StringUtil.h:6,
                       from /opt/conda/lib/python3.10/site-packages/torch/include/c10/util/Exception.h:5,
                       from /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/Generator.h:11,
                       from /opt/conda/lib/python3.10/site-packages/torch/include/ATen/CPUGeneratorImpl.h:3,
                       from /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Context.h:3,
                       from /opt/conda/lib/python3.10/site-packages/torch/include/ATen/ATen.h:7,
                       from /opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
                       from /tmp/pip-install-jwtqb6o0/mmcv_6c45e3be4f10446ab007e2200669cde5/mmcv/ops/csrc/common/pytorch_cpp_helper.hpp:3,
                       from ./mmcv/ops/csrc/pytorch/active_rotated_filter.cpp:5:
      /opt/conda/lib/python3.10/site-packages/torch/include/c10/util/C++17.h:27:2: error: #error You need C++17 to compile PyTorch
         27 | #error You need C++17 to compile PyTorch
            |  ^~~~~
      In file included from /opt/conda/lib/python3.10/site-packages/torch/include/c10/util/typeid.h:17,
                       from /opt/conda/lib/python3.10/site-packages/torch/include/c10/core/ScalarTypeToTypeMeta.h:5,
                       from /opt/conda/lib/python3.10/site-packages/torch/include/c10/core/TensorImpl.h:6,
                       from /opt/conda/lib/python3.10/site-packages/torch/include/c10/core/GeneratorImpl.h:8,
                       from /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/Generator.h:22,
                       from /opt/conda/lib/python3.10/site-packages/torch/include/ATen/CPUGeneratorImpl.h:3,
                       from /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Context.h:3,
                       from /opt/conda/lib/python3.10/site-packages/torch/include/ATen/ATen.h:7,
                       from /opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
                       from /tmp/pip-install-jwtqb6o0/mmcv_6c45e3be4f10446ab007e2200669cde5/mmcv/ops/csrc/common/pytorch_cpp_helper.hpp:3,
                       from ./mmcv/ops/csrc/pytorch/active_rotated_filter.cpp:5:
      /opt/conda/lib/python3.10/site-packages/torch/include/c10/util/irange.h: In member function ‘bool c10::detail::integer_iterator<I, one_sided, <anonymous> >::operator==(const c10::detail::integer_iterator<I, one_sided, <anonymous> >&) const’:
      /opt/conda/lib/python3.10/site-packages/torch/include/c10/util/irange.h:50:8: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’
         50 |     if constexpr (one_sided) {
            |        ^~~~~~~~~
      In file included from /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/ivalue.h:1499,
                       from /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/List_inl.h:4,
                       from /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/List.h:490,
                       from /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/IListRef_inl.h:3,
                       from /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/IListRef.h:632,
                       from /opt/conda/lib/python3.10/site-packages/torch/include/ATen/DeviceGuard.h:3,
                       from /opt/conda/lib/python3.10/site-packages/torch/include/ATen/ATen.h:9,
                       from /opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
                       from /tmp/pip-install-jwtqb6o0/mmcv_6c45e3be4f10446ab007e2200669cde5/mmcv/ops/csrc/common/pytorch_cpp_helper.hpp:3,
                       from ./mmcv/ops/csrc/pytorch/active_rotated_filter.cpp:5:
      /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/ivalue_inl.h: In lambda function:
      /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/ivalue_inl.h:1061:12: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’
       1061 |         if constexpr (::std::is_convertible_v<typename c10::invoke_result_t<T &&, Future&>, IValueWithStorages>) {
            |            ^~~~~~~~~
      /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/ivalue_inl.h:1061:30: error: ‘is_convertible_v’ is not a member of ‘std’; did you mean ‘is_convertible’?
       1061 |         if constexpr (::std::is_convertible_v<typename c10::invoke_result_t<T &&, Future&>, IValueWithStorages>) {
            |                              ^~~~~~~~~~~~~~~~
            |                              is_convertible
      /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/ivalue_inl.h:1061:91: error: expected ‘(’ before ‘,’ token
       1061 |         if constexpr (::std::is_convertible_v<typename c10::invoke_result_t<T &&, Future&>, IValueWithStorages>) {
            |                                                                                           ^
      /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/ivalue_inl.h:1061:111: error: expected primary-expression before ‘>’ token
       1061 |         if constexpr (::std::is_convertible_v<typename c10::invoke_result_t<T &&, Future&>, IValueWithStorages>) {
            |                                                                                                               ^
      /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/ivalue_inl.h:1061:112: error: expected primary-expression before ‘)’ token
       1061 |         if constexpr (::std::is_convertible_v<typename c10::invoke_result_t<T &&, Future&>, IValueWithStorages>) {
            |                                                                                                                ^
      /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/ivalue_inl.h:1062:16: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’
       1062 |           auto [ivalue, storages] = cb(parentFut);
            |                ^
      In file included from /opt/conda/lib/python3.10/site-packages/torch/include/ATen/ATen.h:11,
                       from /opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
                       from /tmp/pip-install-jwtqb6o0/mmcv_6c45e3be4f10446ab007e2200669cde5/mmcv/ops/csrc/common/pytorch_cpp_helper.hpp:3,
                       from ./mmcv/ops/csrc/pytorch/active_rotated_filter.cpp:5:
      /opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/detail/TensorDataContainer.h: In lambda function:
      /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:56:8: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’
         56 |     if constexpr (!at::should_include_kernel_dtype(   \
            |        ^~~~~~~~~
      /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:221:7: note: in definition of macro ‘AT_DISPATCH_SWITCH’
        221 |       __VA_ARGS__                                                           \
            |       ^~~~~~~~~~~
      /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:68:5: note: in expansion of macro ‘AT_PRIVATE_CHECK_SELECTIVE_BUILD’
         68 |     AT_PRIVATE_CHECK_SELECTIVE_BUILD(enum_type);                        \
            |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:74:3: note: in expansion of macro ‘AT_PRIVATE_CASE_TYPE_USING_HINT’
         74 |   AT_PRIVATE_CASE_TYPE_USING_HINT(enum_type, scalar_t, __VA_ARGS__)
            |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:391:3: note: in expansion of macro ‘AT_DISPATCH_CASE’
        391 |   AT_DISPATCH_CASE(at::ScalarType::Byte, __VA_ARGS__) \
            |   ^~~~~~~~~~~~~~~~
      /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:411:3: note: in expansion of macro ‘AT_DISPATCH_CASE_INTEGRAL_TYPES’
        411 |   AT_DISPATCH_CASE_INTEGRAL_TYPES(__VA_ARGS__) \
            |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:514:3: note: in expansion of macro ‘AT_DISPATCH_CASE_ALL_TYPES’
        514 |   AT_DISPATCH_CASE_ALL_TYPES(__VA_ARGS__)       \
            |   ^~~~~~~~~~~~~~~~~~~~~~~~~~
      /opt/conda/lib/python3.10/site-packages/torch/include/ATen/Dispatch.h:524:7: note: in expansion of macro ‘AT_DISPATCH_CASE_ALL_TYPES_AND3’
        524 |       AT_DISPATCH_CASE_ALL_TYPES_AND3(                      \
            |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/detail/TensorDataContainer.h:287:7: note: in expansion of macro ‘AT_DISPATCH_ALL_TYPES_AND3’
        287 |       AT_DISPATCH_ALL_TYPES_AND3(
            |       ^~~~~~~~~~~~~~~~~~~~~~~~~~
      ........ TRUNCATED ........
      In file included from /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/boxing/KernelFunction_impl.h:1,
                       from /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/boxing/KernelFunction.h:251,
                       from /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/dispatch/Dispatcher.h:4,
                       from /opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/types.h:12,
                       from /tmp/pip-install-jwtqb6o0/mmcv_6c45e3be4f10446ab007e2200669cde5/mmcv/ops/csrc/common/pytorch_cpp_helper.hpp:3,
                       from ./mmcv/ops/csrc/pytorch/active_rotated_filter.cpp:5:
      /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/boxing/impl/boxing.h: In static member function ‘static Result c10::impl::BoxedKernelWrapper<Result(Args ...), typename std::enable_if<((c10::guts::conjunction<c10::guts::disjunction<std::is_constructible<c10::IValue, typename std::decay<Args>::type>, std::is_same<c10::TensorOptions, typename std::decay<Args>::type> >...>::value && c10::guts::conjunction<c10::guts::disjunction<c10::impl::has_ivalue_to<T, void>, std::is_same<void, T> >, c10::guts::negation<std::is_lvalue_reference<_Tp> > >::value) && (! c10::impl::is_tuple_of_mutable_tensor_refs<Result>::value)), void>::type>::call(const c10::BoxedKernel&, const c10::OperatorHandle&, c10::DispatchKeySet, Args ...)’:
      /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/boxing/impl/boxing.h:229:8: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’
        229 |     if constexpr (!std::is_same_v<void, Result>) {
            |        ^~~~~~~~~
      /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/boxing/impl/boxing.h:229:25: error: ‘is_same_v’ is not a member of ‘std’; did you mean ‘is_same’?
        229 |     if constexpr (!std::is_same_v<void, Result>) {
            |                         ^~~~~~~~~
            |                         is_same
      /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/boxing/impl/boxing.h:229:35: error: expected primary-expression before ‘void’
        229 |     if constexpr (!std::is_same_v<void, Result>) {
            |                                   ^~~~
      /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/boxing/impl/boxing.h:229:34: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
        229 |     if constexpr (!std::is_same_v<void, Result>) {
            |                                  ^
      /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/boxing/impl/boxing.h:229:35: error: expected ‘)’ before ‘void’
        229 |     if constexpr (!std::is_same_v<void, Result>) {
            |                                   ^~~~
      /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/boxing/impl/boxing.h:229:18: note: to match this ‘(’
        229 |     if constexpr (!std::is_same_v<void, Result>) {
            |                  ^
      In file included from /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/boxing/KernelFunction_impl.h:2,
                       from /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/boxing/KernelFunction.h:251,
                       from /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/dispatch/Dispatcher.h:4,
                       from /opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/types.h:12,
                       from /tmp/pip-install-jwtqb6o0/mmcv_6c45e3be4f10446ab007e2200669cde5/mmcv/ops/csrc/common/pytorch_cpp_helper.hpp:3,
                       from ./mmcv/ops/csrc/pytorch/active_rotated_filter.cpp:5:
      /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/boxing/impl/make_boxed_from_unboxed_functor.h: In constructor ‘c10::impl::assert_is_valid_input_type<T, AllowDeprecatedTypes, Enable>::assert_is_valid_input_type()’:
      /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/boxing/impl/make_boxed_from_unboxed_functor.h:109:10: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’
        109 |       if constexpr (guts::typelist::contains<supported_primitive_arg_types, T>::value) {
            |          ^~~~~~~~~
      In file included from /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/boxing/KernelFunction_impl.h:2,
                       from /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/boxing/KernelFunction.h:251,
                       from /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/dispatch/Dispatcher.h:4,
                       from /opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/types.h:12,
                       from /tmp/pip-install-jwtqb6o0/mmcv_6c45e3be4f10446ab007e2200669cde5/mmcv/ops/csrc/common/pytorch_cpp_helper.hpp:3,
                       from ./mmcv/ops/csrc/pytorch/active_rotated_filter.cpp:5:
      /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/boxing/impl/make_boxed_from_unboxed_functor.h: In constructor ‘c10::impl::assert_is_valid_output_type<T, AllowDeprecatedTypes, Enable>::assert_is_valid_output_type()’:
      /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/boxing/impl/make_boxed_from_unboxed_functor.h:215:10: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’
        215 |       if constexpr(guts::typelist::contains<supported_primitive_arg_types, T>::value) {
            |          ^~~~~~~~~
      /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/boxing/impl/make_boxed_from_unboxed_functor.h: In static member function ‘static void c10::impl::make_boxed_from_unboxed_functor<KernelFunctor, AllowDeprecatedTypes>::call(c10::OperatorKernel*, const c10::OperatorHandle&, c10::DispatchKeySet, c10::Stack*)’:
      /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/boxing/impl/make_boxed_from_unboxed_functor.h:575:10: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’
        575 |       if constexpr (has_outputs) {
            |          ^~~~~~~~~
      In file included from /opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include/torch/types.h:12,
                       from /tmp/pip-install-jwtqb6o0/mmcv_6c45e3be4f10446ab007e2200669cde5/mmcv/ops/csrc/common/pytorch_cpp_helper.hpp:3,
                       from ./mmcv/ops/csrc/pytorch/active_rotated_filter.cpp:5:
      /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/dispatch/Dispatcher.h: In static member function ‘static Return c10::Dispatcher::callWithDispatchKeySlowPath(const c10::TypedOperatorHandle<Return(Args ...)>&, at::StepCallbacks&, c10::DispatchKeySet, const c10::KernelFunction&, Args ...)’:
      /opt/conda/lib/python3.10/site-packages/torch/include/ATen/core/dispatch/Dispatcher.h:597:6: warning: ‘if constexpr’ only available with ‘-std=c++17’ or ‘-std=gnu++17’
        597 |   if constexpr (num_boxed_args != 0) {
            |      ^~~~~~~~~
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

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

Additional information

No response

zhouzaida commented 9 months ago

The solution is as follows:

pip uninstall mmpretrain mmcv
pip install mmpretrain

The reason for this issue:

JavierYepez commented 9 months ago

@zhouzaida Thank you from your response. I didn't work.

I want to install mmcv and mmpretrain for PyTorch 2.1.0. Every time I try it fails to build the wheel with the with the error mentioned above or this one:

copying mmcv/ops/csrc/pytorch/npu/roi_align_npu.cpp -> build/lib.linux-aarch64-cpython-310/mmcv/ops/csrc/pytorch/npu
      copying mmcv/ops/csrc/pytorch/npu/roi_pool_npu.cpp -> build/lib.linux-aarch64-cpython-310/mmcv/ops/csrc/pytorch/npu
      copying mmcv/ops/csrc/pytorch/npu/voxelization_npu.cpp -> build/lib.linux-aarch64-cpython-310/mmcv/ops/csrc/pytorch/npu
      running build_ext
      building 'mmcv._ext' extension
      creating build/temp.linux-aarch64-cpython-310
      creating build/temp.linux-aarch64-cpython-310/mmcv
      creating build/temp.linux-aarch64-cpython-310/mmcv/ops
      creating build/temp.linux-aarch64-cpython-310/mmcv/ops/csrc
      creating build/temp.linux-aarch64-cpython-310/mmcv/ops/csrc/pytorch
      creating build/temp.linux-aarch64-cpython-310/mmcv/ops/csrc/pytorch/cpu
      gcc -pthread -B /opt/conda/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O3 -Wall -fPIC -O3 -isystem /opt/conda/include -fPIC -O3 -isystem /opt/conda/include -fPIC -I/tmp/pip-install-c1c08ngz/mmcv_8d1ad2d9eab94598936e64bb7bd8b284/mmcv/ops/csrc/common -I/opt/conda/lib/python3.10/site-packages/torch/include -I/opt/conda/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -I/opt/conda/lib/python3.10/site-packages/torch/include/TH -I/opt/conda/lib/python3.10/site-packages/torch/include/THC -I/opt/conda/include/python3.10 -c ./mmcv/ops/csrc/pytorch/active_rotated_filter.cpp -o build/temp.linux-aarch64-cpython-310/./mmcv/ops/csrc/pytorch/active_rotated_filter.o -std=c++17 -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1017\" -DTORCH_EXTENSION_NAME=_ext -D_GLIBCXX_USE_CXX11_ABI=1
      In file included from ./mmcv/ops/csrc/pytorch/active_rotated_filter.cpp:5:
      /tmp/pip-install-c1c08ngz/mmcv_8d1ad2d9eab94598936e64bb7bd8b284/mmcv/ops/csrc/common/pytorch_cpp_helper.hpp:3:10: fatal error: torch/types.h: No such file or directory
          3 | #include <torch/types.h>
            |          ^~~~~~~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/gcc' failed with exit code 1
      [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
HoshiMeisa commented 9 months ago

@JavierYepez I had the same issue, but I solved it by rolling back the mmcv version to 1.7.3. You can also try mmcv 1.7.3 with PyTorch 2.1.0.

leo917 commented 8 months ago

可以试试 torch==2.0.0 配合mmcv 2.0.1,有whl

ywfwyht commented 7 months ago

@JavierYepez I had the same issue, but I solved it by rolling back the mmcv version to 1.7.3. You can also try mmcv 1.7.3 with PyTorch 2.1.0. @HoshiMeisa @JavierYepez Hi, guys ! You can use openmim install mmcv, or download it offline https://download.openmmlab.com/mmcv/dist/cu121/torch2.1.0/index.html

xiaoliliu99 commented 7 months ago

Hi Javier, have you tried to install Microsoft C++ Build Tools(https://visualstudio.microsoft.com/visual-cpp-build-tools/) first? I met the same problem as you and after doing that, it worked.

JavierYepez commented 7 months ago

@xiaoliliu99 I am not using Windows but thank you for your suggestion

ziwaka99 commented 5 months ago

https://mmcv.readthedocs.io/en/latest/get_started/installation.html 微信截图_20240610164214 This website can provide the right version