[gdal-dev] gdal_merge.py won't load libpng

Dominik Schneider Dominik.Schneider at Colorado.EDU
Fri Jul 5 23:44:47 PDT 2013


Yes, anaconda is a python distribution. Unfortunate that those don't play
nice.
Confusion was indeed the problem. I deleted the /usr/local/lib/python2.7
folder and uninstalled the brew gdal. I reinstalled GDAL Complete 1.10
framework and was getting an import error:

iMac:~ $ gdal_merge.py
Traceback (most recent call last):
  File "/Library/Frameworks/GDAL.framework/Programs/gdal_merge.py", line
36, in <module>
    import gdal
ImportError: No module named gdal
iMac:~ $

I tried the export PYTHONPATH=... but it didn't help until I removed
anaconda from my path and now the function works. thanks a lot for your
help.

Dominik Schneider
o 303.735.6296 | c 518.956.3978



On Fri, Jul 5, 2013 at 4:13 PM, William Kyngesburye
<woklist at kyngchaos.com>wrote:

> Looks like a confused gdal and python installation mess...
>
> If you're using my GDAL framework, it uses my UnixImageIO framework for
> libpng.  And, the included gdal-python uses the system python.
>
> But according to the error python is looking for python modules (thus
> gdal-python) in /usr/local.  This implies that the system python is NOT
> running, but a custom install (is that what anaconda is?), with it's own
> python module search path.  I'm guessing that the anaconda python (?) is in
> /usr/local/bin and thus be found before the system python.
>
> PYTHONPATH might work to redirect your custom python to look for the
> correct gdal-python:
>
>   export
> PYTHON_PATH=/Library/Frameworks/GDAL.framework/Versions/1.10/Python/2.7/site-packages
>
> If not, you'll have to uninstall your custom python (anaconda? homebrew?)
> so it doesn't override the system python.
>
> On Jul 5, 2013, at 2:39 PM, Dominik Schneider wrote:
>
> > anyone have any suggestions?! I'm at a complete loss how to troubleshoot.
> >
> >
> > Dominik Schneider
> > o 303.735.6296 | c 518.956.3978
> >
> >
> >
> > On Tue, Jul 2, 2013 at 10:52 AM, Dominik Schneider <
> dominik.schneider at colorado.edu> wrote:
> > Hi,
> > I am trying to run:
> > gdal_merge.py -init -9999 -n 2001 -o
> MOD09GA.A2012001.h08v05.005.NRTsnow_fraction.tif.1
> MOD09GA.A2012001.h08v05.005.NRTsnow_fraction.tif
> >
> > The Error:
> > Traceback (most recent call last):
> >   File "/Library/Frameworks/GDAL.framework/Programs/gdal_merge.py", line
> 36, in <module>
> >     import gdal
> >   File "/usr/local/lib/python2.7/site-packages/gdal.py", line 2, in
> <module>
> >     from osgeo.gdal import deprecation_warn
> >   File "/usr/local/lib/python2.7/site-packages/osgeo/__init__.py", line
> 21, in <module>
> >     _gdal = swig_import_helper()
> >   File "/usr/local/lib/python2.7/site-packages/osgeo/__init__.py", line
> 17, in swig_import_helper
> >     _mod = imp.load_module('_gdal', fp, pathname, description)
> > ImportError:
> dlopen(/usr/local/lib/python2.7/site-packages/osgeo/_gdal.so, 2): Library
> not loaded: libpng15.15.dylib
> >   Referenced from: /usr/local/Cellar/gdal/1.10.0/lib/libgdal.1.dylib
> >   Reason: image not found
> >
> > Gdal is here:
> > > which gdal_merge.py
> > /Library/Frameworks/GDAL.framework/Programs/gdal_merge.py
> >
> > I'm completely new gdal but am guessing i've got some confusion between
> different versions of gdal and python.  I have rgdal installed so at some
> point in the past I probably installed gdal too? Today I installed gdal
> with homebrew and also tried the binary from
> http://www.kyngchaos.com/software:frameworks
> > For python I have the system default (2.7) on osx.7.5 and the anaconda
> installation.
> >
> > I should also say, if I load python I am unable to import gdal:
> > > python
> > Python 2.7.4 |Anaconda 1.5.1 (x86_64)| (default, May  9 2013, 12:12:00)
> > [GCC 4.0.1 (Apple Inc. build 5493)] on darwin
> > Type "help", "copyright", "credits" or "license" for more information.
> > >>> from osgeo import gdal
> > Traceback (most recent call last):
> >   File "<stdin>", line 1, in <module>
> >   File "/usr/local/lib/python2.7/site-packages/osgeo/__init__.py", line
> 21, in <module>
> >     _gdal = swig_import_helper()
> >   File "/usr/local/lib/python2.7/site-packages/osgeo/__init__.py", line
> 17, in swig_import_helper
> >     _mod = imp.load_module('_gdal', fp, pathname, description)
> > ImportError:
> dlopen(/usr/local/lib/python2.7/site-packages/osgeo/_gdal.so, 2): Library
> not loaded: libpng15.15.dylib
> >   Referenced from: /usr/local/Cellar/gdal/1.10.0/lib/libgdal.1.dylib
> >   Reason: image not found
> >
> >
> > any help would be appreciated.
> > Thanks
> >
> > _______________________________________________
> > gdal-dev mailing list
> > gdal-dev at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
> -----
> William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
> http://www.kyngchaos.com/
>
> All generalizations are dangerous, even this one.
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20130706/a89a0f01/attachment-0001.html>


More information about the gdal-dev mailing list