-2

I've been trying to solve this issue on my own but have concluded that this issue is above my capabilities. I viewed various answers but none seem to work. I've uninstalled matplotlib and all its accessories and re-installed it as well as downgraded with the hopes that it might be version issue.

These is what I've found relative to my problem:

AttributeError: 'module' object has no attribute 'cbook'

https://groups.google.com/forum/#!topic/modwsgi/97bnQk9ojtY

https://github.com/matplotlib/matplotlib/pull/593

However, none of these option seem to resolve my current issue.

This is the output I receive:

Traceback (most recent call last):
  File "/home/ulab03/Documents/PlotExample.py", line 13, in <module>
    from matplotlib import pyplot as plt
  File "/usr/lib64/python2.7/site-packages/matplotlib/pyplot.py", line 29, in <module>
    import matplotlib.colorbar
  File "/usr/lib64/python2.7/site-packages/matplotlib/colorbar.py", line 32, in <module>
    import matplotlib.artist as martist
  File "/usr/lib64/python2.7/site-packages/matplotlib/artist.py", line 11, in <module>
    import matplotlib.cbook as cbook
AttributeError: 'module' object has no attribute 'cbook'

This is the example that I'm using:

import matplotlib
import numpy as np


try: 
    import matplotlib.cbook
    print 'SUCCESS_1'
except:
    print 'FAIL_1'

import matplotlib.pyplot as plt




x_data = np.linspace(0,10,11)
y_data = np.linspace(0,10,11)

fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(x_data,y_data)

plt.show()
plt.close()

Additional Info:

Python Version: 2.7.5

Matplotlib Version: 1.5.0

Numpy Version: 1.11.2

===========================

Please Help.

Anyone?

Thank you.

Did I mention... Happy Holidays

==========================

UPDATE

==========================

So I've narrowed the problem to its source... I think...

When I run the same program from my terminal it seems to "magically" work...

Community
  • 1
  • 1
Nohj Eod
  • 5
  • 6
  • 1
    Seems you have 2 different python versions. What happens if you try the suggestion from your first linked question to find out more about your matplotlib? `import imp; a = imp.find_module("matplotlib"); print a` Are both prints the same in the console and in Spyder? – ImportanceOfBeingErnest Dec 16 '16 at 21:09

1 Answers1

0

thats not the code you're using because you don't have line 13 :)

anyways, have you tried this?

import numpy as np
from matplotlib import pyplot as plt
x_data = np.linspace(0,10,11)
y_data = np.linspace(0,10,11)
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(x_data,y_data)
plt.show()
plt.close()
appills
  • 172
  • 1
  • 14
  • Thank you my good sir! Unfortunately that failed as well. However, as I sip from my thinking juice I begin to think the problem has to do with spyder. I will explain in my original post above.. – Nohj Eod Dec 16 '16 at 20:31