Cant import matplotlib.pyplot on Apple Silicon ( Wrong Architecture Error )

Hi!

( macOS 11.1 )

So I’ll keep it short. I’m on an apple silicon machine and after I installed matplotlib ( regular pip install. got version 3.3.3 of matplotlib ) and tried to import .pyplot I got the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/justinbuan/miniforge3/envs/equinox/lib/python3.8/site-packages/matplotlib/__init__.py", line 174, in <module>
    _check_versions()
  File "/Users/justinbuan/miniforge3/envs/equinox/lib/python3.8/site-packages/matplotlib/__init__.py", line 159, in _check_versions
    from . import ft2font
ImportError: dlopen(/Users/justinbuan/miniforge3/envs/equinox/lib/python3.8/site-packages/matplotlib/ft2font.cpython-38-darwin.so, 2): no suitable image found.  Did find:
	/Users/justinbuan/miniforge3/envs/equinox/lib/python3.8/site-packages/matplotlib/ft2font.cpython-38-darwin.so: mach-o, but wrong architecture
	/Users/justinbuan/miniforge3/envs/equinox/lib/python3.8/site-packages/matplotlib/ft2font.cpython-38-darwin.so: mach-o, but wrong architecture

Additionally, I am running a virtual environment ( python 3.8.2 I believe ). But anyway, it just won’t work.

Can you try installing via conda-forge instead of pip? I do not think we have published apple silicon wheels yet.

Building from source does the trick! Works fine on my M1. I had the same error.