Acrogenesis' Blog

Acrogenesis' Blog

Stories of a developer life.

Acrogenesis' Blog
< Back

Running Intel Python on M1

|

Following these instructions should enable you to have both arm and intel python installed and ready to use.

You should run everything you can with arm version of python. Only use the intel version if you are having trouble.

If you’ve previously tried installing python with any other method, be sure to fully remove it.

We’ll start setting up our arm and intel environments by setting up a Rossetta-Terminal, which runs on intel. Follow the Create a Rosetta Terminal tutorial.

Python3 ARM Installation

These two steps must be run in the regular Terminal (arm)

  1. Install brew in Terminal.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. Install python3 running brew install python3.

Hombrew keeps x86 binaries in /usr/local and uses /opt/homebrew for their ARM binaries.

Python3 Intel Installation

All the steps below should be run in Rosetta-Terminal

  1. Install brew in Rosetta-Terminal.
  2. Create alias in ~/.zprofile for intel brew alias ibrew='arch -x86_64 /usr/local/bin/brew'. Your ~/.zprofile should look like this.
eval "$(/opt/homebrew/bin/brew shellenv)"
alias ibrew='arch -x86_64 /usr/local/bin/brew'
  1. Load alias running
source ~/.zprofile
  1. Install intel python3
ibrew install python3

You can specify a version like this:

ibrew install [email protected]

This previous step will give you where python is installed, e.g. /usr/local/opt/[email protected]/bin/python3 Python Install Location

You should now have installed both arm and intel versions of python. Whenever you need to use intel python, be sure to open the Rosetta-Terminal and load the intel python. For example, if you use pipenv for managing virtual envs and packages, run this in your project folder:

pipenv shell --python /usr/local/opt/[email protected]/bin/python3