[gdal-dev] can't import osgeo or gdal in python

Jeff Hamann jeff.hamann at forestinformatics.com
Fri Sep 17 12:30:36 EDT 2010


Hi list, 

First, let me say, I'm *not* a python person, so please be gentle with your assumptions.

I built gdal-1.7.2 with the following configure options:


$ ./configure \
 CC="gcc -arch i386" \
 CXX="g++ -arch i386" \
OBJC="gcc -arch i386" \
 F77="gfortran -arch i386" \
 FC="gfortran -arch i386" \
  --with-pg=/usr/local/pgsql/bin/pg_config \
  --with-macosx-framework=NO \
  --without-sqlite3  \
  --with-python

configure: WARNING: unrecognized options: --with-macosx-framework

GDAL is now configured for i386-apple-darwin10.4.0

  Installation directory:    /usr/local
  C compiler:                gcc -arch i386  -g -O2
  C++ compiler:              g++ -arch i386  -g -O2

  LIBTOOL support:           yes

  LIBZ support:              external
  GRASS support:             no
  CFITSIO support:           no
  PCRaster support:          internal
  NetCDF support:            yes
  LIBPNG support:            internal
  LIBTIFF support:           internal (BigTIFF=yes)
  LIBGEOTIFF support:        internal
  LIBJPEG support:           internal
  8/12 bit JPEG TIFF:        yes
  LIBGIF support:            internal
  OGDI support:              no
  HDF4 support:              no
  HDF5 support:              no
  Kakadu support:            no
  JasPer support:            no
  ECW support:               no
  MrSID support:             no
  MSG support:               no
  GRIB support:              yes
  EPSILON support:           no
  cURL support (wms/wcs/...):yes
  PostgreSQL support:        yes
  MySQL support:             no
  Ingres support:            no
  Xerces-C support:          no
  NAS support:               no
  Expat support:             yes
  ODBC support:              no
  PGeo support:              no
  PCIDSK support:            internal
  OCI support:               no
  GEORASTER support:         no
  SDE support:               no
  DODS support:              no
  SQLite support:            no
  SpatiaLite support:        no
  DWGdirect support          no
  INFORMIX DataBlade support:no
  GEOS support:              yes
  VFK support:               yes

  Mac OS X Framework :       no

  SWIG Bindings:          python 

  Statically link PROJ.4:    no
  enable OGR building:       yes
  enable pthread support:    no
  hide internal symbols:     no

Jeff-Hamanns-MacBook-Pro:gdal-1.7.2 hamannj$ 


okay, a little odd (-with-macosx-framework, --with-swig) when ./configure --help contains:

  --with-macosx-framework         Build and install GDAL as a Mac OS X Framework
  --with-perl           Enable perl bindings
  --with-php            Enable php bindings
  --with-ruby           Enable Ruby bindings
  --with-python       Enable python bindings

but, it builds and installs just fine. I can also build things that depend on gdal (i.e. wktraster). 

When I try to "run" (again newbie talking here, so be patient), a python script and import gdal:

Jeff-Hamanns-MacBook-Pro:gdal-1.7.2 hamannj$ python
Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import gdal
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.6/site-packages/GDAL-1.7.2-py2.6-macosx-10.6-universal.egg/gdal.py", line 2, in <module>
    from osgeo.gdal import deprecation_warn
  File "/Library/Python/2.6/site-packages/GDAL-1.7.2-py2.6-macosx-10.6-universal.egg/osgeo/__init__.py", line 21, in <module>
    _gdal = swig_import_helper()
  File "/Library/Python/2.6/site-packages/GDAL-1.7.2-py2.6-macosx-10.6-universal.egg/osgeo/__init__.py", line 17, in swig_import_helper
    _mod = imp.load_module('_gdal', fp, pathname, description)
ImportError: dlopen(/Library/Python/2.6/site-packages/GDAL-1.7.2-py2.6-macosx-10.6-universal.egg/osgeo/_gdal.so, 2): Symbol not found: _CPLDefaultErrorHandler
  Referenced from: /Library/Python/2.6/site-packages/GDAL-1.7.2-py2.6-macosx-10.6-universal.egg/osgeo/_gdal.so
  Expected in: flat namespace
 in /Library/Python/2.6/site-packages/GDAL-1.7.2-py2.6-macosx-10.6-universal.egg/osgeo/_gdal.so
>>> 

I can't seem to get any traction, but can somebody provide an answer as to why gdal isn't loading?

Please?

Respectfully,
Jeff.



Jeff Hamann, PhD
PO Box 1421
Corvallis, Oregon 97339-1421
541-754-2457
jeff.hamann[at]forestinformatics[dot]com
http://www.forestinformatics.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20100917/494a33ac/attachment.html


More information about the gdal-dev mailing list