open-mmlab / mmcv

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

[Bug] ModuleNotFoundError: No module named 'mmcv._ext' in compiled mmcv-full 2.0.0rc4 with ROCM #2676

Open Novarchibald opened 1 year ago

Novarchibald commented 1 year ago

Prerequisite

Environment

ENV: /bin/sh: 1: /opt/rocm-5.4.3/bin/nvcc: not found /bin/sh: 1: /opt/rocm-5.4.3/bin/nvcc: not found OrderedDict([('sys.platform', 'linux'), ('Python', '3.10.7 (main, Nov 24 2022, 19:45:47) [GCC 12.2.0]'), ('CUDA available', True), ('numpy_random_seed', 2147483648), ('GPU 0', 'AMD Radeon RX 6900 XT'), ('CUDA_HOME', '/opt/rocm-5.4.3'), ('NVCC', 'Not Available'), ('GCC', 'x86_64-linux-gnu-gcc (Ubuntu 12.2.0-3ubuntu1) 12.2.0'), ('PyTorch', '2.0.0+rocm5.4.2'), ('PyTorch compiling details', 'PyTorch built with:\n - GCC 9.3\n - C++ Version: 201703\n - Intel(R) oneAPI Math Kernel Library Version 2022.2-Product Build 20220804 for Intel(R) 64 architecture applications\n - Intel(R) MKL-DNN v2.7.3 (Git Hash 6dbeffbae1f23cbbeae17adb7b5b13f1f37c080e)\n - OpenMP 201511 (a.k.a. OpenMP 4.5)\n - LAPACK is enabled (usually provided by MKL)\n - NNPACK is enabled\n - CPU capability usage: AVX2\n - HIP Runtime 5.4.22803\n - MIOpen 2.19.0\n - Magma 2.6.1\n - Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CXX_COMPILER=/opt/rh/devtoolset-9/root/usr/bin/c++, CXX_FLAGS= -D_GLIBCXX_USE_CXX11_ABI=0 -fabi-version=11 -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOCUPTI -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -O2 -fPIC -Wall -Wextra -Werror=return-type -Werror=non-virtual-dtor -Werror=bool-operation -Wnarrowing -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wunused-local-typedefs -Wno-unused-parameter -Wno-unused-function -Wno-unused-result -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Werror=cast-function-type -Wno-stringop-overflow, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_DISABLE_GPU_ASSERTS=ON, TORCH_VERSION=2.0.0, USE_CUDA=OFF, USE_CUDNN=OFF, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=1, USE_NNPACK=ON, USE_OPENMP=ON, USE_ROCM=ON, \n'), ('TorchVision', '0.15.1+rocm5.4.2'), ('OpenCV', '4.7.0'), ('MMEngine', '0.7.0'), ('MMCV', '2.0.0rc4'), ('MMCV Compiler', 'n/a'), ('MMCV CUDA Compiler', 'n/a')])

Torch: Name: torch Version: 2.0.0+rocm5.4.2 Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration Home-page: https://pytorch.org/ Author: PyTorch Team Author-email: packages@pytorch.org License: BSD-3 Location: /home/archibald/stable-diffusion-webui/venv/lib/python3.10/site-packages Requires: filelock, jinja2, networkx, pytorch-triton-rocm, sympy, typing-extensions Required-by: accelerate, basicsr, clean-fid, clip, facexlib, gfpgan, kornia, lpips, open-clip-torch, pytorch-lightning, pytorch-triton-rocm, realesrgan, timm, torchaudio, torchdiffeq, torchmetrics, torchsde, torchvision

Reproduces the problem - code sample

from mmcv.ops import get_compiler_version

Reproduces the problem - command or script

from mmcv.ops import get_compiler_version

Reproduces the problem - error message

from mmcv.ops import get_compiler_version Traceback (most recent call last): File "", line 1, in File "/home/archibald/stable-diffusion-webui/venv/lib/python3.10/site-packages/mmcv/ops/init.py", line 2, in from .active_rotated_filter import active_rotated_filter File "/home/archibald/stable-diffusion-webui/venv/lib/python3.10/site-packages/mmcv/ops/active_rotated_filter.py", line 10, in ext_module = ext_loader.load_ext( File "/home/archibald/stable-diffusion-webui/venv/lib/python3.10/site-packages/mmcv/utils/ext_loader.py", line 13, in load_ext ext = importlib.import_module('mmcv.' + name) File "/usr/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'

Additional information

No response

HAOCHENYE commented 1 year ago

Hi, have you followed the guide in docs to install ROCm

Novarchibald commented 1 year ago

Yep, found in another issue command ROCM_HOME and installed with it. No errors and successful setup.

MMCV itself loading and working, but when I try to use modules like mmdet - I get that error.

Ttied v1.7, and 2.0 already, always same.

GregorySenay commented 1 year ago

Same here but the _ext library seems to be created by installing mmcv after the mmcv-full. I hope it help

leizhenyu-lzy commented 1 year ago

Same here but the _ext library seems to be created by installing mmcv after the mmcv-full. I hope it help

so i need to install mmcv-full first and then install mmcv ?

jersonal commented 1 year ago

mim install mmcv-full==1.7.1 (or other version) dont use mim install mmcv

MABatin commented 9 months ago

Hi, were you able to resolve this issue? I'm looking forward to getting an AMD gpu and am not sure if it will be a problem to use mmcv in an environment with rocm?

ajayrafa25 commented 6 months ago

Hi, what's the status with this issue.

whittenator commented 3 weeks ago

Still an issue in June 2024...