[Tutor] Problems with matplotlib

Jason Snyder jmssnyder at ucdavis.edu
Fri Mar 3 17:59:39 EST 2017


I installed the python module matplotlib on a computer and when I try to
run a program with the commands:

import matplotlib.pyplot as plt I get the following errors:

Traceback (most recent call last):
  File "new.py", line 1, in <module>
    import matplotlib
  File "/usr/lib64/python2.7/site-packages/matplotlib/__init__.py", line
151, in <module>
    from matplotlib.rcsetup import (defaultParams,
  File "/usr/lib64/python2.7/site-packages/matplotlib/rcsetup.py", line 20,
in <module>
    from matplotlib.colors import is_color_like
  File "/usr/lib64/python2.7/site-packages/matplotlib/colors.py", line 54,
in <module>
    import matplotlib.cbook as cbook
  File "/usr/lib64/python2.7/site-packages/matplotlib/cbook.py", line 32,
in <module>
    import new
  File "/home/www/html/auroratest/new.py", line 8, in <module>
    plt.scatter(x,y)
NameError: name 'plt' is not defined

when I try to use something like import matplotlib.image as image I get the
following errors:

Traceback (most recent call last):
  File "new.py", line 1, in <module>
    import matplotlib.image as image
  File "/usr/lib64/python2.7/site-packages/matplotlib/__init__.py", line
151, in <module>
    from matplotlib.rcsetup import (defaultParams,
  File "/usr/lib64/python2.7/site-packages/matplotlib/rcsetup.py", line 20,
in <module>
    from matplotlib.colors import is_color_like
  File "/usr/lib64/python2.7/site-packages/matplotlib/colors.py", line 54,
in <module>
    import matplotlib.cbook as cbook
  File "/usr/lib64/python2.7/site-packages/matplotlib/cbook.py", line 32,
in <module>
    import new
  File "/home/www/html/auroratest/new.py", line 1, in <module>
    import matplotlib.image as image
  File "/usr/lib64/python2.7/site-packages/matplotlib/image.py", line 13,
in <module>
    from matplotlib import rcParams
ImportError: cannot import name rcParams

What is causing these errors and what specific things do I need to do to
resolve this.  I need this explained clearly in a step by step way.

Thanks,

Jason

-- 
Jason Snyder PhD


More information about the Tutor mailing list