[gdal-dev] Installing GDAL Python on OS X, "flat namespace" error
Evan James
thasero at gmail.com
Fri Sep 16 11:57:35 EDT 2011
Hi folks,
I'm trying to use the GDAL library as part of a Python application I need to
run. Specifically, there's an open source project that no longer runs on
Lion, and I've been updating a few settings to try and re-build the
standalone application for OS X users. The application depends on GDAL
Python.
The problem I run into is the "flat namespace" error:
File
"/Library/Python/2.7/site-packages/GDAL-1.7.1-py2.7-macosx-10.7-intel.egg/osgeo/__init__.py",
line 21, in <module>
_gdal = swig_import_helper()
File
"/Library/Python/2.7/site-packages/GDAL-1.7.1-py2.7-macosx-10.7-intel.egg/osgeo/__init__.py",
line 17, in swig_import_helper
_mod = imp.load_module('_gdal', fp, pathname, description)
ImportError:
dlopen(/Library/Python/2.7/site-packages/GDAL-1.7.1-py2.7-macosx-10.7-intel.egg/osgeo/_gdal.so,
2): Symbol not found: _CPLDefaultErrorHandler
Referenced from:
/Library/Python/2.7/site-packages/GDAL-1.7.1-py2.7-macosx-10.7-intel.egg/osgeo/_gdal.so
Expected in: flat namespace
in
/Library/Python/2.7/site-packages/GDAL-1.7.1-py2.7-macosx-10.7-intel.egg/osgeo/_gdal.so
Some research tells me that this is a common issue with Python package
management on OS X. I've found a previous message about this on the list -
http://lists.osgeo.org/pipermail/gdal-dev/2010-September/026051.html - but
it's an explanation for the issue rather than a way to resolve it.
Unfortunately, all I know about Python package management is what I've
learned trying to run setup.py to build the OS X standalone, so I don't have
a clue how to resolve the import error.
The version of GDAL listed in the error message above is the only one I have
installed on my machine; I suspected a MacPorts problem and cleaned out my
library paths. If I delete the GDAL library from the path listed in the
error message, Python no longer finds any GDAL at all. Doing a clean
reinstall from the GDAL 1.7.1 release recreates the same library, flat
namespace error and all. So it's not an issue with conflicting libraries.
Because I'm trying to use the GDAL library as part of Python code written by
someone else and which is only somewhat maintained for OS X, it's possible
that the way it imports GDAL is the problem - if the code worked on the
original author's machine but not mine. But all I have there is the line
"from osgeo import gdal", which should work as far as I can tell from the
documentation.
Any suggestions?
Thanks,
Evan James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20110916/bc6c4cc4/attachment.html
More information about the gdal-dev
mailing list