Skip to content

Torch requirement makes installing mmdet impossible ias part of a package #238

@picagrad

Description

@picagrad

Hi all, I've recently installed mmdet in a project I'm working on.
This project needds to be packed up as a package so it can be used in other projects.

The problem is, in order to make it into a package, you have to provide a build script (I am doing mine with Poetry, but this idea would be true regardless of which approach to making a package I might be using). The problem there is that the installation instructions for mmdet require using openmim, but openmim requires torch, which is not available in most default environements from which the package will be installed. This leads to a failure when building the environement with the classic ModuleNotFoundError: No module named 'torch'.

To clarify, torch is a requirement of the package of course, and it will be installed as part of the installation of the package, but it cannot be installed BEFORE the package, since requirements needs to be resolved with other requirements.

Here's the full output:

poetry install
Warning: Found deprecated priority 'secondary' for source 'private' in pyproject.toml. Consider changing the priority to one of the non-deprecated values: 'default', 'primary', 'supplemental', 'explicit'.
Installing dependencies from lock file

No dependencies to install or update

Preparing build environment with build-system requirements poetry-core>=1.0.0, openmim>=0.1.1
Traceback (most recent call last):
  File "/local-scratch2/aharell/CFM-Task-Models/src/split_utils/miminstaller.py", line 9, in <module>
    install_mmdet()
  File "/local-scratch2/aharell/CFM-Task-Models/src/split_utils/miminstaller.py", line 4, in install_mmdet
    install('mmengine')
  File "/tmp/tmpu0ao7bdo/.venv/lib/python3.9/site-packages/mim/commands/install.py", line 128, in install
    install_args += ['-f', get_mmcv_full_find_link(mmcv_base_url)]
  File "/tmp/tmpu0ao7bdo/.venv/lib/python3.9/site-packages/mim/commands/install.py", line 165, in get_mmcv_full_find_link
    torch_v, cuda_v = get_torch_cuda_version()
  File "/tmp/tmpu0ao7bdo/.venv/lib/python3.9/site-packages/mim/utils/utils.py", line 340, in get_torch_cuda_version
    raise err
  File "/tmp/tmpu0ao7bdo/.venv/lib/python3.9/site-packages/mim/utils/utils.py", line 338, in get_torch_cuda_version
    import torch
ModuleNotFoundError: No module named 'torch'

In short, I think that there is an urgent need to either remove torch as a requirement for openmim or to provide instructions on how to install mmdet (and other similar packages like mmseg etc.) without relying on openmim

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions