3

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]
Sergey Shubin
  • 3,040
  • 4
  • 24
  • 36
Trankimtrung
  • 31
  • 1
  • 1
  • 5

2 Answers2

1

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.

Ymareth
  • 649
  • 4
  • 15
0

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.

LiamV
  • 1,138
  • 1
  • 14
  • 21