pyg-team / pytorch_geometric

Graph Neural Network Library for PyTorch
https://pyg.org
MIT License
21.28k stars 3.65k forks source link

ModuleNotFoundError: No module named 'torch' #9003

Open jansim0n opened 8 months ago

jansim0n commented 8 months ago

😵 Describe the installation problem

Hello, I am trying to install Pytorch Geometric Temporal. If I am not mistaken, i need dependencies:

Optional dependencies:

pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv.

However, whenever I try to install these, I run into the same issue.

C:\Users\simonjan4>pip install torch_scatter torch_sparse torch_cluster torch_spline_conv
Defaulting to user installation because normal site-packages is not writeable
Collecting torch_scatter
  Using cached torch_scatter-2.1.2.tar.gz (108 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [20 lines of output]
      Traceback (most recent call last):
        File "C:\Users\simonjan4\AppData\Roaming\Python\Python311\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "C:\Users\simonjan4\AppData\Roaming\Python\Python311\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\simonjan4\AppData\Roaming\Python\Python311\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\simonjan4\AppData\Local\Temp\1\pip-build-env-5f62rl71\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\simonjan4\AppData\Local\Temp\1\pip-build-env-5f62rl71\overlay\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "C:\Users\simonjan4\AppData\Local\Temp\1\pip-build-env-5f62rl71\overlay\Lib\site-packages\setuptools\build_meta.py", line 487, in run_setup
          super().run_setup(setup_script=setup_script)
        File "C:\Users\simonjan4\AppData\Local\Temp\1\pip-build-env-5f62rl71\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 8, in <module>
      ModuleNotFoundError: No module named 'torch'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

I am able to install PyG on its own without any trouble. I tried installing with torch 2.2.0, same issue. I tried installing in different order: Pytorch-> pyg -> optional dependices, or Pytorch -> optional dependencies. I am kinda lost and would be grateful for any help.

Environment

rusty1s commented 8 months ago

Can you use the wheels via the -f option when installing external libraries?

jansim0n commented 8 months ago

I am unable to do so as I get 'SSLError(SSLCertVerificationError' .. is there a workaround?

C:\Users\simonjan4>pip install torch_scatter torch_sparse torch_cluster torch_spline_conv --trusted-host -f https://data.pyg.org/whl/torch-2.0.0+cpu.html
Defaulting to user installation because normal site-packages is not writeable
Collecting https://data.pyg.org/whl/torch-2.0.0+cpu.html
  WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002)'))': /whl/torch-2.0.0+cpu.html
  WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002)'))': /whl/torch-2.0.0+cpu.html
  WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002)'))': /whl/torch-2.0.0+cpu.html
  WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002)'))': /whl/torch-2.0.0+cpu.html
  WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002)'))': /whl/torch-2.0.0+cpu.html
rusty1s commented 8 months ago

Can you access https://data.pyg.org/whl/torch-2.0.0+cpu.html? You can download the wheels manually if required.