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.

hithisispeter
  • 251
  • 1
  • 3
  • 4

4 Answers4

21

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
climatebrad
  • 928
  • 4
  • 12
  • 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. – hithisispeter Feb 10 '21 at 19:22
  • 2
    I'm not sure how you set it up. The [homebrew installer](https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/miniforge.rb) does correctly install the ARM version of miniforge on M1 chips. – climatebrad Feb 12 '21 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 03 '21 at 10:56
  • 2
    What does “not allowed to use anaconda in a commercial context” mea? – yts61 Apr 15 '21 at 23:23
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.

Eugene
  • 481
  • 3
  • 7
  • 12
4

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
C Wilke
  • 11
  • 4
  • 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. – william_grisaitis May 19 '21 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 '21 at 03:08