rusty1s / pytorch_scatter

PyTorch Extension Library of Optimized Scatter Operations
https://pytorch-scatter.readthedocs.io
MIT License
1.5k stars 178 forks source link

ModuleNotFoundError: No module named 'torch' while installing torch-scatter using pip on MacOS #424

Open atharvabagde opened 4 months ago

atharvabagde commented 4 months ago

I am unable to install torch-scatter using the following command : pip install torch-scatter -f https://data.pyg.org/whl/torch-2.1.0+cpu.html

Getting the following error:

(project_990) atharvbagde@Atharvs-Laptop ~ % pip install torch-scatter -f https://data.pyg.org/whl/torch-2.1.0+cpu.html Looking in links: https://data.pyg.org/whl/torch-2.1.0+cpu.html 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 ╰─> [17 lines of output] Traceback (most recent call last): File "/Users/atharvbagde/.pyenv/versions/3.10.4/envs/project_990/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in main() File "/Users/atharvbagde/.pyenv/versions/3.10.4/envs/project_990/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main json_out['return_val'] = hook(**hook_input['kwargs']) File "/Users/atharvbagde/.pyenv/versions/3.10.4/envs/project_990/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel return hook(config_settings) File "/private/var/folders/rh/0y4zwnyd49l6pmndmmg3lh7h0000gn/T/pip-build-env-u4d8oq9d/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=['wheel']) File "/private/var/folders/rh/0y4zwnyd49l6pmndmmg3lh7h0000gn/T/pip-build-env-u4d8oq9d/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires self.run_setup() File "/private/var/folders/rh/0y4zwnyd49l6pmndmmg3lh7h0000gn/T/pip-build-env-u4d8oq9d/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 487, in run_setup super().run_setup(setup_script=setup_script) File "/private/var/folders/rh/0y4zwnyd49l6pmndmmg3lh7h0000gn/T/pip-build-env-u4d8oq9d/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 311, in run_setup exec(code, locals()) File "", line 8, in 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.

Python Virtual env details Python: 3.10.4 pip: 24.0 Torch: 2.1.0 (installed using pip install torch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0) Torch-geometric: 2.5.0 (installed using pip install torch_geometric)

MacOS M2 chip

Let me know if any other details are required

rusty1s commented 4 months ago

Can you try to install via

git clone https://github.com/rusty1s/pytorch_scatter.git
python setup.py install
atharvabagde commented 4 months ago

Yes, this does work! Are there any changes I need to make in order to install via pip? Because I am able to install simply via pip on Colab but it fails on my local Mac

rusty1s commented 4 months ago

We would have to bring https://github.com/rusty1s/pytorch_cluster/pull/208 also to torch-scatter.