[gdal-dev] ImportError when importing gdal module with python 2.7 on Windows 7 64-bit

Simon Lyngby Kokkendorff silyko at gmail.com
Fri Nov 16 06:14:59 PST 2012


Hi,

  It shouldn't be necessary to have gdal and python compiled with the same
msvc-version, as long as the various needed c-runtime dll's can be found in
the PATH. In my experience problems like you describe (DL'HELL) can be
related to the order in which things appear in the PATH. For example, if
you have a PyQt4 installation (in the PATH), which uses a libmysql.dll and
gdal is also linked against libmysql.dll (in another version), it is really
important which version is found first in PATH. And I guess the same thing
could be the case for other libraries tha gdal uses.
  I can also be tricky if you have multiple python versions (for example a
"usual" installation and one through osgeo4w) and\or multiple versions of
the gdal-python bindings (compiled with different compilers and/or
different versions of python). In that case you need to make sure that
python env variables like PYTHONPATH are set up right.
  So I guess it is really a case of carefully studying output from
dependency-walker. You could also try to cd to the directory where all the
gdal and support library dll's are located and try to import the gdal
python module from there (should be the same as putting that folder first
in PATH).

Best Regards,
Simon


On Fri, Nov 16, 2012 at 1:43 PM, Rutger <kassies at gmail.com> wrote:

> Hi George,
>
> You can also open the _gdal.pyd with Dependency Walker, i think thats the
> file which is actually being opened when the traceback is returned. In
> addition to gdal.dll it also check for python27.dll and kernel32.dll.
> The ISHIMS.DLL is not a problem for as far as i know.
>
> Normally you should be able to resolve MSVCR80.DLL issues by installing the
> appropriate MS Visual C++ Redistributable (if you havent done so already),
> the version *80.dll would mean that you need the 2005 version.
>
> Microsoft Visual C++ 2005 Redistributable Package (x86)
> http://www.microsoft.com/en-us/download/details.aspx?id=3387
>
> or
>
> Microsoft Visual C++ 2005 Redistributable Package (x64)
> http://www.microsoft.com/en-us/download/details.aspx?id=21254
>
> If im correct:
> msvcr80.dll = Microsoft Visual C++ 2005
> msvcr90.dll = Microsoft Visual C++ 2008
> msvcr100.dll = Microsoft Visual C++ 2010
>
> But installing it didnt resolve the issue for me. If Joaquim is correct,
> only compiling Python and GDAL with the same version of the compiler would
> help. Can you see which compiler was used, and which one you need? Both my
> Python and GDAL dlls seem to point to the same msvc90.dll file.
>
> If i open my _gdal.pyd in Dependency Walker i see gdal.dll links twice to
> exactly the same dll, and Dependency Walker complains in only one occasion.
> Its a complete mystery to me....
>
> <http://osgeo-org.1560.n6.nabble.com/file/n5016933/Depency_walker_gdal.png
> >
>
>
> Regards,
> Rutger
>
>
>
>
>
>
> --
> View this message in context:
> http://osgeo-org.1560.n6.nabble.com/gdal-dev-ImportError-when-importing-gdal-module-with-python-2-7-on-Windows-7-64-bit-tp5006198p5016933.html
> Sent from the GDAL - Dev mailing list archive at Nabble.com.
> _______________________________________________
> 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/20121116/07fbdf95/attachment.html>


More information about the gdal-dev mailing list