MMCV(2.1.0)错误:ModuleNotFoundError:没有名为“mmcv._ext”的模块

问题描述 投票:0回答:1

在 Conda 环境中运行 Python 3.10。

尝试通过

pip install mmcv
mim install mmcv
安装 mmcv,两者都会产生相同的错误。

遵循此处的说明:https://mmcv.readthedocs.io/en/latest/faq.html?highlight=mmcv._ext 但 mmcv-full 只能工作到 mmcv 1.7,我需要 >2.0.0

完整错误:

  File "/Users/andrewmccalister/Documents/segmentTool/FoodSeg103/demo/deployments/image_demo_deployment/updated_source_mb.py", line 14, in <module>
    from mmseg.apis import inference_model, init_model, show_result_pyplot
  File "/Users/andrewmccalister/miniconda3/envs/py_3.10/lib/python3.10/site-packages/mmseg/apis/__init__.py", line 2, in <module>
    from .inference import inference_model, init_model, show_result_pyplot
  File "/Users/andrewmccalister/miniconda3/envs/py_3.10/lib/python3.10/site-packages/mmseg/apis/inference.py", line 14, in <module>
    from mmseg.models import BaseSegmentor
  File "/Users/andrewmccalister/miniconda3/envs/py_3.10/lib/python3.10/site-packages/mmseg/models/__init__.py", line 3, in <module>
    from .backbones import *  # noqa: F401,F403
  File "/Users/andrewmccalister/miniconda3/envs/py_3.10/lib/python3.10/site-packages/mmseg/models/backbones/__init__.py", line 2, in <module>
    from .beit import BEiT
  File "/Users/andrewmccalister/miniconda3/envs/py_3.10/lib/python3.10/site-packages/mmseg/models/backbones/beit.py", line 19, in <module>
    from ..utils import PatchEmbed
  File "/Users/andrewmccalister/miniconda3/envs/py_3.10/lib/python3.10/site-packages/mmseg/models/utils/__init__.py", line 2, in <module>
    from .basic_block import BasicBlock, Bottleneck
  File "/Users/andrewmccalister/miniconda3/envs/py_3.10/lib/python3.10/site-packages/mmseg/models/utils/basic_block.py", line 10, in <module>
    from mmseg.utils import OptConfigType
  File "/Users/andrewmccalister/miniconda3/envs/py_3.10/lib/python3.10/site-packages/mmseg/utils/__init__.py", line 24, in <module>
    from .mask_classification import MatchMasks, seg_data_to_instance_data
  File "/Users/andrewmccalister/miniconda3/envs/py_3.10/lib/python3.10/site-packages/mmseg/utils/mask_classification.py", line 5, in <module>
    from mmcv.ops import point_sample
  File "/Users/andrewmccalister/miniconda3/envs/py_3.10/lib/python3.10/site-packages/mmcv/ops/__init__.py", line 3, in <module>
    from .active_rotated_filter import active_rotated_filter
  File "/Users/andrewmccalister/miniconda3/envs/py_3.10/lib/python3.10/site-packages/mmcv/ops/active_rotated_filter.py", line 10, in <module>
    ext_module = ext_loader.load_ext(
  File "/Users/andrewmccalister/miniconda3/envs/py_3.10/lib/python3.10/site-packages/mmcv/utils/ext_loader.py", line 13, in load_ext
    ext = importlib.import_module('mmcv.' + name)
  File "/Users/andrewmccalister/miniconda3/envs/py_3.10/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named 'mmcv._ext'```
python-3.10 openmmlab
1个回答
0
投票

可能有点晚了,但我也遇到了同样的问题。

由于某种原因,推荐的方法给我带来了问题,但当我弄清楚我想要的 PyTorch 和 CUDA 版本并直接使用 pip 安装匹配的轮子时,它总是对我有用。 例如。对于 CUDA 版本 11.7 和 PyTorch 2,命令将是:

pip install mmcv==2.0.1 -f https://download.openmmlab.com/mmcv/dist/cu117/torch2.0/index.html
.

您必须尝试查找是否存在您所需版本的构建。

© www.soinside.com 2019 - 2024. All rights reserved.