pytorch_scatter
pytorch_scatter copied to clipboard
Apple Silicon Installation - M1
I can't seem to install on a Mac M1. Here is the error message associated with it
ERROR: Command errored out with exit status 1: command: /opt/homebrew/Caskroom/miniforge/base/envs/pymc3_env/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/67/1zh45x_x17v1tz3sqxhy05kh0000gn/T/pip-install-_hnwmodl/torch-scatter_8a2ae8d9b26b4d20ad0a92e8aca914d0/setup.py'"'"'; file='"'"'/private/var/folders/67/1zh45x_x17v1tz3sqxhy05kh0000gn/T/pip-install-_hnwmodl/torch-scatter_8a2ae8d9b26b4d20ad0a92e8aca914d0/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /private/var/folders/67/1zh45x_x17v1tz3sqxhy05kh0000gn/T/pip-record-0nsnkgt5/install-record.txt --single-version-externally-managed --compile --install-headers /opt/homebrew/Caskroom/miniforge/base/envs/pymc3_env/include/python3.9/torch-scatter cwd: /private/var/folders/67/1zh45x_x17v1tz3sqxhy05kh0000gn/T/pip-install-_hnwmodl/torch-scatter_8a2ae8d9b26b4d20ad0a92e8aca914d0/ Complete output (31 lines): Compiling without OpenMP... Compiling without OpenMP... Compiling without OpenMP... Compiling without OpenMP... /opt/homebrew/Caskroom/miniforge/base/envs/pymc3_env/lib/python3.9/site-packages/setuptools/dist.py:717: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead warnings.warn( running install running build running build_py creating build creating build/lib.macosx-11.0-arm64-3.9 creating build/lib.macosx-11.0-arm64-3.9/torch_scatter copying torch_scatter/placeholder.py -> build/lib.macosx-11.0-arm64-3.9/torch_scatter copying torch_scatter/init.py -> build/lib.macosx-11.0-arm64-3.9/torch_scatter copying torch_scatter/segment_csr.py -> build/lib.macosx-11.0-arm64-3.9/torch_scatter copying torch_scatter/segment_coo.py -> build/lib.macosx-11.0-arm64-3.9/torch_scatter copying torch_scatter/utils.py -> build/lib.macosx-11.0-arm64-3.9/torch_scatter copying torch_scatter/scatter.py -> build/lib.macosx-11.0-arm64-3.9/torch_scatter creating build/lib.macosx-11.0-arm64-3.9/torch_scatter/composite copying torch_scatter/composite/std.py -> build/lib.macosx-11.0-arm64-3.9/torch_scatter/composite copying torch_scatter/composite/init.py -> build/lib.macosx-11.0-arm64-3.9/torch_scatter/composite copying torch_scatter/composite/logsumexp.py -> build/lib.macosx-11.0-arm64-3.9/torch_scatter/composite copying torch_scatter/composite/softmax.py -> build/lib.macosx-11.0-arm64-3.9/torch_scatter/composite running build_ext building 'torch_scatter._scatter_cpu' extension creating build/temp.macosx-11.0-arm64-3.9 creating build/temp.macosx-11.0-arm64-3.9/csrc creating build/temp.macosx-11.0-arm64-3.9/csrc/cpu arm64-apple-darwin20.0.0-clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -isystem /opt/homebrew/Caskroom/miniforge/base/envs/pymc3_env/include -arch arm64 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -isystem /opt/homebrew/Caskroom/miniforge/base/envs/pymc3_env/include -arch arm64 -falign-functions-8 -D_FORTIFY_SOURCE=2 -isystem /opt/homebrew/Caskroom/miniforge/base/envs/pymc3_env/include -Icsrc -I/opt/homebrew/Caskroom/miniforge/base/envs/pymc3_env/lib/python3.9/site-packages/torch/include -I/opt/homebrew/Caskroom/miniforge/base/envs/pymc3_env/lib/python3.9/site-packages/torch/include/torch/csrc/api/include -I/opt/homebrew/Caskroom/miniforge/base/envs/pymc3_env/lib/python3.9/site-packages/torch/include/TH -I/opt/homebrew/Caskroom/miniforge/base/envs/pymc3_env/lib/python3.9/site-packages/torch/include/THC -I/opt/homebrew/Caskroom/miniforge/base/envs/pymc3_env/include/python3.9 -c csrc/cpu/scatter_cpu.cpp -o build/temp.macosx-11.0-arm64-3.9/csrc/cpu/scatter_cpu.o -O2 -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="_clang" -DPYBIND11_STDLIB="_libcpp" -DPYBIND11_BUILD_ABI="_cxxabi1002" -DTORCH_EXTENSION_NAME=_scatter_cpu -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14 clang-11: error: unknown argument: '-falign-functions-8' error: command '/opt/homebrew/Caskroom/miniforge/base/envs/pymc3_env/bin/arm64-apple-darwin20.0.0-clang' failed with exit code 1 ---------------------------------------- ERROR: Command errored out with exit status 1: /opt/homebrew/Caskroom/miniforge/base/envs/pymc3_env/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/67/1zh45x_x17v1tz3sqxhy05kh0000gn/T/pip-install-_hnwmodl/torch-scatter_8a2ae8d9b26b4d20ad0a92e8aca914d0/setup.py'"'"'; file='"'"'/private/var/folders/67/1zh45x_x17v1tz3sqxhy05kh0000gn/T/pip-install-_hnwmodl/torch-scatter_8a2ae8d9b26b4d20ad0a92e8aca914d0/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /private/var/folders/67/1zh45x_x17v1tz3sqxhy05kh0000gn/T/pip-record-0nsnkgt5/install-record.txt --single-version-externally-managed --compile --install-headers
AFAIK, installing torch-scatter
on M1 should work as well, but I have no machine to test that for myself. Maybe @reshinthadithyan can give you further guidance.
@ngold5, can you point me to the command you used? I'll try to reproduce here. Everything works fine for me. This is my configuration,
torch 1.9.0
torch-cluster 1.5.9
torch-geometric 2.0.1
torch-scatter 2.0.7
torch-sparse 0.6.10
torch-spline-conv 1.2.1
@reshinthadithyan
I tried the following:
pip install torch-scatter -f https://pytorch-geometric.com/whl/torch-1.9.0+cpu.html
This took a long time to get here. But i managed to get a stable PyG ecosystem set up on my 2021 MacBook Pro Apple M1 Max (OSX 12.3.1 ). The following worked for me:
$ conda update conda
$ conda create -n M1Max python=3.8
$ conda activate M1Max
$ conda install -y clang_osx-arm64 clangxx_osx-arm64 gfortran_osx-arm64
$ MACOSX_DEPLOYMENT_TARGET=12.3 CC=clang CXX=clang++ python -m pip --no-cache-dir install torch torchvision torchaudio
$ python -c "import torch; print(torch.__version__)" #---> (Confirm the version is 1.11.0)
$ MACOSX_DEPLOYMENT_TARGET=12.3 CC=clang CXX=clang++ python -m pip --no-cache-dir install torch-scatter -f https://data.pyg.org/whl/torch-1.11.0+${cpu}.html
$ MACOSX_DEPLOYMENT_TARGET=12.3 CC=clang CXX=clang++ python -m pip --no-cache-dir install torch-sparse -f https://data.pyg.org/whl/torch-1.11.0+${cpu}.html
$ MACOSX_DEPLOYMENT_TARGET=12.3 CC=clang CXX=clang++ python -m pip --no-cache-dir install torch-geometric
This took a long time to get here. But i managed to get a stable PyG ecosystem set up on my 2021 MacBook Pro Apple M1 Max (OSX 12.3.1 ). The following worked for me:
$ conda update conda $ conda create -n M1Max python=3.8 $ conda activate M1Max $ conda install -y clang_osx-arm64 clangxx_osx-arm64 gfortran_osx-arm64 $ MACOSX_DEPLOYMENT_TARGET=12.3 CC=clang CXX=clang++ python -m pip --no-cache-dir install torch torchvision torchaudio $ python -c "import torch; print(torch.__version__)" #---> (Confirm the version is 1.11.0) $ MACOSX_DEPLOYMENT_TARGET=12.3 CC=clang CXX=clang++ python -m pip --no-cache-dir install torch-scatter -f https://data.pyg.org/whl/torch-1.11.0+${cpu}.html $ MACOSX_DEPLOYMENT_TARGET=12.3 CC=clang CXX=clang++ python -m pip --no-cache-dir install torch-sparse -f https://data.pyg.org/whl/torch-1.11.0+${cpu}.html $ MACOSX_DEPLOYMENT_TARGET=12.3 CC=clang CXX=clang++ python -m pip --no-cache-dir install torch-geometric
@pythonpanda2 thanks for sharing! Fixed my issues as well.
This took a long time to get here. But i managed to get a stable PyG ecosystem set up on my 2021 MacBook Pro Apple M1 Max (OSX 12.3.1 ). The following worked for me:
$ conda update conda $ conda create -n M1Max python=3.8 $ conda activate M1Max $ conda install -y clang_osx-arm64 clangxx_osx-arm64 gfortran_osx-arm64 $ MACOSX_DEPLOYMENT_TARGET=12.3 CC=clang CXX=clang++ python -m pip --no-cache-dir install torch torchvision torchaudio $ python -c "import torch; print(torch.__version__)" #---> (Confirm the version is 1.11.0) $ MACOSX_DEPLOYMENT_TARGET=12.3 CC=clang CXX=clang++ python -m pip --no-cache-dir install torch-scatter -f https://data.pyg.org/whl/torch-1.11.0+${cpu}.html $ MACOSX_DEPLOYMENT_TARGET=12.3 CC=clang CXX=clang++ python -m pip --no-cache-dir install torch-sparse -f https://data.pyg.org/whl/torch-1.11.0+${cpu}.html $ MACOSX_DEPLOYMENT_TARGET=12.3 CC=clang CXX=clang++ python -m pip --no-cache-dir install torch-geometric
Hello, thank you for sharing, I tried your way, but got that error after running this line: conda install -y clang_osx-arm64 clangxx_osx-arm64 gfortran_osx-arm64 maybe you what is happening. Below is the error itself.
PackagesNotFoundError: The following packages are not available from current channels:
- gfortran_osx-arm64
- clangxx_osx-arm64
- clang_osx-arm64
Current channels:
- https://repo.anaconda.com/pkgs/main/osx-64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/r/osx-64
- https://repo.anaconda.com/pkgs/r/noarch
To search for alternate channels that may provide the conda package you're looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
Thank you in advance and best regards.
Thank you! Worked for me as well on OSX 12.4 and torch 1.12.1
conda update conda
conda create -n M1Max python=3.9
conda activate M1Max
conda install -y clang_osx-arm64 clangxx_osx-arm64 gfortran_osx-arm64
MACOSX_DEPLOYMENT_TARGET=12.4 CC=clang CXX=clang++ python -m pip --no-cache-dir install torch torchvision torchaudio
python -c "import torch; print(torch.__version__)" #---> (Confirm the version is 1.12.1)
MACOSX_DEPLOYMENT_TARGET=12.4 CC=clang CXX=clang++ python -m pip --no-cache-dir install torch-scatter -f https://data.pyg.org/whl/torch-1.12.1+${cpu}.html
MACOSX_DEPLOYMENT_TARGET=12.4 CC=clang CXX=clang++ python -m pip --no-cache-dir install torch-sparse -f https://data.pyg.org/whl/torch-1.12.1+${cpu}.html
MACOSX_DEPLOYMENT_TARGET=12.4 CC=clang CXX=clang++ python -m pip --no-cache-dir install torch-geometric
and some other things that you need anyway:
MACOSX_DEPLOYMENT_TARGET=12.4 CC=clang CXX=clang++ python -m pip --no-cache-dir install matplotlib
MACOSX_DEPLOYMENT_TARGET=12.4 CC=clang CXX=clang++ python -m pip --no-cache-dir install networkx
这花了很长时间才到这里。但我设法在我的 2021 MacBook Pro Apple M1 Max ( OSX 12.3.1 ) 上建立了一个稳定的 PyG 生态系统。以下对我有用:
$ conda update conda $ conda create -n M1Max python=3.8 $ conda activate M1Max $ conda install -y clang_osx-arm64 clangxx_osx-arm64 gfortran_osx-arm64 $ MACOSX_DEPLOYMENT_TARGET=12.3 CC=clang CXX=clang++ python -m pip --no-cache-dir install torch torchvision torchaudio $ python -c "import torch; print(torch.__version__)" #---> (Confirm the version is 1.11.0) $ MACOSX_DEPLOYMENT_TARGET=12.3 CC=clang CXX=clang++ python -m pip --no-cache-dir install torch-scatter -f https://data.pyg.org/whl/torch-1.11.0+${cpu}.html $ MACOSX_DEPLOYMENT_TARGET=12.3 CC=clang CXX=clang++ python -m pip --no-cache-dir install torch-sparse -f https://data.pyg.org/whl/torch-1.11.0+${cpu}.html $ MACOSX_DEPLOYMENT_TARGET=12.3 CC=clang CXX=clang++ python -m pip --no-cache-dir install torch-geometric
Hello, thank you very much for your sharing, but now the Pytorch version of a paper I want to reproduce is 1.8.1, is there any way to operate this? Looking forward to your reply and answers
@ngold5,你能指出你使用的命令吗?我会尝试在这里重现。一切对我来说都很好。这是我的配置,
torch 1.9.0 torch-cluster 1.5.9 torch-geometric 2.0.1 torch-scatter 2.0.7 torch-sparse 0.6.10 torch-spline-conv 1.2.1
Hello, can you share your specific configuration method, I want to configure Pytorch1.8.1 version.
I am not sure if PyTorch 1.8 supports M1. Do you desperately need such an old version?
我不确定 PyTorch 1.8 是否支持 M1。你迫切需要这样一个旧版本吗?
Thank you very much for your reply. Because the PyTorch version of the code I reproduced for the paper is 1.8.1. At present, I used the method you shared to install version 1.12, and then there was a problem when running the code. It may be that the version is not compatible with the code.😭
What's the error message you are seeing? It shouldn't be too hard to update a code base to latest PyTorch version.
There is no suitable torch_sparse package for arm structure(only x86),so how can i install torch_sparse on my Macbook pro2021?
You need to install from source, either by cloning the package or running pip install --verbose torch-sparse
.
Thank you! Worked for me as well on OSX 12.4 and torch 1.12.1
conda update conda conda create -n M1Max python=3.9 conda activate M1Max conda install -y clang_osx-arm64 clangxx_osx-arm64 gfortran_osx-arm64 MACOSX_DEPLOYMENT_TARGET=12.4 CC=clang CXX=clang++ python -m pip --no-cache-dir install torch torchvision torchaudio python -c "import torch; print(torch.__version__)" #---> (Confirm the version is 1.12.1) MACOSX_DEPLOYMENT_TARGET=12.4 CC=clang CXX=clang++ python -m pip --no-cache-dir install torch-scatter -f https://data.pyg.org/whl/torch-1.12.1+${cpu}.html MACOSX_DEPLOYMENT_TARGET=12.4 CC=clang CXX=clang++ python -m pip --no-cache-dir install torch-sparse -f https://data.pyg.org/whl/torch-1.12.1+${cpu}.html MACOSX_DEPLOYMENT_TARGET=12.4 CC=clang CXX=clang++ python -m pip --no-cache-dir install torch-geometric
and some other things that you need anyway:
MACOSX_DEPLOYMENT_TARGET=12.4 CC=clang CXX=clang++ python -m pip --no-cache-dir install matplotlib MACOSX_DEPLOYMENT_TARGET=12.4 CC=clang CXX=clang++ python -m pip --no-cache-dir install networkx
I'm trying to install pytorch geometric in MacOS Ventura 13.0.1 and I cannot install torch-sparse. Anyone know how to do it? I've also change the MACOSX_DEPLOYMENT_TARGET to 13 but without any results ...
This is the error I get:
`Building wheels for collected packages: torch-sparse Building wheel for torch-sparse (setup.py) ... error error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [69 lines of output] Compiling without OpenMP... Compiling without OpenMP... Compiling without OpenMP... Compiling without OpenMP... Compiling without OpenMP... Compiling without OpenMP... Compiling without OpenMP... Compiling without OpenMP... Compiling without OpenMP... Compiling without OpenMP... Compiling without OpenMP... Compiling without OpenMP... Compiling without OpenMP... running bdist_wheel running build running build_py creating build creating build/lib.macosx-11.1-arm64-cpython-39 creating build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/matmul.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/permute.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/add.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/reduce.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/narrow.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/masked_select.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/cat.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/eye.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/convert.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/coalesce.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/init.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/tensor.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/bandwidth.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/mul.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/transpose.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/utils.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/diag.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/rw.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/storage.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/sample.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/spspmm.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/index_select.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/saint.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/select.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/spadd.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/padding.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/spmm.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/metis.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse running egg_info writing torch_sparse.egg-info/PKG-INFO writing dependency_links to torch_sparse.egg-info/dependency_links.txt writing requirements to torch_sparse.egg-info/requires.txt writing top-level names to torch_sparse.egg-info/top_level.txt reading manifest file 'torch_sparse.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no previously-included files matching '*' found under directory 'test' adding license file 'LICENSE' writing manifest file 'torch_sparse.egg-info/SOURCES.txt' running build_ext building 'torch_sparse._spspmm_cpu' extension creating build/temp.macosx-11.1-arm64-cpython-39 creating build/temp.macosx-11.1-arm64-cpython-39/csrc creating build/temp.macosx-11.1-arm64-cpython-39/csrc/cpu clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -isystem /Users/raffaele/miniconda3/envs/torch/include -I/Users/raffaele/miniconda3/envs/torch/include -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -isystem /Users/raffaele/miniconda3/envs/torch/include -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -isystem /Users/raffaele/miniconda3/envs/torch/include -D_FORTIFY_SOURCE=2 -isystem /Users/raffaele/miniconda3/envs/torch/include -DWITH_PYTHON -Icsrc -Ithird_party/parallel-hashmap -I/Users/raffaele/miniconda3/envs/torch/lib/python3.9/site-packages/torch/include -I/Users/raffaele/miniconda3/envs/torch/lib/python3.9/site-packages/torch/include/torch/csrc/api/include -I/Users/raffaele/miniconda3/envs/torch/lib/python3.9/site-packages/torch/include/TH -I/Users/raffaele/miniconda3/envs/torch/lib/python3.9/site-packages/torch/include/THC -I/Users/raffaele/miniconda3/envs/torch/include/python3.9 -c csrc/cpu/spspmm_cpu.cpp -o build/temp.macosx-11.1-arm64-cpython-39/csrc/cpu/spspmm_cpu.o -O2 -Wno-sign-compare -arch arm64 -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="_clang" -DPYBIND11_STDLIB="_libcpp" -DPYBIND11_BUILD_ABI="_cxxabi1002" -DTORCH_EXTENSION_NAME=_spspmm_cpu -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14 In file included from csrc/cpu/spspmm_cpu.cpp:3: csrc/cpu/utils.h:40:3: error: use of undeclared identifier 'CHECK_LT' CHECK_LT(low, high); ^ 1 error generated. error: command '/Users/raffaele/miniconda3/envs/torch/bin/clang' failed with exit code 1 [end of output]
note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for torch-sparse Running setup.py clean for torch-sparse Failed to build torch-sparse Installing collected packages: torch-sparse Running setup.py install for torch-sparse ... error error: subprocess-exited-with-error
× Running setup.py install for torch-sparse did not run successfully. │ exit code: 1 ╰─> [71 lines of output] Compiling without OpenMP... Compiling without OpenMP... Compiling without OpenMP... Compiling without OpenMP... Compiling without OpenMP... Compiling without OpenMP... Compiling without OpenMP... Compiling without OpenMP... Compiling without OpenMP... Compiling without OpenMP... Compiling without OpenMP... Compiling without OpenMP... Compiling without OpenMP... running install /Users/raffaele/miniconda3/envs/torch/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. warnings.warn( running build running build_py creating build creating build/lib.macosx-11.1-arm64-cpython-39 creating build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/matmul.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/permute.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/add.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/reduce.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/narrow.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/masked_select.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/cat.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/eye.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/convert.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/coalesce.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/init.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/tensor.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/bandwidth.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/mul.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/transpose.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/utils.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/diag.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/rw.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/storage.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/sample.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/spspmm.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/index_select.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/saint.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/select.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/spadd.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/padding.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/spmm.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse copying torch_sparse/metis.py -> build/lib.macosx-11.1-arm64-cpython-39/torch_sparse running egg_info writing torch_sparse.egg-info/PKG-INFO writing dependency_links to torch_sparse.egg-info/dependency_links.txt writing requirements to torch_sparse.egg-info/requires.txt writing top-level names to torch_sparse.egg-info/top_level.txt reading manifest file 'torch_sparse.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no previously-included files matching '*' found under directory 'test' adding license file 'LICENSE' writing manifest file 'torch_sparse.egg-info/SOURCES.txt' running build_ext building 'torch_sparse._spspmm_cpu' extension creating build/temp.macosx-11.1-arm64-cpython-39 creating build/temp.macosx-11.1-arm64-cpython-39/csrc creating build/temp.macosx-11.1-arm64-cpython-39/csrc/cpu clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -isystem /Users/raffaele/miniconda3/envs/torch/include -I/Users/raffaele/miniconda3/envs/torch/include -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -isystem /Users/raffaele/miniconda3/envs/torch/include -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -isystem /Users/raffaele/miniconda3/envs/torch/include -D_FORTIFY_SOURCE=2 -isystem /Users/raffaele/miniconda3/envs/torch/include -DWITH_PYTHON -Icsrc -Ithird_party/parallel-hashmap -I/Users/raffaele/miniconda3/envs/torch/lib/python3.9/site-packages/torch/include -I/Users/raffaele/miniconda3/envs/torch/lib/python3.9/site-packages/torch/include/torch/csrc/api/include -I/Users/raffaele/miniconda3/envs/torch/lib/python3.9/site-packages/torch/include/TH -I/Users/raffaele/miniconda3/envs/torch/lib/python3.9/site-packages/torch/include/THC -I/Users/raffaele/miniconda3/envs/torch/include/python3.9 -c csrc/cpu/spspmm_cpu.cpp -o build/temp.macosx-11.1-arm64-cpython-39/csrc/cpu/spspmm_cpu.o -O2 -Wno-sign-compare -arch arm64 -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="_clang" -DPYBIND11_STDLIB="_libcpp" -DPYBIND11_BUILD_ABI="_cxxabi1002" -DTORCH_EXTENSION_NAME=_spspmm_cpu -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14 In file included from csrc/cpu/spspmm_cpu.cpp:3: csrc/cpu/utils.h:40:3: error: use of undeclared identifier 'CHECK_LT' CHECK_LT(low, high); ^ 1 error generated. error: command '/Users/raffaele/miniconda3/envs/torch/bin/clang' failed with exit code 1 [end of output]
note: This error originates from a subprocess, and is likely not a problem with pip. error: legacy-install-failure
× Encountered error while trying to install package. ╰─> torch-sparse
note: This is an issue with the package mentioned above, not pip. hint: See above for output from the failure.`
same as @raffaelepojer. can't install torch-sparse
Same ^
Same
This is fixed in torch-sparse
master, so running
pip install git+https://github.com/rusty1s/pytorch_sparse.git
should work :)
It has worked perfectly for me, thanks!
Same. Thanks!
I'm still having issues compiling to native arm64 on PowerBook with M1 Max processor. I can compile fine when emulating (platform.processor() => 'i386').
Python 3.9 (platform.processor() => 'arm'), PyTorch 1.13 (torch.backends.mps.is_available() => True), installed through conda. Then "conda install clang_osx-arm64 clangxx_osx-arm64 gfortran_osx-arm64 --channel conda-forge" succeeds.
But:
pip install git+https://github.com/rusty1s/pytorch_sparse.git Dies with: subprocess.CalledProcessError: Command '['which', 'x86_64-apple-darwin13.4.0-clang++']' returned non-zero exit status 1. While: MACOSX_DEPLOYMENT_TARGET=12.6.1 CC=clang CXX=clang++ python -m pip --no-cache-dir install torch-sparse -f pip install git+https://github.com/rusty1s/pytorch_sparse.git Dies with: clang-14: error: the clang compiler does not support '-march=core2'
Are you currently supporting arm64 architecture natively? Is there a flag to the script that will fix this?
A side question: I assume scatter, sparse, etc. are not yet accelerated with MPS? Is that planned for the future? Thanks!
I can install this package fine on my M1 on a fresh arm64 conda with only PyTorch installation (no need for me to install any additional compiler). Not sure what goes wrong on your end :(
We currently don't have plans to support MPS since we are currently in the process of upstreaming most of the components in torch-scatter
and torch-sparse
to PyTorch directly, e.g., see torch.scatter_reduce
.
Thank you! Not installing clang allowed the install to work. For pyg-lib and pytorch_sparse I had to compile from master
pip install git+https://github.com/pyg-team/pyg-lib.git
However, running the code is still an issue because the 'mps' device is not recognized by the scatter ops:
scatter_max(src, index, dim, out, dim_size) Traceback (most recent call last): File "/Users/abc/opt/miniconda3/envs/pyg3.9_m1/lib/python3.9/site-packages/torch/_ops.py", line 442, in call return self._op(*args, **kwargs or {}) RuntimeError: src.device().is_cpu() INTERNAL ASSERT FAILED at "csrc/cpu/scatter_cpu.cpp":11, please report a bug to PyTorch. src must be CPU tensor
Possible workaround is to wrap all the operations with code to move the tensors to .cpu() and results back to .mps() when input is mps, though this is a bit ugly and may be expensive. Any other suggestions?
Do you have a timeframe for moving to the upstream components?
Yeah, that makes sense. I can't think of another workaround right now.
Note that torch.scatter
is already upstreamed to PyTorch via torch.scatter_reduce
, but I am not sure if it supports the mps
device type.
Thanks for all the help here.
On MacOS 13.0.1, I was able to install torch_scatter and torch_sparse using a clean conda environment with only torch 1.13.0 installed (so no clang as mentioned earlier). I used the following commands:
pip install git+https://github.com/rusty1s/pytorch_sparse.git
pip install git+https://github.com/rusty1s/pytorch_scatter.git
pip install --install-option="--disable-embedded-cryptopp" torch_sparse
worked for me
Thank you all for the help!
I was also able to create a fully functional conda environment with Pytorch 1.13.0, torch_sparse, torch_scatter and torch_cluster on my M1 Max processor and MacOS 13.0.1.
conda create -n pyg-m1 python=3.10
conda activate pyg-m1
pip install --no-cache-dir torch==1.13.0 torchvision torchaudio
pip install git+https://github.com/rusty1s/pytorch_sparse.git
pip install git+https://github.com/rusty1s/pytorch_scatter.git
pip install git+https://github.com/rusty1s/pytorch_cluster.git
pip --no-cache-dir install torch-geometric
This worked for me. Thanks :)
Above commands also makes some version mistake for me, here is my config, maybe helpful for someone.
conda create -n torch python=3.8
conda activate torch
conda install -y clang_osx-arm64 clangxx_osx-arm64 gfortran_osx-arm64
MACOSX_DEPLOYMENT_TARGET=13.1 CC=clang CXX=clang++ python -m pip --no-cache-dir install torch=1.11.0 torchvision torchaudio
python -c "import torch; print(torch.__version__)" #---> (Confirm the version is 1.11.0)
MACOSX_DEPLOYMENT_TARGET=13.1 CC=clang CXX=clang++ python -m pip --no-cache-dir install torch-scatter -f https://data.pyg.org/whl/torch-1.11.0+${cpu}.html
MACOSX_DEPLOYMENT_TARGET=13.1 CC=clang CXX=clang++ python -m pip --no-cache-dir install torch-sparse==0.6.14 -f https://data.pyg.org/whl/torch-1.11.0+${cpu}.html
MACOSX_DEPLOYMENT_TARGET=13.1 CC=clang CXX=clang++ python -m pip --no-cache-dir install torch-geometric