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.
Lastly, if you are having issues installing brew, see this post.