Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Installation of torch-scatter fails if torch is not already installed #365

Closed
ThomasCassimon opened this issue Apr 4, 2023 · 1 comment

Comments

@ThomasCassimon
Copy link

ThomasCassimon commented Apr 4, 2023

When torch-scatter is installed in a system that doesn't have an existing install of torch, the installation fails.

I've noticed that the install_requires in setup.py doesn't list torch as an installation dependency. Adding the torch package here may resolve the issue.

The issue can be easily reproduced by issuing the following commands in a Linux shell:

# First, create a new virtual environment
python3 -m venv test-venv

# Next, activate it
source ~/test-venv/bin/activate

# Finally, try to install `torch-scatter`
python3 -m pip install --upgrade torch-scatter
Looking in indexes: https://pypi.org/simple
Collecting torch-scatter
  Downloading torch_scatter-2.1.1.tar.gz (107 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 107.6/107.6 KB 2.0 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-nksi8_2c/torch-scatter_b525def955bd4685856db2313510ac1d/setup.py", line 8, in <module>
          import torch
      ModuleNotFoundError: No module named 'torch'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

The current workaround is to manually install torch first, in a separate command before installing anything that requires torch-scatter.

@ThomasCassimon
Copy link
Author

It seems this issue was already reported earlier (#265), closing for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant