Apple M1 — Matplotlib, Python, and Jupyter Lab

If you recently purchased a new M1 Apple Silicon Mac, getting your development environment set up takes more effort than using an Intel based Mac. As of writing this, the information online has been limited and unanswered.

My work flow depends on Jupyter Lab, Pandas, and matplotlib. Jupyter Lab installs easily through pip, unfortunately matplotlib fails.

Pip install matplotlib fails because one of its dependencies is pillow and one of pillow’s dependency is libjpeg. The specific error is:

The headers or library files could not be found for jpeg,
a required dependency when compiling Pillow from source.

The quicker solution than reading the installation documentation is

brew install libjpeg

Solving this problem took thirty minutes of googling. I hope it takes you less time.

Working through the small problems with M1 programing reminded of “Wisdom of the Ancients” by xkcd.

Lastly, if you are having issues installing brew, see this post.

Possessed by the spirit of inquiry.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store