osmcode / pyosmium

Python bindings for libosmium
https://osmcode.org/pyosmium
BSD 2-Clause "Simplified" License
314 stars 64 forks source link

DLL load faill import osmium #148

Closed EpipolarWagner closed 2 years ago

EpipolarWagner commented 3 years ago

Hi, I installed osmium via pip. However when importing it "import osmium". I get the following error:

Traceback (most recent call last): File "", line 1, in File "somePath\osmium3.7\lib\site-packages\osmiuminit.py", line 1, in from osmium._osmium import * ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden.

However the expat.dll, zlib.dll and libbz2.dll is located in the osmium folder. Install osmium via pip without any problem. I use windows 10, conda and python 3.7.6.

lonvia commented 3 years ago

I can't really help with that, I'm afraid, as I don't have access to a Windows build environment or any significant experience with it. My guess would be that either the DLL search path is messed up somehow or that the directory where you installed osmium doesn't allow executables. You could try https://help.osm.org. Maybe there is somebody with Windows experience over there.

aulon commented 3 years ago

Hi,

The solution that worked for me:

  1. Use python 3.6 or 3.7
  2. Use osmium version 2.15.4
lonvia commented 3 years ago

Well, if nobody is interested in debugging this, then the best way of action is likely to pull the windows binaries from pip again and require to build the source package.

At a very minimum it would be nice to know which DLL is missing exactly.

wiktorn commented 3 years ago

I did some tests:

And looked a bit into what do we require to run.

Are you sure you have VC++ redistributable installed (2015, 2017 and 2019) installed? My guess is that they should come with Python already as it is build against the same version of VC++.

You may try to use http://www.dependencywalker.com/ to open _osmium.cp38-win_amd64.pyd and check, which libraries fail to load (ignore API-MS-WIN- and Python.DLL stuff)

lonvia commented 3 years ago

Thanks @wiktorn. Should we be packaging the VC++ redistributables?

lonvia commented 3 years ago

I've played with moving the CI builds for Windows to Github Actions and I run into exactly the same problem. The wheel builds fine and I can install it on a new vanilla machine but when executing a mysterious DLL is missing. I suspect it has to do with the VC++ redistributables. Any hits from a Windows user what additional setup is necessary to make that work?

The github action script is here: https://github.com/osmcode/pyosmium/blob/test-appveyor/.github/workflows/ci.yml#L149 A failing test run: https://github.com/osmcode/pyosmium/actions/runs/1148569482

lonvia commented 2 years ago

Wheel building on Windows now works. There will be binary wheels with the next release.