[Matplotlib-users] libfreetype issues on Mac OSX Big Sur

I'm running Matplotlib ver. 3.3.4 under the Anaconda distribution for Python 3.8.5 on a Mac OS X ver. 11.2. I am getting the following error:

Traceback (most recent call last):
File "temp.py", line 9, in <module>
import matplotlib.pyplot as plt
File "/Users/user/opt/anaconda3/lib/python3.8/site-packages/matplotlib/__init__.py", line 174, in <module>
_check_versions()
File "/Users/user/opt/anaconda3/lib/python3.8/site-packages/matplotlib/__init__.py", line 159, in _check_versions
from . import ft2font
ImportError: dlopen(/Users/user/opt/anaconda3/lib/python3.8/site-packages/matplotlib/ft2font.cpython-38-darwin.so, 2): Library not loaded: @rpath/libfreetype.6.dylib
Referenced from: /Users/user/opt/anaconda3/lib/python3.8/site-packages/matplotlib/ft2font.cpython-38-darwin.so
Reason: Incompatible library version: ft2font.cpython-38-darwin.so requires version 24.0.0 or later, but libfreetype.6.dylib provides version 23.0.0
(base) user@Mac-Pro ~ %

The python script being used is

#!/Users/user/opt/anaconda3/bin/python

"""
Spyder Editor

This is a temporary script file.
"""

import matplotlib.pyplot as plt
import numpy as np

plt.style.use("ggplot")

t = np.arange(0.0, 2.0, 0.1)
s = np.sin(2 * np.pi * t)
s2 = np.cos(2 * np.pi * t)
plt.plot(t, s, "o-", lw=4.1)
plt.plot(t, s2, "o-", lw=4.1)
plt.xlabel("time (s)")
plt.ylabel("Voltage (mV)")
plt.title("Simple plot \\\\frac\{\\\\alpha\}\{2\}")
plt.grid(True)

plt.savefig("test.png")

plt.show()

Any ideas?

Sam Dupree.

···

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@python.org
https://mail.python.org/mailman/listinfo/matplotlib-users

Does updating freetype with

conda update freetype

fix the problem? On my Mac running macOS 11.2 conda list freetype shows
# Name Version Build Channel
freetype 2.10.4 ha233b18_0

and otool -L ~/opt/anaconda3/lib/libfreetype.6.dylib returns
~/opt/anaconda3/lib/libfreetype.6.dylib:
  @rpath/libfreetype.6.dylib (compatibility version 24.0.0, current version 24.4.0)

Hth,
Scott

···

On Feb 1, 2021, at 17:38, Samuel Dupree <sdupree@speakeasy.net> wrote:

I'm running Matplotlib ver. 3.3.4 under the Anaconda distribution for Python 3.8.5 on a Mac OS X ver. 11.2. I am getting the following error:

Traceback (most recent call last):
  File "temp.py", line 9, in <module>
    import matplotlib.pyplot as plt
  File "/Users/user/opt/anaconda3/lib/python3.8/site-packages/matplotlib/__init__.py", line 174, in <module>
    _check_versions()
  File "/Users/user/opt/anaconda3/lib/python3.8/site-packages/matplotlib/__init__.py", line 159, in _check_versions
    from . import ft2font
ImportError: dlopen(/Users/user/opt/anaconda3/lib/python3.8/site-packages/matplotlib/ft2font.cpython-38-darwin.so, 2): Library not loaded: @rpath/libfreetype.6.dylib
  Referenced from: /Users/user/opt/anaconda3/lib/python3.8/site-packages/matplotlib/ft2font.cpython-38-darwin.so
  Reason: Incompatible library version: ft2font.cpython-38-darwin.so requires version 24.0.0 or later, but libfreetype.6.dylib provides version 23.0.0
(base) user@Mac-Pro ~ %

The python script being used is

#!/Users/user/opt/anaconda3/bin/python

"""
Spyder Editor

This is a temporary script file.
"""

import matplotlib.pyplot as plt
import numpy as np

plt.style.use("ggplot")

t = np.arange(0.0, 2.0, 0.1)
s = np.sin(2 * np.pi * t)
s2 = np.cos(2 * np.pi * t)
plt.plot(t, s, "o-", lw=4.1)
plt.plot(t, s2, "o-", lw=4.1)
plt.xlabel("time (s)")
plt.ylabel("Voltage (mV)")
plt.title("Simple plot \\\\frac\{\\\\alpha\}\{2\}")
plt.grid(True)

plt.savefig("test.png")

plt.show()

Any ideas?

Sam Dupree.

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@python.org
Matplotlib-users Info Page

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@python.org
https://mail.python.org/mailman/listinfo/matplotlib-users