25

Seems to be impossible currently with Anaconda as well as with Xcode 12. Via idle, it runs via Rosetta. There seems to be no discussion of this so either I'm quite naive or maybe this will be useful to others as well.

Python says: "As of 3.9.1, Python now fully supports building and running on macOS 11.0 (Big Sur) and on Apple Silicon Macs (based on the ARM64 architecture). A new universal build variant, universal2, is now available to natively support both ARM64 and Intel 64 in one set of executables" https://docs.python.org/3/whatsnew/3.9.html

Please help a newbie figure out how to take advantage of his recent impulse-buy.

4 Answers 4

22

You can now install python 3.9.1 through multiple pathways now but the most comprehensive build environment for the full data-science suite for python at the moment (Feb 2021) on M1 ARM architecture is via miniforge.

e.g.

brew install --cask miniforge
conda init zsh
conda activate
conda install numpy scipy scikit-learn
5
  • 2
    Thanks for your reply. The question is about running natively, not through Rosetta translation. Running python 3.9.1 on the ARM M1 chip, Python processes are labeled 'Intel Architecture' in Activity Monitor. This seems like a compiler problem. How do I compile to run natively on the ARM chip? This happens through Anaconda as well as Xcode 12. Feb 10, 2021 at 19:22
  • 2
    I'm not sure how you set it up. The homebrew installer does correctly install the ARM version of miniforge on M1 chips. Feb 12, 2021 at 18:42
  • Well it works. But the problem is that you are not allowed to use Anaconda in a commercial context. :( I hope it will become possible with a regular Python installation soon, so I can use my Mac Pro at my company.
    – ali
    Mar 3, 2021 at 10:56
  • 2
    What does “not allowed to use anaconda in a commercial context” mea?
    – yts61
    Apr 15, 2021 at 23:23
  • I refuse to use conda
    – Connor
    Jul 16 at 21:02
12

You can now install Python 3.9.4 natively on Mac M1 (Apple Silicon). I'm using pyenv to install Python 3.7, 3.8 and 3.9 all native ARM. For example, to install 3.9.4:

$ pyenv install 3.9.4
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.9.4.tar.xz...
-> https://www.python.org/ftp/python/3.9.4/Python-3.9.4.tar.xz
Installing Python-3.9.4...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
Installed Python-3.9.4 to /Users/squademy/.pyenv/versions/3.9.4

For a complete guide on install pyenv and multiple Python version, you might read this article: https://squademy.medium.com/install-python-on-macos-11-m1-apple-silicon-using-pyenv-12e0729427a9.

2
  • how stable is homebrew on arm64? ps +1 for pyenv 😎 Jul 16, 2021 at 10:06
  • 1
    Do you have your article published somewhere more accessible? That link is blocked by sign-in to Medium
    – ohhorob
    Nov 13, 2021 at 17:58
5

I am using python3.9.4. I installed it using homebrew only.

brew install python@3.9

1

I upgraded to 3.9.4

  1. Download the Python universal installer - https://www.python.org/downloads/mac-osx/

Note: I still could not get sudo pip install mysqlclient to install.
I had add to

  1. update homebrew - See https://brew.sh
  2. Add /opt/homebrew/bin to PATH in .bash_profile (don't forget to source .bash_profile) or Add /opt/homebrew/bin to PATH in .zprofile (don't forget to source .zprofile) if using zsh
2
  • 2
    does this assume your shell is bash and not zsh? with macos's change to zsh i thought we have to update .zprofile, not .bash_profile, now. May 19, 2021 at 19:04
  • 1
    You are correct! I was using old scripts on bash so had to update bash_profile. I updated the answer to include .zprofile.
    – C Wilke
    Jul 11, 2021 at 3:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.