PyTorch for CPU with pip-compile

Hello, I’m using pip-compile (from pip-tools) for managing versions of python packages. I put them in requirements.in and this command generates requirements.txt for me.

I want to use the CPU version of PyTorch. This could be done with torch==1.10.0+cpu. However, the CPU specification is provided in the version string, not in the name of the package. This also means that I’m requesting a specific release version (1.10.0).

How can I specify in requirements.in that I want to use the newest version of PyTorch, but specifically the one for CPU?

I’ve tried the following

--find-links https://download.pytorch.org/whl/cpu/torch_stable.html

torchvision==1.*+cpu

but it didn’t work.

So far I found a proper name for the +cpu part. It’s called a local version label.

1 Like