Trankimtrung
Trankimtrung

Reputation: 31

DLL load failed while importing ft2font: The specified module could not be found

I encountered this problem below when import matplotlib.plot as plt.

Please help me to resolve this problem. I use sublime text, Python 3.8 and window 10.

Thanks!

File "D:\PYTHONFILES\line.py", line 3, in <module>
    import matplotlib.pyplot as plt
File "C:\Users\Tran\AppData\Local\Programs\Python\Python38\lib\site-packages\matplotlib\__init__.py", line 174, in <module>
    _check_versions()
File "C:\Users\Tran\AppData\Local\Programs\Python\Python38\lib\site-packages\matplotlib\__init__.py", line 159, in _check_versions
    from . import ft2font
ImportError: DLL load failed while importing ft2font: The specified module could not be found.
[Finished in 18.5s]

Upvotes: 3

Views: 12799

Answers (2)

Ymareth
Ymareth

Reputation: 671

I experienced this error in a conda environment running as a kernel within Jupyterlab. Note the environment was not the environment running Jupyter Lab itself.

I did not get the same error importing matplotlib into the same environment but when not within Jupyter (just within a powershell).

I eliminated the error (I won't say solved) by installing matplotlib into the environment used to run Jupyter Lab as well. My theory is that this puts a copy of the dlls in a place where they can be found by the python process running as a kernel. I've noticed and fixed the same kind of issue with numpy.

So I suspect the problem, in my case at least, is with Jupyter not setting share library paths correctly and not matplotlib.

Upvotes: 1

LiamV
LiamV

Reputation: 1108

This error seems only to occur for me with matplotlib 3.3.1; downgrading to 3.3.0 also resolves for those people who cannot just install VC redist packages.

Upvotes: 0

Related Questions