Detectron2, torch installation

If you’re creating a debugging post, please include the following info:

  1. Share the link to the public app (deployed on Community Cloud).
  2. Share the link to your app’s public GitHub repository (including a requirements file).
  3. Share the full text of the error message (not a screenshot).
  4. Share the Streamlit and Python versions.

Hi,
I am trying to deploy my detectron2 app on streamlit. Here is the link to my github repository (GitHub - jayantraj/repair_mate).
I am getting error, when I try to install using the requirements.txt.

[     UTC     ] Logs for repairmate-mnylsngkckgjpzhy2qvhzd.streamlit.app/
────────────────────────────────────────────────────────────────────────────────────────
[04:50:58] 🖥 Provisioning machine...
[04:50:58] 🎛 Preparing system...
[04:50:58] ⛓ Spinning up manager process...
[04:50:59] 🚀 Starting up repository: 'repair_mate', branch: 'main', main module: 'old_version_app.py'
[04:50:59] 🐙 Cloning repository...
[04:51:00] 🐙 Cloning into '/mount/src/repair_mate'...
[04:51:00] 🐙 Cloned repository!
[04:51:00] 🐙 Pulling code changes from Github...
[04:51:00] 📦 Processing dependencies...

──────────────────────────────────────── uv ───────────────────────────────────────────

Using uv pip install.
  × No solution found when resolving dependencies:
  ╰─▶ Because torch==1.9.0 has no wheels are available with a matching Python
      ABI and you require torch==1.9, we can conclude that the requirements
      are unsatisfiable.
Checking if Streamlit is installed

────────────────────────────────────────────────────────────────────────────────────────


──────────────────────────────────────── pip ───────────────────────────────────────────

Using standard pip install.
Looking in links: https://dl.fbaipublicfiles.com/detectron2/wheels/cpu/torch1.9/index.html
Collecting opencv-contrib-python-headless==4.9.0.80 (from -r /mount/src/repair_mate/requirements.txt (line 1))
  Downloading opencv_contrib_python_headless-4.9.0.80-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (20 kB)
Collecting streamlit (from -r /mount/src/repair_mate/requirements.txt (line 2))
  Downloading streamlit-1.35.0-py2.py3-none-any.whl.metadata (8.5 kB)
Collecting pandas (from -r /mount/src/repair_mate/requirements.txt (line 3))
  Downloading pandas-2.2.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (19 kB)
Collecting numpy (from -r /mount/src/repair_mate/requirements.txt (line 4))
  Downloading numpy-1.26.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (61 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.0/61.0 kB 7.7 MB/s eta 0:00:00[2024-05-28 04:51:03.544669] 
Collecting Pillow (from -r /mount/src/repair_mate/requirements.txt (line 5))
  Downloading pillow-10.3.0-cp311-cp311-manylinux_2_28_x86_64.whl.metadata (9.2 kB)
Collecting shapely (from -r /mount/src/repair_mate/requirements.txt (line 6))
  Downloading shapely-2.0.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (7.0 kB)
ERROR: Ignored the following versions that require a different python version: 0.55.2 Requires-Python <3.5; 1.21.2 Requires-Python >=3.7,<3.11; 1.21.3 Requires-Python >=3.7,<3.11; 1.21.4 Requires-Python >=3.7,<3.11; 1.21.5 Requires-Python >=3.7,<3.11; 1.21.6 Requires-Python >=3.7,<3.11
ERROR: Could not find a version that satisfies the requirement torch==1.9 (from versions: 1.13.0, 1.13.1, 2.0.0, 2.0.1, 2.1.0, 2.1.1, 2.1.2, 2.2.0, 2.2.1, 2.2.2, 2.3.0)
ERROR: No matching distribution found for torch==1.9
Checking if Streamlit is installed

────────────────────────────────────────────────────────────────────────────────────────

[04:51:05] ❗️ installer returned a non-zero exit code
[04:51:05] ❗️ Error during processing dependencies! Please fix the error and push an update, or try restarting the app.

I tried with other combinations of versions of torch and detectron2, but it doesnt work. Can you help me out?

Torch 1.9.0 is three years old. You need python < 3.10 to install it.

Thank you for the reply!
I am using torch 2.2 in my local machine, but I am not able to see the suitable detectron2 wheel file (Installation — detectron2 0.6 documentation) for version 2.2.
It would be helpful if you could tell how I should install detectron2 on streamlit

Well, I don’t know. It seems to be a research project and only limited effort is being put in making it easy to install. I am not familiar enough with it to give informed advice.

If you want to install one of the binary wheels (which are quite old too), then I guess you need to install a compatible torch as explained in the docs. But you were already doing that weren’t you? So what else do you want to know?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.