Search code examples
enthoughtmatplotlib-basemap

Enthought Canopy Basemap Import Failure


I'm running Enthought Canopy Version 1.5.2730 with Basemap version 1.0.7-5 and pyproj version 1.9.3-1 installed on a Mac running OS X 10.9.5. When I try to import basemap I get the following error message.

from mpl_toolkits.basemap import Basemap
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-4-5e6824321d57> in <module>()
----> 1 from mpl_toolkits.basemap import Basemap

/Users/wiltbemj/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/mpl_toolkits/basemap/__init__.py in <module>()
 28 from matplotlib.lines import Line2D
 29 from matplotlib.transforms import Bbox
 ---> 30 from mpl_toolkits.basemap import pyproj
 31 from mpl_toolkits.axes_grid1 import make_axes_locatable
 32 from matplotlib.image import imread

 ImportError: cannot import name pyproj 

If I try to import pyproj directly I get the following error mesage

ImportError                               Traceback (most recent call last)
<ipython-input-1-0cc08144b629> in <module>()
----> 1 from mpl_toolkits.basemap import pyproj

/Users/wiltbemj/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/mpl_toolkits/basemap/__init__.py in <module>()
 35 import numpy as np
 36 import numpy.ma as ma
 ---> 37 import _geoslib
 38 import functools
 39 

ImportError: dlopen(/Users/wiltbemj/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-package /_geoslib.so, 2): Library not loaded: @rpath/lib/libgeos_c.1.dylib
Referenced from: /Users/wiltbemj/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/_geoslib.so
Reason: image not found

I've tried uninstalling and reinstalling the packages with no success. The missing dylib is on machine in the /opt/local/lib directory. Not sure if it is path problem or something more complicated. Any hints as to how to begin debugging the issue are greatly appreciated.


Solution

  • IIUC, this is due to some libraries that were formerly supplied by basemap, and now are supplied by geos, that were inappropriately removed by updating basemap.

    To fix it, open a Canopy Terminal (from the Canopy Tools menu) and type:

    enpkg --remove geos
    enpkg geos