Search code examples
python-3.4py2exegdalrasterio

Dependencies tracking on python application


I am trying to make a portable application from a python app I developped on Windows 7 - 32 bits using python3.4. My first idea was to use py2exe combined with a ThinApp equivalent, but as I use rasterio which is not a pure python library, py2exe does not manage to find some DLLs. If I try to run the generated executable I get this error :

File Traceback (most recent call last):
  File "viewer.py", line 3, in <module>
    import MainWindow as GUI
  File "C:\Users\IEUser\Documents\viewer-dev\viewer\MainWindow.py", line 2, in <module>
    import ImageWindow
  File "C:\Users\IEUser\Documents\viewer-dev\viewer\ImageWindow.py", line 1, in <module>
    import Resampler
  File "C:\Users\IEUser\Documents\viewer-dev\viewer\Resampler.py", line 1, in <module>
    import rasterio
  File "C:\Python34\lib\site-packages\rasterio\__init__.py", line 31, in <module>
    from rasterio._base import gdal_version
  File "<loader>", line 10, in <module>
  File "<loader>", line 8, in __load
ImportError: (DLL load failed: The specified module could not be found.) 'C:\\Users\\IEUser\\Documents\\viewer-dev\\dist\\rasterio._base.pyd'

I read that I had to add these DLLs manually in the dist directory, but I wonder how could I get a list of the required DLLs ?


Solution

  • You can use the Dependency Walker on your py2exe to see all the missing dependencies.

    Check the executable and all the linked libraries(PYD & DLL files)