open-mmlab / mmcv

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

ModuleNotFoundError: No module named 'mmcv._ext' #409

Closed farshid-mi closed 4 years ago

farshid-mi commented 4 years ago

hi,i'm new to the mmdetection and after using it for one day a few days ago,it seems that from last updates to mmdetection repository,installing it on colab is not the same! while commands below:

!pip install mmcv
!git clone https://github.com/open-mmlab/mmdetection.git
%cd mmdetection
!python setup.py develop

worked perfectly fine few days ago,now i get these logs from executing above:

/content/mmdetection running develop running egg_info writing mmdet.egg-info/PKG-INFO writing dependency_links to mmdet.egg-info/dependency_links.txt writing requirements to mmdet.egg-info/requires.txt writing top-level names to mmdet.egg-info/top_level.txt writing manifest file 'mmdet.egg-info/SOURCES.txt' /usr/local/lib/python3.6/dist-packages/torch/utils/cpp_extension.py:305: 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.')) running build_ext Creating /usr/local/lib/python3.6/dist-packages/mmdet.egg-link (link to .) mmdet 2.3.0rc0+f92765b is already the active version in easy-install.pth

Installed /content/mmdetection Processing dependencies for mmdet==2.3.0rc0+f92765b Searching for torchvision==0.6.1+cu101 Best match: torchvision 0.6.1+cu101 Adding torchvision 0.6.1+cu101 to easy-install.pth file

Using /usr/local/lib/python3.6/dist-packages Searching for torch==1.5.1+cu101 Best match: torch 1.5.1+cu101 Adding torch 1.5.1+cu101 to easy-install.pth file Installing convert-caffe2-to-onnx script to /usr/local/bin Installing convert-onnx-to-caffe2 script to /usr/local/bin

Using /usr/local/lib/python3.6/dist-packages Searching for terminaltables==3.1.0 Best match: terminaltables 3.1.0 Adding terminaltables 3.1.0 to easy-install.pth file

Using /usr/local/lib/python3.6/dist-packages Searching for six==1.12.0 Best match: six 1.12.0 Adding six 1.12.0 to easy-install.pth file

Using /usr/local/lib/python3.6/dist-packages Searching for Pillow==6.2.2 Best match: Pillow 6.2.2 Adding Pillow 6.2.2 to easy-install.pth file

Using /usr/local/lib/python3.6/dist-packages Searching for numpy==1.18.5 Best match: numpy 1.18.5 Adding numpy 1.18.5 to easy-install.pth file Installing f2py script to /usr/local/bin Installing f2py3 script to /usr/local/bin Installing f2py3.6 script to /usr/local/bin

Using /usr/local/lib/python3.6/dist-packages Searching for matplotlib==3.2.2 Best match: matplotlib 3.2.2 Adding matplotlib 3.2.2 to easy-install.pth file

Using /usr/local/lib/python3.6/dist-packages Searching for future==0.16.0 Best match: future 0.16.0 Adding future 0.16.0 to easy-install.pth file Installing futurize script to /usr/local/bin Installing pasteurize script to /usr/local/bin

Using /usr/local/lib/python3.6/dist-packages Searching for pyparsing==2.4.7 Best match: pyparsing 2.4.7 Adding pyparsing 2.4.7 to easy-install.pth file

Using /usr/local/lib/python3.6/dist-packages Searching for python-dateutil==2.8.1 Best match: python-dateutil 2.8.1 Adding python-dateutil 2.8.1 to easy-install.pth file

Using /usr/local/lib/python3.6/dist-packages Searching for kiwisolver==1.2.0 Best match: kiwisolver 1.2.0 Adding kiwisolver 1.2.0 to easy-install.pth file

Using /usr/local/lib/python3.6/dist-packages Searching for cycler==0.10.0 Best match: cycler 0.10.0 Adding cycler 0.10.0 to easy-install.pth file

Using /usr/local/lib/python3.6/dist-packages Finished processing dependencies for mmdet==2.3.0rc0+f92765b

which are different from the past. also after installing it like above,print_config functionality works fine,but train functionality and commands like:

from mmdet.apis.inference import show_result_pyplot,init_detector,inference_detector

return:

ModuleNotFoundError: No module named 'mmcv._ext'

so,what is the problem?is it installing correctly? anything that i'm missing?!

thank u in advance!

EthanZhangYi commented 4 years ago

I met the same problem, even _ext.*.so is in mmcv/

hellock commented 4 years ago

If you install it via pip install mmcv, the lite version is installed, which does not contain mmcv._ext.

EthanZhangYi commented 4 years ago

Following the README, I installed it via MMCV_WITH_OPS=1 pip install -e .. The _ext.*.so is generated, but can not be imported. image

farshid-mi commented 4 years ago

thanks for your response,after restarting runtime i executed commands below:

!pip install mmcv-full
!git clone https://github.com/open-mmlab/mmdetection.git
%cd mmdetection
!pip install -r requirements/build.txt
!pip install "git+https://github.com/open-mmlab/cocoapi.git#subdirectory=pycocotools"
!pip install -v -e .  # or "python setup.py develop"

and don't have that problem anymore! tnx again.

liuzili97 commented 4 years ago

same problem

EthanZhangYi commented 4 years ago

@liuzili97 @farshid-mi I solved this problem I met yesterday. Maybe you can check the result of pip list. I install mmcv-full manually and then install mmdetection3d. However, mmdeetection3d will install mmcv again automatically. Thus there are two versions of mmcv. Just pip uninstall mmcv and this problem is fixed.

Learneruestc commented 1 year ago

If you install it via pip install mmcv, the lite version is installed, which does not contain mmcv._ext.

so how to install it??