Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import Error: cannot import name 'ft2font' from partially initialized module 'matplotlib'

import matplotlib.pyplot as plt

output

ImportError                               Traceback (most recent call last)
<ipython-input-7-a0d2faabd9e9> in <module>
----> 1 import matplotlib.pyplot as plt

~\AppData\Roaming\Python\Python38\site-packages\matplotlib\__init__.py in <module>
    172 
    173 
--> 174 _check_versions()
    175 
    176 

~\AppData\Roaming\Python\Python38\site-packages\matplotlib\__init__.py in _check_versions()
    157     # Quickfix to ensure Microsoft Visual C++ redistributable
    158     # DLLs are loaded before importing kiwisolver
--> 159     from . import ft2font
    160 
    161     for modname, minver in [

ImportError: cannot import name 'ft2font' from partially initialized module 'matplotlib' (most likely due to a circular import) (C:\Users\p****\AppData\Roaming\Python\Python38\site-packages\matplotlib\__init__.py)

like image 599
Parthiban Marimuthu Avatar asked Jul 31 '20 07:07

Parthiban Marimuthu


1 Answers

As you are on a windows machine, there is a possible duplicate. Navigate by clicking here.

This could be an issue regarding matplotlib. A force reinstall over pip would solve the issue.

pip install matplotlib --force-reinstall

If you are working on Anaconda, launch Anaconda as Administrator,

conda install freetype --force-reinstall

This solved the same issue for me.

like image 168
Danwand N S Avatar answered Nov 14 '22 17:11

Danwand N S