rusty1s / pytorch_cluster

PyTorch Extension Library of Optimized Graph Cluster Algorithms
MIT License
824 stars 148 forks source link

setup.py depends on `torch` #204

Closed dyollb closed 9 months ago

dyollb commented 9 months ago

I would like to create a python package that installs its dependencies properly using pip. Unfortunately, the install fails because pytorch-cluster expects torch to already be installed.

Simply trying to install torch-cluster using pip install torch-cluster fails. First, you need to install pytorch, and only then install pytorch-cluster.

image

Originally I hoped it would simply suffice to add torch here. But the setup.py depends on torch to build. It seems that pytorch C++ extensions are done in this way.

Is there any workaround (using pip)?

rusty1s commented 9 months ago

The only workaround for this right now is to install from the wheels page (i.e., by specifying -f in the pip install command). This way, torch is not required to install the package.

dyollb commented 9 months ago

hmm. I did that but it doesn't work. I tried installing (copy pasted from the README) via

pip install torch-cluster -f https://data.pyg.org/whl/torch-2.1.0+cpu.html

which gives me: image

System specs:

Btw, independent of the issue above, surely torch-cluster should explicitly depend on torch. Currently it doesn't (see here): image

rusty1s commented 9 months ago

That's because you are trying to install on Apple M2 for which do not exist pre-built wheels (only for Intel-Mac at the moment) :(

dyollb commented 9 months ago

Okay, understood. Thanks!