basemap-0.9.8 failure, linux

Hi all,

Just updated basemap from 0.9.4 to 0.9.8 on Mandriva Linux 2008. I also installed basemap-data-fullres-0.9.7. I’ve noticed there’s a couple of recent posts about problems (on Macs) with 0.9.8, the solution being to install setuptools until 0.9.9 comes along; the problem I have is similar to the posts but not the same, so I’d like to check here before proceeding with setuptools.

I installed the included geos-2.2.3, then basemap-0.9.8, then basemap-data-fullres-0.9.7
. However when I now import basemap I get:

In [1]: from matplotlib.toolkits.basemap import Basemap

···

<type ‘exceptions.ImportError’> Traceback (most recent call last)

/home/emason/python/tools/ in ()

/usr/lib/python2.5/site-packages/matplotlib/toolkits/basemap/init.py in ()
----> 1 from basemap import doc, version

  2 from basemap import *

/usr/lib/python2.5/site-packages/matplotlib/toolkits/basemap/basemap.py in ()
29 from matplotlib.cbook import is_scalar, dedent
30 from shapelib import ShapeFile

—> 31 import _geos, pupynere
32
33 # basemap data files now installed in lib/matplotlib/toolkits/basemap/data

<type ‘exceptions.ImportError’>: libgeos_c.so.1: cannot open shared object file: No such file or directory

Yet the file, in fact a link, libgeos_c.so.1, does exist at the location (/usr/local/lib) where it is supposed to be:

[root@…1759… lib]# ll
total 44230
-rw-r–r-- 1 root root 28107924 2007-12-28 16:31 libgeos.a
-rw-r–r-- 1 root root 581806 2007-12-28 16:31 libgeos_c.a
-rwxr-xr-x 1 root root 830 2007-12-28 16:31 libgeos_c.la*

lrwxrwxrwx 1 root root 18 2007-12-28 16:31 libgeos_c.so -> libgeos_c.so.1.1.1*
lrwxrwxrwx 1 root root 18 2007-12-28 16:31 libgeos_c.so.1 -> libgeos_c.so.1.1.1*
-rwxr-xr-x 1 root root 452162 2007-12-28 16:31 libgeos_c.so.1.1.1*

-rwxr-xr-x 1 root root 790 2007-12-28 16:31 libgeos.la*
lrwxrwxrwx 1 root root 16 2007-12-28 16:31 libgeos.so -> libgeos.so.2.2.3*
lrwxrwxrwx 1 root root 16 2007-12-28 16:31 libgeos.so.2 -> libgeos.so.2.2.3*
-rwxr-xr-x 1 root root 13443604 2007-12-28 16:31 libgeos.so.2.2.3*

I’d appreciate any help with this.

Thanks, Evan

Evan Mason wrote:

Hi all,

Just updated basemap from 0.9.4 to 0.9.8 on Mandriva Linux 2008. I also installed basemap-data-fullres-0.9.7. I've noticed there's a couple of recent posts about problems (on Macs) with 0.9.8, the solution being to install setuptools until 0.9.9 comes along; the problem I have is similar to the posts but not the same, so I'd like to check here before proceeding with setuptools.

I installed the included geos-2.2.3, then basemap-0.9.8, then basemap-data-fullres-0.9.7 . However when I now import basemap I get:

In [1]: from matplotlib.toolkits.basemap import Basemap
---------------------------------------------------------------------------
<type 'exceptions.ImportError'> Traceback (most recent call last)

/home/emason/python/tools/<ipython console> in <module>()

/usr/lib/python2.5/site-packages/matplotlib/toolkits/basemap/__init__.py in <module>()
----> 1 from basemap import __doc__, __version__
      2 from basemap import *

/usr/lib/python2.5/site-packages/matplotlib/toolkits/basemap/basemap.py in <module>()
     29 from matplotlib.cbook import is_scalar, dedent
     30 from shapelib import ShapeFile
---> 31 import _geos, pupynere
     32
     33 # basemap data files now installed in lib/matplotlib/toolkits/basemap/data

<type 'exceptions.ImportError'>: libgeos_c.so.1: cannot open shared object file: No such file or directory

Yet the file, in fact a link, libgeos_c.so.1, does exist at the location (/usr/local/lib) where it is supposed to be:

[root@...1759... lib]# ll
total 44230
-rw-r--r-- 1 root root 28107924 2007-12-28 16:31 libgeos.a
-rw-r--r-- 1 root root 581806 2007-12-28 16:31 libgeos_c.a
-rwxr-xr-x 1 root root 830 2007-12-28 16:31 libgeos_c.la*
lrwxrwxrwx 1 root root 18 2007-12-28 16:31 libgeos_c.so -> libgeos_c.so.1.1.1*
lrwxrwxrwx 1 root root 18 2007-12-28 16:31 libgeos_c.so.1 -> libgeos_c.so.1.1.1*
-rwxr-xr-x 1 root root 452162 2007-12-28 16:31 libgeos_c.so.1.1.1*
-rwxr-xr-x 1 root root 790 2007-12-28 16:31 libgeos.la*
lrwxrwxrwx 1 root root 16 2007-12-28 16:31 libgeos.so -> libgeos.so.2.2.3*
lrwxrwxrwx 1 root root 16 2007-12-28 16:31 libgeos.so.2 -> libgeos.so.2.2.3*
-rwxr-xr-x 1 root root 13443604 2007-12-28 16:31 libgeos.so.2.2.3*

I'd appreciate any help with this.

Thanks, Evan

Evan: I think this is a LD_LIBRARY_PATH problem. There are two possible workarounds:

1) set the LD_LIBRARY_PATH environment variable to include /usr/local/lib, i.e.

export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"

2) edit setup.py and make the following change

currents_nbp:(basemap_svn)$ svn diff
Index: setup.py

···

===================================================================
--- setup.py (revision 4791)
+++ setup.py (working copy)
@@ -90,7 +90,11 @@

extensions.append(Extension("matplotlib.toolkits.basemap._geod",deps+['src/_geod.c'],include_dirs = ['src'],))
# for some reason, pickling won't work if this extension is installed
# as "matplotlib.toolkits.basemap._geos"
-extensions.append(Extension("_geos",['src/_geos.c'],library_dirs=geos_library_dirs,include_dirs=geos_include_dirs,libraries=['geos_c','geos']))

+extensions.append(Extension("_geos",['src/_geos.c'],
+ library_dirs=geos_library_dirs,
+ runtime_library_dirs=geos_library_dirs,
+ include_dirs=geos_include_dirs,
+ libraries=['geos_c','geos']))

then rebuild. As Eric Firing pointed out to me, adding runtime_library_dirs negates the need to set LD_LIBRARY_PATH manually. This is already done in svn, and so 0.9.9 will not require manually setting LD_LIBRARY_PATH.

HTH,

-Jeff

--
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jeffrey.S.Whitaker@...259...
325 Broadway Office : Skaggs Research Cntr 1D-124
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg

Thank you Jeff. Setting LD_LIBRARY_PATH works fine as a quick test, though that leads me to the “ImportError: No module named pkg_resources” problem that the other recent posters had. I’ll either try setuptools or wait for 0.9.9 to come out - will it be long?

-Evan

Evan Mason wrote:

Thank you Jeff. Setting LD_LIBRARY_PATH works fine as a quick test, though that leads me to the "ImportError: No module named pkg_resources" problem that the other recent posters had. I'll either try setuptools or wait for 0.9.9 to come out - will it be long?

-Evan

Evan: Sometime next week probably, If you have svn installed, you can get the latest version that way.

-Jeff

···

--
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jeffrey.S.Whitaker@...259...
325 Broadway Office : Skaggs Research Cntr 1D-124
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg