[Tutor] Help with Import Error problems
Evert Rol
evert.rol at gmail.com
Sun Aug 1 20:09:07 CEST 2010
> I got it back working. But it was with some stroke of luck. And I dont know the explanation.
>
> I installed the latest source of GEOS (as suggested by someone from the gdal channel). Then i tried the script. It gave me a different import error.
>
> ImportError: libgeos-3.3.0.so: cannot open shared object file: No such file or directory
>
> I uninstalled the thing. And then tried the script again and it worked. :| I answered some of your questions below. Again, thanks.
Sounds like a library mess-up. System thing, definitely not a Python thing. Installing the latest source was a bit of an odd suggestion, if you got things working earlier.
But it's good it's working now. Just be careful that it doesn't come back to bite you when you install more things.
Few other things below, after the break:
<snip />
> For a quick check, try the following from the command line:
> $> ldd /usr/lib/libspatialite.so.2
>
> The command line returns the following lines:
>
> linux-vdso.so.1 => (0x00007fff6edff000)
> libsqlite3.so.0 => /usr/lib/libsqlite3.so.0 (0x00007f793015c000)
> libgeos_c.so.1 => /usr/local/lib/libgeos_c.so.1 (0x00007f792ff4f000)
> libgeos-3.2.2.so => /usr/lib/libgeos-3.2.2.so (0x00007f792fbe8000)
> libproj.so.0 => /usr/lib/libproj.so.0 (0x00007f792f9a6000)
> libm.so.6 => /lib/libm.so.6 (0x00007f792f723000)
> libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f792f40e000)
> libpthread.so.0 => /lib/libpthread.so.0 (0x00007f792f1f1000)
> libdl.so.2 => /lib/libdl.so.2 (0x00007f792efed000)
> libc.so.6 => /lib/libc.so.6 (0x00007f792ec69000)
> libgeos.so.2 => /usr/local/lib/libgeos.so.2 (0x00007f792e964000)
> libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f792e74d000)
> /lib64/ld-linux-x86-64.so.2 (0x00007f7930688000)
>
> I dont know what to make of it.
It's the pointers to the libgeos libraries that are interesting.
Which shows that one libgeos lives in /usr/lib, while the other one can be found in /usr/local/lib. And libgeos_c also lives in /usr/local/lib.
So it still feels a bit messy, having similarly named libraries in two different system directories, and you may run into some compatibility issues later on, in just a few specific functions or classes. May, because I've never used this software.
You should scan through /usr/local/lib for more libgeos* libraries. If you find libgeos-3.2.2.so there as well, then probably that should actually be the preferred one (although then libspatialite.so.2 should also be in /usr/local/lib). Anyway, don't change it if it's working.
See also below.
> and see if it has any missing dependencies. If there's any missing (you can also post the output here if you'd like), see if you can that dependency somewhere on your system (the 'locate' command can help, or just good-old 'find'). If it's missing from libspatialite but you can find that library somewhere on your system (that would probably be the GEOS library then), it's your LD_LIBRARY_PATH that's likely different.
>
> Also, what linux distro are you using? Maybe you've been using the package manager overzealously, causing some essential packages to be modified or removed?
>
>
> I'm on Ubuntu 10.04 (64 bit). I think it was from installing different GIS-related software (not all of which could be installed from the package manager).
So perhaps some stuff automatically installed in /usr/lib (that could be software installed through the package manager), and then you used the usual ./configure; make; make install (or python setup.py install; or whatever), which most likely (hopefully, actually) would install things in /usr/local/lib.
And somewhere along the way, a library got removed or replaced by a different version library, and things stopped working.
What exactly happened is hard to tell, depending on how exactly you installed everything, and in which order.
I hope this keeps working for you. Probably the folks on the gdal channel or related mailing lists could otherwise help you; but perhaps then tell them you have the geos & related libraries spread across /usr/lib and /usr/local/lib.
Cheers,
Evert
More information about the Tutor
mailing list