mmsegmentation icon indicating copy to clipboard operation
mmsegmentation copied to clipboard

mmcv._ext error

Open timucinbulmus opened this issue 1 year ago • 8 comments

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'

timucinbulmus avatar Feb 16 '24 12:02 timucinbulmus

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

jacksteussie avatar Mar 28 '24 18:03 jacksteussie

@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.

AugChiang avatar May 02 '24 08:05 AugChiang

@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.

timucinbulmus avatar May 07 '24 08:05 timucinbulmus

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.

aakgun avatar Jun 29 '24 09:06 aakgun

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 avatar Jul 01 '24 07:07 anhphan2705

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.

anhphan2705 avatar Jul 01 '24 08:07 anhphan2705

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 ,

aakgun avatar Jul 01 '24 08:07 aakgun

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:

  • pytorch
  • nvidia
  • defaults dependencies:
  • blas=1.0=mkl
  • brotli-python=1.0.9=py38hd77b12b_8
  • ca-certificates=2024.3.11=haa95532_0
  • certifi=2024.2.2=py38haa95532_0
  • charset-normalizer=2.0.4=pyhd3eb1b0_0
  • cuda-cccl=12.4.127=0
  • cuda-cudart=11.7.99=0
  • cuda-cudart-dev=11.7.99=0
  • cuda-cupti=11.7.101=0
  • cuda-libraries=11.7.1=0
  • cuda-libraries-dev=11.7.1=0
  • cuda-nvrtc=11.7.99=0
  • cuda-nvrtc-dev=11.7.99=0
  • cuda-nvtx=11.7.91=0
  • cuda-runtime=11.7.1=0
  • filelock=3.13.1=py38haa95532_0
  • freetype=2.12.1=ha860e81_0
  • gmpy2=2.1.2=py38h7f96b67_0
  • idna=3.7=py38haa95532_0
  • intel-openmp=2023.1.0=h59b6b97_46320
  • jinja2=3.1.3=py38haa95532_0
  • jpeg=9e=h2bbff1b_1
  • lcms2=2.12=h83e58a3_0
  • lerc=3.0=hd77b12b_0
  • libcublas=11.10.3.66=0
  • libcublas-dev=11.10.3.66=0
  • libcufft=10.7.2.124=0
  • libcufft-dev=10.7.2.124=0
  • libcurand=10.3.5.147=0
  • libcurand-dev=10.3.5.147=0
  • libcusolver=11.4.0.1=0
  • libcusolver-dev=11.4.0.1=0
  • libcusparse=11.7.4.91=0
  • libcusparse-dev=11.7.4.91=0
  • libdeflate=1.17=h2bbff1b_1
  • libffi=3.4.4=hd77b12b_1
  • libnpp=11.7.4.75=0
  • libnpp-dev=11.7.4.75=0
  • libnvjpeg=11.8.0.2=0
  • libnvjpeg-dev=11.8.0.2=0
  • libpng=1.6.39=h8cc25b3_0
  • libtiff=4.5.1=hd77b12b_0
  • libuv=1.44.2=h2bbff1b_0
  • libwebp-base=1.3.2=h2bbff1b_0
  • lz4-c=1.9.4=h2bbff1b_1
  • markupsafe=2.1.3=py38h2bbff1b_0
  • mkl=2023.1.0=h6b88ed4_46358
  • mkl-service=2.4.0=py38h2bbff1b_1
  • mkl_fft=1.3.8=py38h2bbff1b_0
  • mkl_random=1.2.4=py38h59b6b97_0
  • mpc=1.1.0=h7edee0f_1
  • mpfr=4.0.2=h62dcd97_1
  • mpir=3.0.0=hec2e145_1
  • mpmath=1.3.0=py38haa95532_0
  • networkx=3.1=py38haa95532_0
  • numpy=1.24.3=py38h79a8e48_1
  • numpy-base=1.24.3=py38h8a87ada_1
  • openjpeg=2.4.0=h4fc8c34_0
  • openssl=3.0.13=h2bbff1b_2
  • pillow=10.3.0=py38h2bbff1b_0
  • pip=24.0=py38haa95532_0
  • pysocks=1.7.1=py38haa95532_0
  • python=3.8.19=h1aa4202_0
  • pytorch=2.0.1=py3.8_cuda11.7_cudnn8_0
  • pytorch-cuda=11.7=h16d0643_5
  • pytorch-mutex=1.0=cuda
  • requests=2.32.2=py38haa95532_0
  • setuptools=69.5.1=py38haa95532_0
  • sqlite=3.45.3=h2bbff1b_0
  • sympy=1.12=py38haa95532_0
  • tbb=2021.8.0=h59b6b97_0
  • typing_extensions=4.11.0=py38haa95532_0
  • urllib3=2.2.1=py38haa95532_0
  • vc=14.2=h2eaa2aa_1
  • vs2015_runtime=14.29.30133=h43f2093_3
  • wheel=0.43.0=py38haa95532_0
  • win_inet_pton=1.1.0=py38haa95532_0
  • xz=5.4.6=h8cc25b3_1
  • zlib=1.2.13=h8cc25b3_1
  • zstd=1.5.5=hd43e919_2
  • pip:
    • addict==2.4.0
    • contourpy==1.1.1
    • cycler==0.12.1
    • fonttools==4.52.4
    • ftfy==6.2.0
    • importlib-metadata==7.1.0
    • importlib-resources==6.4.0
    • kiwisolver==1.4.5
    • markdown-it-py==3.0.0
    • matplotlib==3.7.5
    • mdurl==0.1.2
    • mmcv==2.1.0
    • mmengine==0.10.4
    • mmsegmentation==1.2.0
    • opencv-python==4.9.0.80
    • packaging==24.0
    • pandas==2.0.3
    • platformdirs==4.2.2
    • prettytable==3.10.0
    • pygments==2.18.0
    • pyparsing==3.1.2
    • pyproj==3.5.0
    • python-dateutil==2.9.0.post0
    • pytz==2024.1
    • pyyaml==6.0.1
    • regex==2024.5.15
    • rich==13.7.1
    • scipy==1.10.1
    • six==1.16.0
    • termcolor==2.4.0
    • tomli==2.0.1
    • torchaudio==2.0.2
    • torchvision==0.15.2
    • tzdata==2024.1
    • wcwidth==0.2.13
    • yapf==0.40.2
    • zipp==3.19.0 prefix: C:\Users\pc\miniconda3\envs\openmmlab8

timucinbulmus avatar Jul 01 '24 10:07 timucinbulmus