open-mmlab / mmcv

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

[Bug] can not install mmcv-full==1.4.7 in torch1.13.1 cuda11.7 #3134

Open zhipeixu opened 4 months ago

zhipeixu commented 4 months ago

Prerequisite

Environment

'sys.platform': 'linux', 
'Python': '3.10.14 (main, May  6 2024, 19:42:50) [GCC 11.2.0]',
'CUDA available': True, 'GPU 0,1,2,3,4,5,6,7': 'NVIDIA A100-PCIE-40GB',
'NVCC': 'Build cuda_11.6.r11.6/compiler.31057947_0',
'GCC': 'gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0', 
'PyTorch': '1.13.1+cu117', 'PyTorch compiling details': 'PyTorch built with:\n  - GCC 9.3\n  - C++ Version: 201402\n 

Reproduces the problem - code sample

I'm trying to create the python environment required for this project: https://github.com/mbzuai-oryx/groundingLMM/blob/main/docs/install.md I started from scratch, followed every step, and ran successfully until I ran MMCV_WITH_OPS=1 pip install -e. and the error message occurred

Reproduces the problem - command or script

conda create --name=glamm python=3.10 conda activate glamm

git clone https://github.com/mbzuai-oryx/groundingLMM.git cd groundingLMM pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 --extra-index-url https://download.pytorch.org/whl/cu117 pip install -r requirements.txt

Install mmcv

git clone https://github.com/open-mmlab/mmcv cd mmcv git checkout v1.4.7 MMCV_WITH_OPS=1 pip install -e .

Reproduces the problem - error message

    /workspace/groundingLMM/mmcv/mmcv/ops/csrc/pytorch/cpu/sparse_indice.cpp:81:1:   required from here
    /workspace/groundingLMM/mmcv/mmcv/ops/csrc/common/utils/spconv/spconv/geometry.h:39:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for (int i = 0; i < NDim; ++i) {
                       ~~^~~~~~
    /workspace/groundingLMM/mmcv/mmcv/ops/csrc/common/utils/spconv/spconv/geometry.h:53:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for (int i = 0; i < NDim; ++i) {
                       ~~^~~~~~
    /workspace/groundingLMM/mmcv/mmcv/ops/csrc/common/utils/spconv/spconv/geometry.h: In instantiation of ‘Index getValidOutPosTranspose(const Index*, const Index*, const Index*, const Index*, const Index*, const Index*, Index*) [with Index = long int; unsigned int NDim = 3]’:
    /workspace/groundingLMM/mmcv/mmcv/ops/csrc/common/utils/spconv/spconv/geometry.h:222:58:   required from ‘Index getIndicePairsDeConv(tv::TensorView<const scalar_t>, tv::TensorView<scalar_t>, tv::TensorView<IndexGrid>, tv::TensorView<scalar_t>, tv::TensorView<scalar_t>, const Index*, const Index*, const Index*, const Index*, const Index*) [with Index = long int; IndexGrid = int; unsigned int NDim = 3]’
    /workspace/groundingLMM/mmcv/mmcv/ops/csrc/pytorch/cpu/sparse_indice.cpp:36:58:   required from ‘Index functor::CreateConvIndicePairFunctor<tv::CPU, Index, IndexGrid, NDim>::operator()(const tv::CPU&, tv::TensorView<const scalar_t>, tv::TensorView<scalar_t>, tv::TensorView<IndexGrid>, tv::TensorView<scalar_t>, tv::TensorView<scalar_t>, tv::SimpleVector<Index, NDim>, tv::SimpleVector<Index, NDim>, tv::SimpleVector<Index, NDim>, tv::SimpleVector<Index, NDim>, tv::SimpleVector<Index, NDim>, bool, bool) [with Index = long int; IndexGrid = int; unsigned int NDim = 3]’
    /workspace/groundingLMM/mmcv/mmcv/ops/csrc/pytorch/cpu/sparse_indice.cpp:81:1:   required from here
    /workspace/groundingLMM/mmcv/mmcv/ops/csrc/common/utils/spconv/spconv/geometry.h:101:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for (int i = 0; i < NDim; ++i) {
                       ~~^~~~~~
    /workspace/groundingLMM/mmcv/mmcv/ops/csrc/common/utils/spconv/spconv/geometry.h:111:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for (int i = 0; i < NDim; ++i) {
                       ~~^~~~~~
    /workspace/groundingLMM/mmcv/mmcv/ops/csrc/common/utils/spconv/spconv/geometry.h: In instantiation of ‘Index getValidOutPos(const Index*, const Index*, const Index*, const Index*, const Index*, const Index*, Index*) [with Index = long int; unsigned int NDim = 3]’:
    /workspace/groundingLMM/mmcv/mmcv/ops/csrc/common/utils/spconv/spconv/geometry.h:171:49:   required from ‘Index getIndicePairsConv(tv::TensorView<const scalar_t>, tv::TensorView<scalar_t>, tv::TensorView<IndexGrid>, tv::TensorView<scalar_t>, tv::TensorView<scalar_t>, const Index*, const Index*, const Index*, const Index*, const Index*) [with Index = long int; IndexGrid = int; unsigned int NDim = 3]’
    /workspace/groundingLMM/mmcv/mmcv/ops/csrc/pytorch/cpu/sparse_indice.cpp:41:56:   required from ‘Index functor::CreateConvIndicePairFunctor<tv::CPU, Index, IndexGrid, NDim>::operator()(const tv::CPU&, tv::TensorView<const scalar_t>, tv::TensorView<scalar_t>, tv::TensorView<IndexGrid>, tv::TensorView<scalar_t>, tv::TensorView<scalar_t>, tv::SimpleVector<Index, NDim>, tv::SimpleVector<Index, NDim>, tv::SimpleVector<Index, NDim>, tv::SimpleVector<Index, NDim>, tv::SimpleVector<Index, NDim>, bool, bool) [with Index = long int; IndexGrid = int; unsigned int NDim = 3]’
    /workspace/groundingLMM/mmcv/mmcv/ops/csrc/pytorch/cpu/sparse_indice.cpp:81:1:   required from here
    /workspace/groundingLMM/mmcv/mmcv/ops/csrc/common/utils/spconv/spconv/geometry.h:39:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for (int i = 0; i < NDim; ++i) {
                       ~~^~~~~~
    /workspace/groundingLMM/mmcv/mmcv/ops/csrc/common/utils/spconv/spconv/geometry.h:53:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for (int i = 0; i < NDim; ++i) {
                       ~~^~~~~~
    /workspace/groundingLMM/mmcv/mmcv/ops/csrc/common/utils/spconv/spconv/geometry.h: In instantiation of ‘Index getValidOutPosTranspose(const Index*, const Index*, const Index*, const Index*, const Index*, const Index*, Index*) [with Index = long int; unsigned int NDim = 4]’:
    /workspace/groundingLMM/mmcv/mmcv/ops/csrc/common/utils/spconv/spconv/geometry.h:222:58:   required from ‘Index getIndicePairsDeConv(tv::TensorView<const scalar_t>, tv::TensorView<scalar_t>, tv::TensorView<IndexGrid>, tv::TensorView<scalar_t>, tv::TensorView<scalar_t>, const Index*, const Index*, const Index*, const Index*, const Index*) [with Index = long int; IndexGrid = int; unsigned int NDim = 4]’
    /workspace/groundingLMM/mmcv/mmcv/ops/csrc/pytorch/cpu/sparse_indice.cpp:36:58:   required from ‘Index functor::CreateConvIndicePairFunctor<tv::CPU, Index, IndexGrid, NDim>::operator()(const tv::CPU&, tv::TensorView<const scalar_t>, tv::TensorView<scalar_t>, tv::TensorView<IndexGrid>, tv::TensorView<scalar_t>, tv::TensorView<scalar_t>, tv::SimpleVector<Index, NDim>, tv::SimpleVector<Index, NDim>, tv::SimpleVector<Index, NDim>, tv::SimpleVector<Index, NDim>, tv::SimpleVector<Index, NDim>, bool, bool) [with Index = long int; IndexGrid = int; unsigned int NDim = 4]’
    /workspace/groundingLMM/mmcv/mmcv/ops/csrc/pytorch/cpu/sparse_indice.cpp:81:1:   required from here
    /workspace/groundingLMM/mmcv/mmcv/ops/csrc/common/utils/spconv/spconv/geometry.h:101:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for (int i = 0; i < NDim; ++i) {
                       ~~^~~~~~
    /workspace/groundingLMM/mmcv/mmcv/ops/csrc/common/utils/spconv/spconv/geometry.h:111:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for (int i = 0; i < NDim; ++i) {
                       ~~^~~~~~
    /workspace/groundingLMM/mmcv/mmcv/ops/csrc/common/utils/spconv/spconv/geometry.h: In instantiation of ‘Index getValidOutPos(const Index*, const Index*, const Index*, const Index*, const Index*, const Index*, Index*) [with Index = long int; unsigned int NDim = 4]’:
    /workspace/groundingLMM/mmcv/mmcv/ops/csrc/common/utils/spconv/spconv/geometry.h:171:49:   required from ‘Index getIndicePairsConv(tv::TensorView<const scalar_t>, tv::TensorView<scalar_t>, tv::TensorView<IndexGrid>, tv::TensorView<scalar_t>, tv::TensorView<scalar_t>, const Index*, const Index*, const Index*, const Index*, const Index*) [with Index = long int; IndexGrid = int; unsigned int NDim = 4]’
    /workspace/groundingLMM/mmcv/mmcv/ops/csrc/pytorch/cpu/sparse_indice.cpp:41:56:   required from ‘Index functor::CreateConvIndicePairFunctor<tv::CPU, Index, IndexGrid, NDim>::operator()(const tv::CPU&, tv::TensorView<const scalar_t>, tv::TensorView<scalar_t>, tv::TensorView<IndexGrid>, tv::TensorView<scalar_t>, tv::TensorView<scalar_t>, tv::SimpleVector<Index, NDim>, tv::SimpleVector<Index, NDim>, tv::SimpleVector<Index, NDim>, tv::SimpleVector<Index, NDim>, tv::SimpleVector<Index, NDim>, bool, bool) [with Index = long int; IndexGrid = int; unsigned int NDim = 4]’
    /workspace/groundingLMM/mmcv/mmcv/ops/csrc/pytorch/cpu/sparse_indice.cpp:81:1:   required from here
    /workspace/groundingLMM/mmcv/mmcv/ops/csrc/common/utils/spconv/spconv/geometry.h:39:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for (int i = 0; i < NDim; ++i) {
                       ~~^~~~~~
    /workspace/groundingLMM/mmcv/mmcv/ops/csrc/common/utils/spconv/spconv/geometry.h:53:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for (int i = 0; i < NDim; ++i) {
                       ~~^~~~~~
    ninja: build stopped: subcommand failed.
    Traceback (most recent call last):
      File "/root/miniconda3/envs/glamm/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1900, in _run_ninja_build
        subprocess.run(
      File "/root/miniconda3/envs/glamm/lib/python3.10/subprocess.py", line 526, in run
        raise CalledProcessError(retcode, process.args,
    subprocess.CalledProcessError: Command '['ninja', '-v', '-j', '79']' returned non-zero exit status 1.

    The above exception was the direct cause of the following exception:

    Traceback (most recent call last):
      File "<string>", line 2, in <module>
      File "<pip-setuptools-caller>", line 34, in <module>
      File "/workspace/groundingLMM/mmcv/setup.py", line 391, in <module>
        setup(
      File "/root/miniconda3/envs/glamm/lib/python3.10/site-packages/setuptools/__init__.py", line 155, in setup
        return distutils.core.setup(**attrs)
      File "/root/miniconda3/envs/glamm/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 148, in setup
        return run_commands(dist)
      File "/root/miniconda3/envs/glamm/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 163, in run_commands
        dist.run_commands()
      File "/root/miniconda3/envs/glamm/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 967, in run_commands
        self.run_command(cmd)
      File "/root/miniconda3/envs/glamm/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
        cmd_obj.run()
      File "/root/miniconda3/envs/glamm/lib/python3.10/site-packages/setuptools/command/develop.py", line 34, in run
        self.install_for_development()
      File "/root/miniconda3/envs/glamm/lib/python3.10/site-packages/setuptools/command/develop.py", line 114, in install_for_development
        self.run_command('build_ext')
      File "/root/miniconda3/envs/glamm/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/root/miniconda3/envs/glamm/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
        cmd_obj.run()
      File "/root/miniconda3/envs/glamm/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 79, in run
        _build_ext.run(self)
      File "/root/miniconda3/envs/glamm/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 339, in run
        self.build_extensions()
      File "/root/miniconda3/envs/glamm/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 843, in build_extensions
        build_ext.build_extensions(self)
      File "/root/miniconda3/envs/glamm/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 448, in build_extensions
        self._build_extensions_serial()
      File "/root/miniconda3/envs/glamm/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 473, in _build_extensions_serial
        self.build_extension(ext)
      File "/root/miniconda3/envs/glamm/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 202, in build_extension
        _build_ext.build_extension(self, ext)
      File "/root/miniconda3/envs/glamm/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 528, in build_extension
        objects = self.compiler.compile(sources,
      File "/root/miniconda3/envs/glamm/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 658, in unix_wrap_ninja_compile
        _write_ninja_file_and_compile_objects(
      File "/root/miniconda3/envs/glamm/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1573, in _write_ninja_file_and_compile_objects
        _run_ninja_build(
      File "/root/miniconda3/envs/glamm/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1916, 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.

Additional information

I also tried to install using pip install mmcv-full==1.4.7, but all failed

suikei-wang commented 3 months ago

I am also looking for the way to install v1.4.7 for GLaMM, however it is always failed. Here's my env: NVIDIA V100, CUDA 12.2, torch 2.3.1+cu121. All current resources are failed in my case. It will stuck at either Building wheel for mmcv-full (setup.py) ... error or failed at pip install way.