Skip to content

[Bug] pip install -e . fails in mmtracking 0.13.0 due to ModuleNotFoundError: No module named 'torch' #3

@Bosung-Baek

Description

@Bosung-Baek

Title:

[Bug] pip install -e . fails in mmtracking 0.13.0 due to ModuleNotFoundError: No module named 'torch'


Description

While setting up mmtracking (version 0.13.0) following the recommended installation steps, the installation fails at pip install -e . with ModuleNotFoundError: No module named 'torch'.

Even though PyTorch is installed and works when imported manually (python -c "import torch; print(torch.__version__)"), the setup process does not detect it, causing an error.


Environment

  • OS: Ubuntu 22.04
  • Python Version: 3.9
  • Conda Version: 22.9.0
  • Pip Version: 25.0.1
  • mmtracking Version: 0.13.0
  • mmcv-full Version: 1.5.3
  • CUDA Version: 11.7
  • PyTorch Version: 1.13.1, 1.13.0(tried both)
  • NumPy Version: 2.21.5

Steps to Reproduce

  1. Create Conda environment and install PyTorch

    conda create -n deepsvc python=3.9 -y
    conda activate deepsvc
    conda install pytorch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 pytorch-cuda=11.7 -c pytorch -c nvidia
  2. Install mmcv-full

    pip install mmcv-full==1.5.3 -f https://download.openmmlab.com/mmcv/dist/cu117/torch1.13/index.html
    • Issue: The installation gets stuck at building wheel for mmcv-full.
  3. Workaround for mmcv-full

    • Clone mmcv repository (1.5.3 version)
    • Install manually:
      git clone -b v1.5.3 https://github.com/open-mmlab/mmcv.git
      cd mmcv
      MMCV_WITH_OPS=1 pip install -e .
    • Issue: Error occurs due to missing pyproject.toml.
  4. Fix: Add pyproject.toml with the following content and install using PEP 517:

    [build-system]
    requires = ["setuptools>=64", "wheel"]
    build-backend = "setuptools.build_meta"
    pip install -e . --use-pep517
    • Success: mmcv-full installs successfully.
  5. Download and install mmtracking

    git clone -b v0.13.0 https://github.com/open-mmlab/mmtracking.git
    cd mmtracking
    pip install -v -e .
  6. Error occurs:

    ModuleNotFoundError: No module named 'torch'
    error: subprocess-exited-with-error
    

Observed Behavior

Even though PyTorch is correctly installed and works when imported manually (python -c "import torch; print(torch.__version__)"), the pip install -e . process does not recognize it and fails.


What I Have Tried

  1. Checked PyTorch installation

    python -c "import torch; print(torch.__version__)"
    • Output: 1.13.1 (PyTorch is installed correctly)
  2. Reinstalled dependencies

    pip install --upgrade pip setuptools wheel
    pip install --force-reinstall torch torchvision torchaudio
    • Issue persists.
  3. Checked Python environment

    conda list | grep torch
    • PyTorch is installed in the correct environment.
  4. Tried a fresh Conda environment and reinstalled everything

    conda remove --name deepsvc --all
    conda create -n deepsvc python=3.9 -y
    conda activate deepsvc
    conda install pytorch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 pytorch-cuda=11.7 -c pytorch -c nvidia
    pip install mmcv-full==1.5.3 -f https://download.openmmlab.com/mmcv/dist/cu117/torch1.13/index.html
    git clone -b v0.13.0 https://github.com/open-mmlab/mmtracking.git
    cd mmtracking
    pip install -v -e .
    • Same error occurs.

Expected Behavior

pip install -e . should complete successfully without errors.


Additional Information

  • It seems like setuptools does not detect the installed torch package during the editable installation process.
  • Other users facing a similar issue with mmtracking may need to check whether pyproject.toml is required for installation.
  • Any insights on whether this is a setuptools issue or specific to mmtracking would be helpful.

Would appreciate any guidance on resolving this! 🚀

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions