gaomingqi / Track-Anything

Track-Anything is a flexible and interactive tool for video object tracking and segmentation, based on Segment Anything, XMem, and E2FGVI.
MIT License
6.51k stars 482 forks source link

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

Open crocis opened 6 months ago

crocis commented 6 months ago

When I run app.py I on Ubuntu get the error message ModuleNotFoundError: No module named 'mmcv._ext'

I have tried to install mmcv with pip, mim, and from the source code, but I get the same error message.

I have tested both mmcv version 2.2.0 and 2.0.0

I have installed PyTorch 2.3.0 and CUDA 12.1

This is the list of the installed pip packages Package Version


absl-py 2.1.0 addict 2.4.0 aiofiles 23.2.1 altair 5.3.0 annotated-types 0.6.0 anyio 4.3.0 attrs 23.2.0 av 12.0.0 beautifulsoup4 4.12.3 certifi 2024.2.2 charset-normalizer 3.3.2 click 8.1.7 colorama 0.4.6 contourpy 1.2.1 cycler 0.12.1 exceptiongroup 1.2.1 fastapi 0.110.3 ffmpy 0.3.2 filelock 3.14.0 fonttools 4.51.0 fsspec 2024.3.1 gdown 5.1.0 gitdb 4.0.11 GitPython 3.1.43 gradio 4.28.3 gradio_client 0.16.0 grpcio 1.63.0 h11 0.14.0 h5py 3.11.0 hickle 5.0.3 httpcore 1.0.5 httpx 0.27.0 huggingface-hub 0.23.0 idna 3.7 importlib_metadata 7.1.0 importlib_resources 6.4.0 Jinja2 3.1.3 jsonschema 4.22.0 jsonschema-specifications 2023.12.1 kiwisolver 1.4.5 Markdown 3.6 markdown-it-py 3.0.0 MarkupSafe 2.1.5 matplotlib 3.8.4 mdurl 0.1.2 mmcv 2.2.0 mmengine 0.10.4 model-index 0.1.11 mpmath 1.3.0 networkx 3.3 ninja 1.11.1.1 numpy 1.26.4 nvidia-cublas-cu12 12.1.3.1 nvidia-cuda-cupti-cu12 12.1.105 nvidia-cuda-nvrtc-cu12 12.1.105 nvidia-cuda-runtime-cu12 12.1.105 nvidia-cudnn-cu12 8.9.2.26 nvidia-cufft-cu12 11.0.2.54 nvidia-curand-cu12 10.3.2.106 nvidia-cusolver-cu12 11.4.5.107 nvidia-cusparse-cu12 12.1.0.106 nvidia-nccl-cu12 2.20.5 nvidia-nvjitlink-cu12 12.4.127 nvidia-nvtx-cu12 12.1.105 opencv-python 4.9.0.80 opendatalab 0.0.10 openmim 0.3.9 openxlab 0.0.11 ordered-set 4.1.0 orjson 3.10.2 packaging 24.0 pandas 2.2.2 pillow 10.3.0 pip 24.0 platformdirs 4.2.1 progressbar2 4.4.2 protobuf 5.26.1 psutil 5.9.8 pycryptodome 3.20.0 pydantic 2.7.1 pydantic_core 2.18.2 pydub 0.25.1 Pygments 2.17.2 pyparsing 3.1.2 PySocks 1.7.1 python-dateutil 2.9.0.post0 python-multipart 0.0.9 python-utils 3.8.2 pytz 2024.1 PyYAML 6.0.1 referencing 0.35.1 requests 2.31.0 rich 13.7.1 rpds-py 0.18.0 ruff 0.4.2 segment_anything 1.0 semantic-version 2.10.0 setuptools 59.6.0 shellingham 1.5.4 six 1.16.0 smmap 5.0.1 sniffio 1.3.1 soupsieve 2.5 starlette 0.37.2 sympy 1.12 tabulate 0.9.0 tensorboard 2.16.2 tensorboard-data-server 0.7.2 termcolor 2.4.0 thinplate 1.0.0 tomli 2.0.1 tomlkit 0.12.0 toolz 0.12.1 torch 2.3.0 torchvision 0.18.0 tqdm 4.66.2 triton 2.3.0 typer 0.12.3 typing_extensions 4.11.0 tzdata 2024.1 urllib3 2.2.1 uvicorn 0.29.0 websockets 11.0.3 Werkzeug 3.0.2 yapf 0.40.2 zipp 3.18.1

jp-schneider commented 6 months ago

Hey @crocis,

I got the same issue as you did. I solved it using a version of mmcv which matches the pytorch version and cuda release. There is currently no build of mmcv for the pytorch version 2.3 so you would need 2.2.

You should be able to solve this by uninstalling you current version of mmcv and torch and reinstall them using a matching index:

pip uninstall mmcv torch torchvision torchaudio
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
pip install mmcv==2.2.0 -f https://download.openmmlab.com/mmcv/dist/cu121/torch2.2/index.html

Hope that helps!

mteixeiraTecgraf commented 2 months ago

For me it appears to be missing cuda and MSVC problems with compiler cl.exe.

I fixed the problem after reinstalling CUDA and Microsoft Visual Studio.

Could not resolve MSVC cl.exe problem on CONDA Environment.