본문 바로가기

트러블슈팅

no module named 'mmcv'

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


출처: https://eehoeskrap.tistory.com/768 [Enough is not enough:티스토리]

 

mmcv를 설치하고 진행하는데 아래 에러가 나옴... 

해결방법을 알아가는중..

In file included from /home/jwjang/project/hsi/DOFA/dofaenv/lib/python3.8/site-packages/torch/include/torch/csrc/Device.h:4,
                     from /home/jwjang/project/hsi/DOFA/dofaenv/lib/python3.8/site-packages/torch/include/torch/csrc/api/include/torch/python.h:8,
                     from /home/jwjang/project/hsi/DOFA/dofaenv/lib/python3.8/site-packages/torch/include/torch/extension.h:9,
                     from ./mmcv/ops/csrc/pytorch/pybind.cpp:2:
    /home/jwjang/project/hsi/DOFA/dofaenv/lib/python3.8/site-packages/torch/include/torch/csrc/python_headers.h:12:10: fatal error: Python.h: No such file or directory
       12 | #include <Python.h>
          |          ^~~~~~~~~~
    compilation terminated.
    /home/jwjang/project/hsi/DOFA/downstream_tasks/hyperspectral-finetuning/mmcv/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
    /home/jwjang/project/hsi/DOFA/dofaenv/lib/python3.8/site-packages/setuptools/command/develop.py:41: EasyInstallDeprecationWarning: easy_install command is deprecated.
    !!

            ********************************************************************************
            Please avoid running ``setup.py`` and ``easy_install``.
            Instead, use pypa/build, pypa/installer or other
            standards-based tools.

            See https://github.com/pypa/setuptools/issues/917 for details.
            ********************************************************************************

    !!
      easy_install.initialize_options(self)
    /home/jwjang/project/hsi/DOFA/dofaenv/lib/python3.8/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
    !!

            ********************************************************************************
            Please avoid running ``setup.py`` directly.
            Instead, use pypa/build, pypa/installer or other
            standards-based tools.

            See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
            ********************************************************************************

    !!
      self.initialize_options()
    /home/jwjang/project/hsi/DOFA/dofaenv/lib/python3.8/site-packages/torch/utils/cpp_extension.py:495: 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.'))
    /home/jwjang/project/hsi/DOFA/dofaenv/lib/python3.8/site-packages/torch/utils/cpp_extension.py:424: UserWarning: There are no x86_64-linux-gnu-g++ version bounds defined for CUDA version 12.1
      warnings.warn(f'There are no {compiler_name} version bounds defined for CUDA version {cuda_str_version}')
    /home/jwjang/project/hsi/DOFA/dofaenv/lib/python3.8/site-packages/torch/utils/cpp_extension.py:1965: UserWarning: TORCH_CUDA_ARCH_LIST is not set, all archs for visible cards are included for compilation.
    If this is not desired, please set os.environ['TORCH_CUDA_ARCH_LIST'].
      warnings.warn(
    error: command '/usr/bin/x86_64-linux-gnu-g++' failed with exit code 1
    [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.