[gdal-dev] Problems packaging with py2exe

Ivan Lucena lucena_ivan at hotmail.com
Thu Aug 14 16:56:36 PDT 2014


Dr. Armi,


> Date: Thu, 14 Aug 2014 14:44:58 +0200
> From: Armin.R.Schmidt at Gmail.com
> To: gdal-dev at lists.osgeo.org
> Subject: [gdal-dev] Problems packaging with py2exe
> 
> I am trying to package my GDAL/OGR Python project with py2exe so that
> the users don't need to do a separate GDAL installation, but I can't get 
> it to work.
> 
> As an example, this simple two-line program results in the error message 
> below when the final .exe file is called.
> 
> import osgeo.gdal as gdal
> print __name__
> 
> Traceback (most recent call last):
>    File "temp.py", line 1, in <module>
>    File "osgeo\__init__.pyc", line 21, in <module>
>    File "osgeo\__init__.pyc", line 13, in swig_import_helper
>    File "osgeo\_gdal.pyc", line 12, in <module>
>    File "osgeo\_gdal.pyc", line 10, in __load
> ImportError: DLL load failed: The specified module could not be found.
> 
> I have found several references to the same problem but no definitive
> solution. Most comments refer to the correct installation of GDAL - but
> the whole point is to distribute everything that is needed from GDAL in
> the packaged installation file.

As far as I know when you run the GDAL Python Extension that does not copy the gdalNN.dll into your Python installation and py2exe can only package what is in there.

> 
> I have used dependency walker to check what _gdal.pyd (or
> osgeo._gdal.pyd, which is produced by py2exe) require and have put
> missing dll's into the system32 folder, but that didn't help either. I
> just can't figure out what
>   File "osgeo\_gdal.pyc", line 10, in __load
> tries to load.

6 years ago I did something like you are trying to do. But I don't works 
with that same environment anymore so I can't reproduce that process. 

But I 
think you should cover the basic first. Like, for example, before running py2exe, 
can your scripts run in both machines, your and the target machine?

If that is true, it is because the folder where gdalNN.dll is installed is
 on your PATH environment variable. If not you might need to fix that. I would prefer changing the PATH instead of copying stuff to the system32 folder. But that is just me.

Would be possible to copy gdalNN.dll to some folder inside the Python installation, so that py2exe can put that into your deployment? I don't know but that could be worth trying.

Good luck.

> 
> Armin
> 
> -- 
> __________________________________________________________________
> Dr. Armin Schmidt
> Director, GeodataWIZ Ltd:  Geo Data + Visualisation
>   www.GeodataWIZ.com
>   www.GeodataWIZ.com/armin-schmidt
> Chairman, Internat. Society for Archaeological Prospection
>   www.archprospection.org
> Postdoctoral Researcher, University of Groningen
>   Groningen Institute of Archaeology
> Honorary Visiting Research Fellow, University of Bradford
>   Department of Archaeological Sciences
> Honorary Fellow, Durham University, Department of Archaeology
> http://orcid.org/0000-0002-4241-5381
> 
> Email: Armin.R.Schmidt at Gmail.com
> 
> Now available:
> Earth Resistance for Archaeologists (2013). Lanham: AltaMira Press
> Geophysical Data in Archaeology (2013). Oxford: Oxbow Books.
> http://www.amazon.co.uk/-/e/B0034QC4OW
> __________________________________________________________________
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20140814/0d34901e/attachment.html>


More information about the gdal-dev mailing list