Opened 7 years ago

Closed 7 years ago

#55063 closed defect (fixed)

py27-matplotlib @2.1.0_1: ImportError: cannot import name cbook

Reported by: mfacorcoran Owned by: seanfarley (Sean Farley)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: py-matplotlib

Description (last modified by mf2k (Frank Schima))

I upgraded py27-matplotlib from py27-matplotlib @2.0.2_0+cairo+tkinter to py27-matplotlib @2.1.0_1+cairo+tkinter but got the following error when importing matplotlib or pylab:

% python 
Python 2.7.14 (default, Sep 22 2017, 00:05:22) 
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin 
Type "help", "copyright", "credits" or "license" for more information. 

Importing pyfits 
Could not import pylab 
Traceback (most recent call last): 
  File "/Users/corcoran/.pythonrc", line 34, in <module> 
    import matplotlib 
  File 
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/__init__.py", 
line 124, in <module> 
    from . import cbook 
ImportError: cannot import name cbook 

any idea how to resolve this?

thanks

Mike

Change History (5)

comment:1 Changed 7 years ago by mf2k (Frank Schima)

Cc: sean@… removed
Owner: set to seanfarley
Port: py-matplotlib added; py27-matplotlib @2.1.0_1+cairo+tkinte removed
Status: newassigned

In the future, please use WikiFormatting.

comment:2 Changed 7 years ago by mf2k (Frank Schima)

Description: modified (diff)

comment:3 Changed 7 years ago by ryandesign (Ryan Carsten Schmidt)

Summary: py27-matplotlib2.1.0_1 import failspy27-matplotlib @2.1.0_1: ImportError: cannot import name cbook
Version: 2.1.0

I doubt you are using MacPorts 2.1.0...

comment:4 in reply to:  3 Changed 7 years ago by mfacorcoran

Replying to ryandesign:

I doubt you are using MacPorts 2.1.0...

Not sure what your comment means. I upgraded matplotlib to the latest version, which is 2.1.0_1. Here's what happens when it's activated:

% sudo port activate py27-matplotlib @2.1.0_1+cairo+tkinter
Password:
--->  Computing dependencies for py27-matplotlib
--->  Deactivating py27-matplotlib @2.0.2_0+cairo+tkinter
--->  Cleaning py27-matplotlib
--->  Activating py27-matplotlib @2.1.0_1+cairo+tkinter
--->  Cleaning py27-matplotlib
--->  Some of the ports you installed have notes:
  py27-matplotlib has the following notes:
    The default backend is the interactive Mac OS X backend. Different backends can be specified using the ~/.matplotlib/matplotlibrc file. More
    details regarding backends can be found in the matplotlib FAQ:

    http://matplotlib.sourceforge.net/faq/installing_faq.html#what-is-a-backend

[gs66w-corcoran:~] corcoran% python
Python 2.7.14 (default, Sep 22 2017, 00:05:22)
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

Importing pyfits
Could not import pylab
Traceback (most recent call last):
  File "/Users/corcoran/.pythonrc", line 34, in <module>
    import matplotlib
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/__init__.py", line 124, in <module>
    from . import cbook
ImportError: cannot import name cbook
>>> exit()

comment:5 Changed 7 years ago by seanfarley (Sean Farley)

Resolution: fixed
Status: assignedclosed

I've updated matplotlib to the newest version so I hope this is fixed. If not, then much like Ryan, I suspect something is installed outside of macports that is interfering.

Note: See TracTickets for help on using tickets.