open-mmlab / mmsegmentation

OpenMMLab Semantic Segmentation Toolbox and Benchmark.
https://mmsegmentation.readthedocs.io/en/main/
Apache License 2.0
8.03k stars 2.58k forks source link

mmcv._ext error #3563

Open timucinbulmus opened 7 months ago

timucinbulmus commented 7 months ago

I have been working on setting environment with previous version of mmcv and I always get the same error. I have tried different version of pytorch, cuda and more however i couldnt solve the problem. Below, you can find error output and all the packages with the versions.

C:\Users\pc\miniconda3\envs\openmmlab\python.exe C:\Users\pc\PycharmProjects\mmsegmentation-main\train.py Traceback (most recent call last): File "C:\Users\pc\PycharmProjects\mmsegmentation-main\train.py", line 13, in from mmseg.apis import set_random_seed, train_segmentor File "C:\Users\pc\PycharmProjects\mmsegmentation-main\mmseg\apis__init.py", line 1, in from .inference import inference_segmentor, init_segmentor, show_result_pyplot File "C:\Users\pc\PycharmProjects\mmsegmentation-main\mmseg\apis\inference.py", line 8, in from mmseg.models import build_segmentor File "C:\Users\pc\PycharmProjects\mmsegmentation-main\mmseg\models__init.py", line 1, in from .backbones import * # noqa: F401,F403 File "C:\Users\pc\PycharmProjects\mmsegmentation-main\mmseg\models\backbones__init__.py", line 2, in from .fast_scnn import FastSCNN File "C:\Users\pc\PycharmProjects\mmsegmentation-main\mmseg\models\backbones\fast_scnn.py", line 7, in from mmseg.models.decode_heads.psp_head import PPM File "C:\Users\pc\PycharmProjects\mmsegmentation-main\mmseg\models\decode_heads\init.py", line 16, in from .point_head import PointHead File "C:\Users\pc\PycharmProjects\mmsegmentation-main\mmseg\models\decode_heads\point_head.py", line 6, in from mmcv.ops import point_sample File "C:\Users\pc\miniconda3\envs\openmmlab\lib\site-packages\mmcv\ops\init__.py", line 1, in from .bbox import bbox_overlaps File "C:\Users\pc\miniconda3\envs\openmmlab\lib\site-packages\mmcv\ops\bbox.py", line 3, in ext_module = ext_loader.load_ext('_ext', ['bbox_overlaps']) File "C:\Users\pc\miniconda3\envs\openmmlab\lib\site-packages\mmcv\utils\ext_loader.py", line 11, in load_ext ext = importlib.import_module('mmcv.' + name) File "C:\Users\pc\miniconda3\envs\openmmlab\lib\importlib\init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) ModuleNotFoundError: No module named 'mmcv._ext'

jacksteussie commented 6 months ago

I found that just using pip to install all of the packages was what I needed. No need to use mim. This is what I ran in my docker file

RUN pip install openmim
RUN mim install "mmcv>=2.0.0"
RUN pip install "mmsegmentation>=1.0.0"

and then just make sure you initialize all of your modules properly in the init.py files and what not

AugChiang commented 5 months ago

@timucinbulmus Hi mate, have you solved the problem? Ive encountered the same issues even though trying different of versions using pip install or mim install whatever.

timucinbulmus commented 4 months ago

@timucinbulmus Hi mate, have you solved the problem? Ive encountered the same issues even though trying different of versions using pip install or mim install whatever.

Hi, I have not solved it and don't understand why it happens. I will give the solution as soon as I figured it out.

aakgun commented 3 months ago

Hi,

Any body have solution for mmcv._ext error..

I have been using previous mmvc version like 1.2.4 version for some specific github codes. Swin_Transformer_Segmentation but those are supoored by previous mmcv version like 1.24 ,

But those ones asks for mmcv.ext error which is related with later solutions i guess.

I coul not have a solution for this error.

Any help appreciated.

anhphan2705 commented 3 months ago

I am also having the same problem. I have also tried using pip install mmcv-full like the past resolved issue suggested. However, mmcv-full is no longer suppoted.

anhphan2705 commented 3 months ago

I have found the answer. I reverted my PyTorch back to 2.1.2 and it solved the problem. Seems like torch 2.2.x and above is only supported by mmcv==2.2.0 (which is not supported to run mmseg yet)

Give this installation guide a shot. I install mine using pip.

aakgun commented 3 months ago

For my case, I have been using a previous version which supports and implementation of segmentation with mmseg, with mmcv==1.2.5 version but in this case I get mmcv._ext error , I need support for this issue for previous versions ,

timucinbulmus commented 3 months ago

I have tried to run old version however i couldnt fix the issue. Therefore, i installed the later version. Below, you can find the libraries (in .yaml extension) i have now and it works for me.

name: openmmlab8 channels: