'ImportError: cannot import name '_png' from 'matplotlib'

I'm currently working with Python 3.7 on Pycharm and trying to get a better understanding of kivy. I found a script that I'm trying to run but I'm encountering an import error: cannot import name '_png' from 'matplotlib'

Does anybody have any solution to this? Code below:

from matplotlib import use as mpl_use
mpl_use('module://kivy.garden.matplotlib.backend_kivy')


Solution 1:[1]

matplotlib version 3.1.0 did the trick for me.

Solution 2:[2]

I am currently trying to key kivy to use bar charts from matplotlib in pycharm. If you could post your code that would be helpful. I am very new to this, so if you could explain how you use the 3.1 version too

Solution 3:[3]

I have downgraded to 3.2.2 from 3.4.1 and it works for me! Using the python 3.9.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 radwimp
Solution 2 Jacob Ellis
Solution 3 Felicidade