I am trying to run a code that I wrote a couple of years ago that uses mpl
from matplotlib
. It used to run fine, but now suddently it's throwing an error:
from matplotlib import mpl
ImportError: cannot import name mpl
I am using Python 2.7 and matplotlib 1.5.2.
You need to use:
import matplotlib as mpl
It really did work in earlier versions but it was first deprecated (in version 1.3):
The
mpl
module is now deprecated. Those who relied on this module should transition to simply usingimport matplotlib as mpl
.
and then removed (in version 1.5.0):
Remove the module
matplotlib.mpl
. Deprecated in 1.3 by PR #1670 and commit 78ce67d161625833cacff23cfe5d74920248c5b2
I think that you cannot import "mpl" from matlotlib because it doesn't exist. I guess you want to try to import matplotlib AS mpl. You should try this :
import matplotlib as mpl
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With