-
Notifications
You must be signed in to change notification settings - Fork 179
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
Apple Silicon Installation - M1 #241
Comments
AFAIK, installing |
@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,
|
@reshinthadithyan |
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:
|
@pythonpanda2 thanks for sharing! Fixed my issues as well. |
Hello, thank you for sharing, I tried your way, but got that error after running this line: PackagesNotFoundError: The following packages are not available from current channels:
Current channels:
To search for alternate channels that may provide the conda package you're
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
and some other things that you need anyway:
|
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? |
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? |
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 |
I'm trying to install pytorch geometric in MacOS Ventura 13.0.1 and I cannot install torch-sparse. This is the error I get: `Building wheels for collected packages: torch-sparse × python setup.py bdist_wheel did not run successfully. note: This error originates from a subprocess, and is likely not a problem with pip. × Running setup.py install for torch-sparse did not run successfully. note: This error originates from a subprocess, and is likely not a problem with pip. × Encountered error while trying to install package. note: This is an issue with the package mentioned above, not pip. |
same as @raffaelepojer. can't install torch-sparse |
Same ^ |
Same |
This is fixed in
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:
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? |
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 |
Thank you! Not installing clang allowed the install to work. For pyg-lib and pytorch_sparse I had to compile from master
However, running the code is still an issue because the 'mps' device is not recognized by the scatter ops:
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 |
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:
|
|
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.
|
This worked for me. Thanks :) |
Above commands also makes some version mistake for me, here is my config, maybe helpful for someone.
|
This issue had no activity for 6 months. It will be closed in 2 weeks unless there is some new activity. Is this issue already resolved? |
Hey worked for me as well. Just wanted to add in a question. When you activate "M1Max", is that virtual environment that is being created in which we are installing PyTorch-Geometric? |
yes like for example : yourname env
|
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
The text was updated successfully, but these errors were encountered: