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

Conda installation failing in m1 macbook #4549

Open
dhorka opened this issue Apr 27, 2022 · 5 comments
Open

Conda installation failing in m1 macbook #4549

dhorka opened this issue Apr 27, 2022 · 5 comments

Comments

@dhorka
Copy link

dhorka commented Apr 27, 2022

😵 Describe the installation problem

I created a new env with a fresh pyorch installation and I am not able to install pyg with conda in my MacBook with an m1 chip. I get the following error:

conda install pyg -c pyg
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  - pyg

Current channels:

  - https://conda.anaconda.org/pyg/osx-arm64
  - https://conda.anaconda.org/pyg/noarch
  - https://repo.anaconda.com/pkgs/main/osx-arm64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/osx-arm64
  - 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.

Environment

  • PyG version: The current one.
  • PyTorch version: 1.11
  • OS: Mac os
  • Python version: 3.8
  • CUDA/cuDNN version: None
  • How you installed PyTorch and PyG (conda, pip, source): conda
  • Any other relevant information (e.g., version of torch-scatter): Macbook pro with an M1 chip
@rusty1s
Copy link
Member

rusty1s commented Apr 27, 2022

We do not have arm64 support for either conda or pypi packages, but I have made good experience with installing everything from source. This worked for me out-of-the-box.

@dhorka
Copy link
Author

dhorka commented Apr 27, 2022

Could be that in the previous version you have it? For some reason, I was able to install it with pytorch 1.10

@rusty1s
Copy link
Member

rusty1s commented Apr 27, 2022

Sadly no. This always required a manual installation. I will definitely look into how we can provide arm64 wheels as well for future releases though.

@dhorka
Copy link
Author

dhorka commented Apr 27, 2022

Thanks! For some reason, I was able to install it in the past using conda and pip, however, I am not able to reproduce it. I will try to do the installation from source.

@bkreider
Copy link

bkreider commented Jun 3, 2022

@dhorka I don't have an M1 mac, but my colleague has given me some tips for m1 and conda. I have not tested these things out.

Running OSX-64 conda packages:

Rosetta2 will translate the x86 binaries and libraries on first use. This will result in a pause before starting an x86 build of Python or importing a library for the first time, but the translated binaries are cached by the operating system and used automatically in the future.

Check your activated environment to see what architecture it is using:
python -c 'import platform; print(platform.machine())'

Create an environment that uses osx-arm64 (you want the other way around):

creating an environment for the non-base platform is to do the following:

conda create -n m1 
conda activate m1
# set the platform in just this environment (--env) to osx-arm64
conda config --env --set subdir osx-arm64
# all future installs and updates will use osx-arm64 packages
conda install python=3.8 notebook pandas

The use of --env with conda config sets the configuration just for the active environment, and not the base environment. (Note that the example assumes your base environment is x86-64 and you want an osx-arm64 environment. If the reverse is true, then you need to set the subdir config to x86-64 instead.)

In your case, you want to do the opposite. Set the subdir to x86-64.

What about AVX?

One potential problem you will encounter are packages which were compiled to use AVX instructions and do not do a runtime check for AVX support. Anaconda builds of NumPy, SciPy, TensorFlow, and other libraries do not require AVX support on the CPU, although in some cases they will take advantage of AVX if detected at runtime. Other sources of packages (like TensorFlow wheels) are compiled with AVX support as a requirement. Rosetta2 cannot translate AVX instructions, so when your program hits one of them, you will get an “illegal hardware instruction” error at runtime. If you have any packages like this in your conda environment, they will not work on an ARM-based Mac.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants