pyg-team/pyg-lib

Specify compatible PyTorch version in Requires-Dist

Opened this issue ยท 2 comments

๐Ÿš€ The feature, motivation and pitch

Since each distribution wheel is built for a particular version of PyTorch, it would be helpful to specify that PyTorch version in Requires-Dist in the package metadata. E.g., in setup.py: setup(install_requires=['torch==1.13.1+cu116']).

This helps fail-fast if an incompatible version is being installed. For organizations storing these wheels in a private package repository, this also allows pip to automatically select the right version if a version range is specified.

Alternatives

Can otherwise specify a particular Torch version's subdirectory of the downloads site using pip --find-links ..., but that doesn't fail-fast if the version is incompatible

Additional context

No response

To add to this. Due to not including the Requires-Dist tag it is easy to accidentally installs versions that should be incompatible.

An example torch==1.13.1 and torch-scatter==2.1.0+pt112cu116

$ PIP_FIND_LINKS="https://download.pytorch.org/whl/cu116/torch_stable.html https://data.pyg.org/whl/torch-1.12.0+cu116.html" pip install torch==1.13.1 torch-scatter
Looking in links: https://download.pytorch.org/whl/cu116/torch_stable.html, https://data.pyg.org/whl/torch-1.12.0+cu116.html
Requirement already satisfied: torch==1.13.1 in /usr/local/lib/python3.10/dist-packages (1.13.1+cu116)
Collecting torch-scatter
  Downloading https://data.pyg.org/whl/torch-1.12.0%2Bcu116/torch_scatter-2.1.0%2Bpt112cu116-cp310-cp310-linux_x86_64.whl (9.0 MB)
     โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 9.0/9.0 MB 2.0 MB/s eta 0:00:00
Requirement already satisfied: typing-extensions in /usr/local/lib/python3.10/dist-packages (from torch==1.13.1) (4.5.0)
Installing collected packages: torch-scatter
Successfully installed torch-scatter-2.1.0+pt112cu116

I think this would be a more fitting issue in, e.g., pyg-lib (since PyG has no dependency on a particular PT/CUDA version). Other than that, I agree with you. Can we close this issue here and create a similar one for pyg-lib? I don't think we need to include other ones as we are in the process of deprecating them.