Custom component can't install pytorch?

Hi,

I am building a custom component that uses pytorch, but HA is unable to find it:

{
  "domain": "blah",
  "name": "blah",
  "codeowners": ["@kerryland"],
  "config_flow": false,
  "version": "0.9.0",
  "dependencies": ["conversation"],
  "integration_type": "service",
  "iot_class": "local_polling",
  "requirements": ["torch"]
}

HA logs show:

2023-07-21 16:45:27.375 ERROR (SyncWorker_4) [homeassistant.util.package] Unable to install package torch: ERROR: Could not find a version that satisfies the requirement torch (from versions: none)
ERROR: No matching distribution found for torch

I’m kinda stumped at the first hurdle. I can install it just fine outside of HA. I am definitely not a Python guru.

PS: Running on a Pi4. Home Assistant 2023.7.1 Supervisor 2023.07.1 Frontend 20230705.1 - latest.

You might need to specify the (exact or minimum) version of your dependency.

Thanks for the thought, but by not specifying a version number I’m saying that I’ll take anything.

The problem is specific to “torch”. Why can’t HA find it?

I’ve made a small amount of progress, but would still love some help. I understand that requirements entries are pip compatible strings, and I see there is an HA example that pulls directly from git, rather than whatever repo HA is using:

"requirements": ["git+https://github.com/issacg/pycoolmaster.git@except_connect#pycoolmaster==0.2.2"]

I am able to pull pytorch from their site with this pip command locally (note that it is not a git repo)

pip3 install torch==1.13.1 -f https://download.pytorch.org/whl/torch_stable.html

…but I can’t find a way to squish the project name into the URL. None of these work as “requirements”

https://download.pytorch.org/whl/torch_stable.html@torch==1.13.1
https://download.pytorch.org/whl/torch_stable.html#torch==1.13.1
https://download.pytorch.org/whl/torch_stable.html@#torch==1.13.1
https://download.pytorch.org/whl/torch_stable.html#egg=torch

Does anybody have the magic incantation, or an explanation why ‘torch’ doesn’t “just work” in the first place?

If not I’ll raise a bug request and see if the developers want to help.

Cheers
Kerry