Discussion:
[Tutor] Myplotlab issue
b***@masonlive.gmu.edu
2015-05-19 15:58:54 UTC
Permalink
Hello,

I am currently working with a simple program in Python (just starting out) and am getting an error message:

Traceback (most recent call last):
File "/Users/nomargfan661/Desktop/PythonProjects/chapter3/graphics.py", line 3
from pylab import plot,show
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pylab.py", line 1
from matplotlib.pylab import *
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/pylab.py", line 269
from matplotlib.pyplot import *
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/pyplot.py", line 29
from matplotlib.figure import Figure, figaspect
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/figure.py", line 36
from matplotlib.axes import Axes, SubplotBase, subplot_class_factory
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/axes/__init__.py", line 4
from ._subplots import *
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/axes/_subplots.py", line 10
from matplotlib.axes._axes import Axes
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/axes/_axes.py", line 17
from matplotlib.cbook import _string_to_bool, mplDeprecation
ImportError: cannot import name _string_to_bool

With this program, I am just trying to plot data points as written in a textbook from which I am learning. I have installed everything properly (Python, VPython, numpy, and matplotlib (and as a result, pyplot). The program is:

from __future__ import division,print_function

from pylab import plot,show
y = [1.0,2.4,1.7,0.3,0.6,1.8]

plot(y)
show()

I am running Python 2.7 and all modules are compatible with version 2.7 on Mac OS X 10.10. I have tested other programs I have written which use VPython and numpy and I have no problems with those. I only have one program using matplotlib, though, so I don’t know what’s wrong. Would anybody happen to know how to help with fixing this issue?

Thanks,
Brandon


_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman
Mark Lawrence
2015-05-19 17:19:51 UTC
Permalink
Post by b***@masonlive.gmu.edu
Hello,
File "/Users/nomargfan661/Desktop/PythonProjects/chapter3/graphics.py", line 3
from pylab import plot,show
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pylab.py", line 1
from matplotlib.pylab import *
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/pylab.py", line 269
from matplotlib.pyplot import *
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/pyplot.py", line 29
from matplotlib.figure import Figure, figaspect
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/figure.py", line 36
from matplotlib.axes import Axes, SubplotBase, subplot_class_factory
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/axes/__init__.py", line 4
from ._subplots import *
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/axes/_subplots.py", line 10
from matplotlib.axes._axes import Axes
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/axes/_axes.py", line 17
from matplotlib.cbook import _string_to_bool, mplDeprecation
ImportError: cannot import name _string_to_bool
from __future__ import division,print_function
from pylab import plot,show
y = [1.0,2.4,1.7,0.3,0.6,1.8]
plot(y)
show()
I am running Python 2.7 and all modules are compatible with version 2.7 on Mac OS X 10.10. I have tested other programs I have written which use VPython and numpy and I have no problems with those. I only have one program using matplotlib, though, so I don’t know what’s wrong. Would anybody happen to know how to help with fixing this issue?
Thanks,
Brandon
From
http://stackoverflow.com/questions/26289473/pycharm-error-while-importing-matplotlib-pyplot-as-plt
"There is a package called six which matplotlib depends on. Check to
make sure it's installed...".
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
h
Loading...