c00kiemonster
c00kiemonster

Reputation: 23361

How can I get rid of ft2font import error from matplotlib on a Windows XP source installation?

So today I tried building matplotlib from source (git clone) on a Windows XP box.

First I downloaded and compiled the dependencies (zlib, libpng, freetype2) as per this blog entry. I then edited setup.cfg to make the matplotlib installation aware of the installations of the dependencies. Lastly, python setup.py build and python setup.py install ran without any errors.

But when I try a simple script for a sample plot, I get this error:

  File "C:\Python27\lib\site-packages\matplotlib\font_manager.py", line 53, in <module>
    from matplotlib import ft2font
ImportError: DLL load failed: The specified module could not be found.

Why is this happening, and how can I fix the issue?

EDIT:

I can find a file called ft2font.pyd in the matplotlib folder in the site-packages folder. This file should be able to be imported as per normal, but somehow it doesn't work.

Upvotes: 2

Views: 3838

Answers (1)

c00kiemonster
c00kiemonster

Reputation: 23361

I finally figured it out. Opening ft2font.pyd in Dependency Walker showed that libfreetype-6.dll was missing as a dependency. Turns out I had forgot to copy bin\libfreetype-6.dll to the system32 folder. After I'd copied it over matplotlib worked without a hitch.

Upvotes: 3

Related Questions