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

Cannot install torch-geometric via requirement.txt #861

Closed
mingloo opened this issue Dec 16, 2019 · 15 comments
Closed

Cannot install torch-geometric via requirement.txt #861

mingloo opened this issue Dec 16, 2019 · 15 comments

Comments

@mingloo
Copy link

mingloo commented Dec 16, 2019

The example requirement.txt is as below:

torch==1.3.1
torch-scatter==1.4.0
torch-sparse==0.4.3
torch-cluster==1.4.5
torch-geometric==1.3.2

Cannot successfully install the above packages via pip install -r requirement.txt

Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting torch==1.3.1 (from -r requirement.txt (line 1))
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/f9/34/2107f342d4493b7107a600ee16005b2870b5a0a5a165bdf5c5e7168a16a6/torch-1.3.1-cp37-cp37m-manylinux1_x86_64.whl (734.6MB)
|████████████████████████████████| 734.6MB 71kB/s
Collecting torch-scatter==1.4.0 (from -r requirement.txt (line 4))
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/b8/c3/8bad887ffa55c86f120ef5ae252dc0e357b3bd956d9fbf45242bacc46290/torch_scatter-1.4.0.tar.gz
ERROR: Command errored out with exit status 1:
command: /home/minglu1/anaconda3/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-8nqd722w/torch-scatter/setup.py'"'"'; file='"'"'/tmp/pip-install-8nqd722w/torch-scatter/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
cwd: /tmp/pip-install-8nqd722w/torch-scatter/
Complete output (5 lines):
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-install-8nqd722w/torch-scatter/setup.py", line 3, in
import torch
ModuleNotFoundError: No module named 'torch'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Is this an expected behavior?

@mingloo
Copy link
Author

mingloo commented Dec 16, 2019

/cc @rusty1s

@rusty1s
Copy link
Member

rusty1s commented Dec 16, 2019

You cannot put both torch and the other packages into a single requirements.txt file, because the installation of those packages depend on torch :(

@mingloo
Copy link
Author

mingloo commented Dec 16, 2019

You cannot put both torch and the other packages into a single requirements.txt file, because the installation of those packages depend on torch :(

Is it possible to add torch to install_requires in setup.py just like https://github.com/rusty1s/pytorch_geometric/blob/master/setup.py#L7 for torch-scatter, torch-cluster and torch-sparse so that we can have them in single requirements.txt?

@rusty1s

@mingloo
Copy link
Author

mingloo commented Dec 17, 2019

Per my understanding, the torch-scatter, torch-cluster and torch-sparse are the kind of pytorch cpp/cuda extensions. Therefore, we have to install torch first then for these 3 packages.

@rusty1s Please correct me if my understanding is wrong.

@rusty1s
Copy link
Member

rusty1s commented Dec 17, 2019

That is absolutely correct. While the installation of torch-geometric does not require the installation of these packages, you can not install both torch and torch-scatter via a single pip command. This is a current limitation, sorry :(

@mingloo
Copy link
Author

mingloo commented Dec 17, 2019

@rusty1s

No, worry. It's okay.

@XiaoXiaoYi123
Copy link

The example requirement.txt is as below:

torch==1.3.1
torch-scatter==1.4.0
torch-sparse==0.4.3
torch-cluster==1.4.5
torch-geometric==1.3.2

Cannot successfully install the above packages via pip install -r requirement.txt

Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Collecting torch==1.3.1 (from -r requirement.txt (line 1)) Downloading https://pypi.tuna.tsinghua.edu.cn/packages/f9/34/2107f342d4493b7107a600ee16005b2870b5a0a5a165bdf5c5e7168a16a6/torch-1.3.1-cp37-cp37m-manylinux1_x86_64.whl (734.6MB) |████████████████████████████████| 734.6MB 71kB/s Collecting torch-scatter==1.4.0 (from -r requirement.txt (line 4)) Downloading https://pypi.tuna.tsinghua.edu.cn/packages/b8/c3/8bad887ffa55c86f120ef5ae252dc0e357b3bd956d9fbf45242bacc46290/torch_scatter-1.4.0.tar.gz ERROR: Command errored out with exit status 1: command: /home/minglu1/anaconda3/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-8nqd722w/torch-scatter/setup.py'"'"'; file='"'"'/tmp/pip-install-8nqd722w/torch-scatter/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info cwd: /tmp/pip-install-8nqd722w/torch-scatter/ Complete output (5 lines): Traceback (most recent call last): File "", line 1, in File "/tmp/pip-install-8nqd722w/torch-scatter/setup.py", line 3, in import torch ModuleNotFoundError: No module named 'torch' ---------------------------------------- ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Is this an expected behavior?

Have you installed success?

@mingloo
Copy link
Author

mingloo commented Jan 7, 2022

@XiaoXiaoYi123

Please install torch first then install torch-scatter ,torch-cluster and torch-sparse.

@Boehm92
Copy link

Boehm92 commented Mar 4, 2022

Is there a solution for the requirements.txt problem yet?

@rusty1s
Copy link
Member

rusty1s commented Mar 4, 2022

requirements.txt should work just fine when making use of our wheels, e.g.:

-f https://download.pytorch.org/whl/cpu/torch_stable.html
-f https://data.pyg.org/whl/torch-1.10.0+cu113.html
torch==1.10.0+cu113
torch-scatter
torch-sparse
torch-geometric

@sunshineatnoon
Copy link

Hi, I tried the commands above, but it does not work for CPU version of geometric. My requirements.txt looks like this

-f https://download.pytorch.org/whl/cpu/torch_stable.html
-f https://data.pyg.org/whl/torch-1.7.1+cpu.html
torch==1.7.1+cpu
torch-scatter
torch-sparse
torch-geometric
torchvision==0.8.2

I got this error:

Collecting torch==1.7.1+cpu
  Downloading https://download.pytorch.org/whl/cpu/torch-1.7.1%2Bcpu-cp38-cp38-linux_x86_64.whl (159.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 159.4/159.4 MB 19.0 MB/s eta 0:00:00
Collecting torch-scatter
  Downloading torch_scatter-2.0.9.tar.gz (21 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status '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-4wy_n64m/torch-scatter_76aaac07d3de48339b4f8e1e528dd9a8/setup.py", line 8, in <module>
          import torch
      ModuleNotFoundError: No module named 'torch'
      [end of output]

@rusty1s
Copy link
Member

rusty1s commented Apr 25, 2022

You need to specify the versioning when using older versions of PyTorch, see here:

-f https://download.pytorch.org/whl/cpu/torch_stable.html
-f https://data.pyg.org/whl/torch-1.7.1+cpu.html
torch==1.7.1+cpu
torch-scatter==2.0.7
torch-sparse==0.6.9
torch-geometric
torchvision==0.8.2

@sunshineatnoon
Copy link

Works like a magic. Thanks!

@camille-004
Copy link

You need to specify the versioning when using older versions of PyTorch, see here:

-f https://download.pytorch.org/whl/cpu/torch_stable.html
-f https://data.pyg.org/whl/torch-1.7.1+cpu.html
torch==1.7.1+cpu
torch-scatter==2.0.7
torch-sparse==0.6.9
torch-geometric
torchvision==0.8.2

@rusty1s I still get the same error as @sunshineatnoon in a Docker container (after running docker build -t which runs these commands with the supposed newest version:

-f https://download.pytorch.org/whl/cpu/torch_stable.html
-f https://data.pyg.org/whl/torch-1.13.1+cpu.html
torch==1.13.1+cpu
torch-scatter
torch-sparse
torch-geometric

When it gets to installing torch_scatter:

ModuleNotFoundError: No module named 'torch'

@rusty1s
Copy link
Member

rusty1s commented Mar 15, 2023

Can you confirm that the path https://data.pyg.org/whl/torch-1.13.1+cpu.html is actually picked up by your installation?

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

6 participants