Support for M1 Macs
-- SEE UPDATES LATER IN THREAD --
Pandana runs on the new M1 ARM-based Macs without much trouble.
Installing Python
One option is to install Anaconda in the normal way, which for now gives you x86 binaries that runs through a translation layer. All the Python libraries I tried ran fine as x86 binaries. Performance was similar to my i7 MacBook Pro.
The Conda Forge team is doing great work with ARM builds, though. So another option is to install the osx-arm64 build of MiniForge from here. This will set you up to conda-install the ARM builds of packages on Conda Forge, which there are already quite a lot of. More info about the Conda Forge work here: https://conda-forge.org/blog/posts/2020-10-29-macos-arm64/
Installing Pandana
If you're using an x86 Python installation, you can install Pandana in any normal way (conda, pip, etc).
To get ARM binaries for Pandana, you'll need to compile locally. In my testing, the performance is about 35% better. It seems like Python environments need to be either all-x86 or all-ARM.
-
Clone the
osx-arm64Pandana branch from GitHub. -
Conda-install the key dependencies:
clang,llvm-openmp,cython,numpy,pandas,scikit-learn. You should see in the status messages that you're gettingosx-arm64binaries. -
Compile & install Pandana with
python setup.py develop.I ran into a glitch involving a "No such file or directory" error after a compilation command that used
arm64-apple-darwin20.0.0-clang++. I fixed it by going into the MiniForge binaries folder (find it withwhich clang) and renaming theclang++file with the longer name. This will probably be fixed upstream at some point.
That should do it! The only caveat is that there's no PyTables build for ARM at this point, so you will not be able to work with h5 files.
What's different in the osx-arm64 branch?
-
Replaced
distutilswith the newersetuptools, which correctly detects that ARM should be the compilation target. -
Commented out the PyTables dependency, because there isn't an ARM build available yet.
-
Commented out C++ code related to hyper-threading, because it included some lines of x86 assembly that couldn't be compiled on ARM. The M1 does not use hyper-threading (just one process per core rather than two), so there's no performance loss. But we'll need to clean this up before merging the branch.
Next steps
It sounds like an osx-arm64 build of Pandana on Conda Forge should be straightforward (see blog post above). But at this point it's held up by the PyTables dependency.
It seems that an osx-arm64 build of pytables is available on conda-forge https://anaconda.org/conda-forge/pytables
@chourmo Oh, great! I'll clean up the osx-arm64 branch accordingly, and we should be able to publish ARM builds of Pandana too.
Binary installers for Pandana on osx-arm64 are now available from Conda Forge :tada:
Here's the current state of things. Note that it's not a problem to run older x86 Python installations and packages, including Pandana, on ARM Macs. These adjustments are just to support native compilation, which improves performance.
Installing from Conda Forge on ARM Macs
-
conda install pandanaCheck the install messages to confirm you're getting
osx-arm64binaries.
Compiling locally for ARM
Assumes you're using a copy of the codebase post-PR #159.
-
Install all of Pandana's build- and runtime requirements from Conda. Check the install messages to confirm you're getting
osx-arm64binaries.conda install clang llvm-openmp cython numpy pandas scikit-learn pytables -
Compile and install Pandana.
python setup.py develop