pytorch_scatter icon indicating copy to clipboard operation
pytorch_scatter copied to clipboard

Add build requirements in `pyproject.toml` to make installations easier

Open cthoyt opened this issue 3 years ago • 4 comments

Closes #265

This pull request does the following:

  1. Adds torch as a build requirement using pyproject.toml as described in https://setuptools.readthedocs.io/en/latest/build_meta.html. The use of setup.py is getting towards the end of life, and using a combination of declarative setup metadata in setup.cfg and pyproject.toml is the preferred way forwards. This means that if torch isn't already installed before doing pip install torch-scatter, it gets installed.
  2. Adds torch as a install requirement (i.e., a dependency). This might be a bit redundant of 1, but some tools like tox create a separate env for the build requirements, so this needs to be duplicated.
  3. Adds an alternative testing scenario in which PyTorch is not installed before trying to pip install torch-scatter. This demonstrates that with the first two changes, it's now possible to make an automated, single step installation of torch-scatter.

Why is this important

Creating easily installable packages that depend on torch-scatter (that don't include the need for manual installation of torch + cuda) is not currently possible because pip's dependency resolver isn't aware of the fact that torch-scatter needs torch installed before even trying to build it.

cthoyt avatar Feb 02 '22 08:02 cthoyt

Codecov Report

Merging #266 (d46aba3) into master (2f447cf) will not change coverage. The diff coverage is n/a.

:exclamation: Current head d46aba3 differs from pull request most recent head 2a3f89e. Consider uploading reports for the commit 2a3f89e to get more accurate results

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #266   +/-   ##
=======================================
  Coverage   97.05%   97.05%           
=======================================
  Files           9        9           
  Lines         204      204           
=======================================
  Hits          198      198           
  Misses          6        6           

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 2f447cf...2a3f89e. Read the comment docs.

codecov-commenter avatar Feb 02 '22 09:02 codecov-commenter

Any idea why tests are failing?

rusty1s avatar Feb 03 '22 07:02 rusty1s

any updates on this feature? it would be great to just be able to do pip install torch-scatter, this would help a lot to automate environmet setup :)

gchaperon avatar Apr 16 '22 03:04 gchaperon

This is likely not going to happen since pip install torch-scatter will pick up the local CUDA environment, not the default one provided by pip install torch. This will result in a lot of problems later on. We also want to discourage manual compilation and recommend installation from pre-built wheels.

rusty1s avatar Apr 16 '22 06:04 rusty1s

This pull request had no activity for 6 months. It will be closed in 2 weeks unless there is some new activity.

github-actions[bot] avatar Oct 14 '22 02:10 github-actions[bot]