[gdal-dev] can't import osgeo or gdal in python
Christopher Barker
Chris.Barker at noaa.gov
Fri Sep 17 14:32:46 EDT 2010
Jeff Hamann wrote:
> I built gdal-1.7.2 with the following configure options:
1) What version of OS-X, python, etc. are you using -- there are way too
many! If nothing else, make sure that the gdal build and your testing
are happening with the same python.
2) Can you use the pre-built frameworks here:
http://www.kyngchaos.com/software/frameworks
That could save you a lot of pain.
Note that those frameworks are built to use the Apple-supplied python,
and from your output, I'm guess you're on 10.6 and the Apple python,
which is good news for you). If you want to use a different python, you
may have to re-build, but perhaps only the python bindings -- stay
tuned, I'm working on that myself right now.
Sorry not to be more help.
-Chris
>
> $ ./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 <http://www.forestinformatics.com/>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
More information about the gdal-dev
mailing list