matplotlib can't load ft2font on Windows 10

french bread picture french bread · Nov 5, 2017 · Viewed 11.1k times · Source

I'm using Anaconda 5.0.1 with Python 2.7.14. When I open a jupyter notebook and try to run the following:

%matplotlib inline

I get the following error:

ImportError                               Traceback (most recent call last)
C:\toolkits.win\anaconda2\envs\dlc\lib\site-packages\matplotlib\font_manager.py in <module>()
     56 
     57 import matplotlib
---> 58 from matplotlib import afm, cbook, ft2font, rcParams, get_cachedir
     59 from matplotlib.compat import subprocess
     60 from matplotlib.fontconfig_pattern import (

ImportError: DLL load failed: The specified procedure could not be found.

When I try to drill into the error, the problem is with ft2font:

In [1]: from matplotlib import ft2font
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-a32e7826851f> in <module>()
----> 1 from matplotlib import ft2font

ImportError: DLL load failed: The specified procedure could not be found.

I double-checked and made sure freetype is installed:

(dlc) C:\Users\Larry>conda install freetype
Fetching package metadata .............
Solving package specifications: .

# All requested packages already installed.
# packages in environment at C:\toolkits.win\anaconda2\envs\dlc:
#
freetype                  2.8               vc9hf582001_0  [vc9]

Any ideas?

Answer

Odysseus Ithaca picture Odysseus Ithaca · May 14, 2019

Improving a bit on the above suggestion:

pip install matplotlib --force-reinstall