Reputation: 8062
I'm running an Anaconda installation in windows 10 (conda version 4.3.8)
This is the code I'm trying to run in the python command line:
import matplotlib.pyplot as plt
x = [1,2,3,4]
y = [5,6,7,8]
plt.figure(1)
plt.plot(x,y)
The last line throws the following error:
C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\font_manager.py:971: MatplotlibDeprecationWarning: The is_string_like function was deprecated in version 2.1.
if is_string_like(family):
C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\font_manager.py:697: MatplotlibDeprecationWarning: The is_string_like function was deprecated in version 2.1.
if is_string_like(family):
C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\text.py:218: MatplotlibDeprecationWarning: The is_string_like function was deprecated in version 2.1.
elif is_string_like(fontproperties):
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\pyplot.py", line 3307, in plot
ax = gca()
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\pyplot.py", line 950, in gca
return gcf().gca(**kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\figure.py", line 1368, in gca
return self.add_subplot(1, 1, 1, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\figure.py", line 1020, in add_subplot
a = subplot_class_factory(projection_class)(self, *args, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axes\_subplots.py", line 73, in __init__
self._axes_class.__init__(self, fig, self.figbox, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axes\_base.py", line 529, in __init__
self._init_axis()
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axes\_base.py", line 622, in _init_axis
self.xaxis = maxis.XAxis(self)
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axis.py", line 676, in __init__
self.cla()
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axis.py", line 760, in cla
self.reset_ticks()
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axis.py", line 771, in reset_ticks
cbook.popall(self.majorTicks)
AttributeError: module 'matplotlib.cbook' has no attribute 'popall'
I'm running this in the root environment Also here is part of the output of the conda list
Are multiple versions of matplotlib in root causing this? How do I resolve this?
Upvotes: 3
Views: 5616
Reputation: 20658
It's also caused by a version mismatch between networkx and matplotlib. Just uninstall all versions of matplotlib and networkx:
sudo pip3 uninstall networkx
sudo pip3 uninstall matplotlib
python3 -mpip uninstall matplotlib
sudo conda uninstall matplotlib
If you've installed networkx via other sources like mpip or conda, uninstall those too.
Then install both of them:
sudo pip3 install networkx
sudo pip3 install matplotlib
Now the program will work.
Upvotes: 0
Reputation: 41
While attempting to use matplotlib.pyplot with the latest version of matplotlib (updated through the Anaconda distribution) I got a very similar error. The error appears to be between the root python version and the Anaconda distribution as the following solves the problem:
Multiple versions of matplotlib does appear to be the issue. This was inferred from the following information (provided in the form of screenshots):
Note the matplotlib versions mentioned in the two screenshots. Hope this helps!
Upvotes: 4