pyzmq icon indicating copy to clipboard operation
pyzmq copied to clipboard

WIndows 7 DLL load failed

Open PhilippSelenium opened this issue 5 years ago • 35 comments

>> import zmq
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\venv\lib\site-packages\zmq\__init__.p
    _load_libzmq()
  File "C:\Users\venv\lib\site-packages\zmq\__init__.p
    from . import libzmq
ImportError: DLL load failed: The specified module could not be found.
  • python 3.6.8 (Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)] on win32)
  • windows 7 enterprise
  • pyzmq==21.0.0

Note: Works fine with pyzmq==20.0.0 Maybe some packaging error?

PhilippSelenium avatar Jan 15 '21 07:01 PhilippSelenium

Thanks for testing! Indeed, this is the first release built from a new CI infrastructure. win32 or win_amd64?

minrk avatar Jan 15 '21 07:01 minrk

It is 64bit

PhilippSelenium avatar Jan 15 '21 08:01 PhilippSelenium

Hm, ok. I've tested 32b and 64b on my Windows VM (server-2019) and they work okay. I'll see if I can find an older one. Maybe they've been linked with some too-recent dependency.

Can you test with a later Python to see if it's isolated to 3.6?

minrk avatar Jan 15 '21 08:01 minrk

I get the same error for:

Python 3.8.7 (tags/v3.8.7:6503f05, Dec 21 2020, 17:59:51) [MSC v.1928 64 bit (AMD64)] on win32

PhilippSelenium avatar Jan 15 '21 08:01 PhilippSelenium

Probably related to error "Windows fatal exception: code 0xc0000139" we are getting with version 21. Was fine with version 20.

https://gitlab.com/secml/secml/-/jobs/965036924

m-melis avatar Jan 15 '21 09:01 m-melis

I set up a new VM with server-2012 and get the same errors due to missing DLLs (first: vcruntime140_1.dll, which is added in Python >=3.8).

I think I tracked it down to building on windows-2019 with vs2019 instead of windows-2016 with vs2017. GitHub Actions doesn't appear to have a build environment with vs2015, which is used for Python 3.6, so we'll see.

#1473 will build new wheels with vs2017 and we can test them out.

minrk avatar Jan 15 '21 09:01 minrk

@PhilippSelenium can you test with the wheels in the wheels-win_amd64 artifact? It's a zipfile of win_amd64 wheels for py36-39. They work on my Windows server-2012 VM, so I think they are going to work for you. I'll go a head and cut 21.0.1 with the fix if you can confirm that those wheels work for you.

minrk avatar Jan 15 '21 09:01 minrk

depending on timeline, I will cut 21.0.1 before I have to quit for the day if I don't hear anything (I'm not sure what your timezone is, it might already be the middle of the night for you!), since it at least fixes the issue for my environment where I was able to reproduce the issue. There's always 21.0.2 :)

minrk avatar Jan 15 '21 10:01 minrk

@minrk Thanks for the lightning fast fix. Sadly it does not fix my problem. But it might have to do with my environment. I'm investigating ...

PhilippSelenium avatar Jan 15 '21 10:01 PhilippSelenium

make sure to remove the old pyzmq before installing the new one, since those wheels have the same version and a simple pip install ./pyzmq-21... will give "I already have that!" and not actually install the new one.

I used Dependency Walker on the installed libzmq....pyd to identify what's missing. If you can do the same and share a screenshot, that would help.

minrk avatar Jan 15 '21 10:01 minrk

I uninstalled the old zmq first and also checked that the folder is not in site-packages.

As requested I attached a screenshot dependencywalker

PhilippSelenium avatar Jan 15 '21 10:01 PhilippSelenium

Does the python 3.8 wheel work for you?

minrk avatar Jan 15 '21 11:01 minrk

No it is the same error for both :(

PhilippSelenium avatar Jan 15 '21 12:01 PhilippSelenium

Using pyzmq==20.0.0 (which works for me) I get the following dependency erros: pzymq_20_0_0

I also tried reinstalling vc_redist.x64.exe but the problem might be the old windows version or just using windows. I will try to update to win10 or pin the pyzmq dependency.

PhilippSelenium avatar Jan 15 '21 13:01 PhilippSelenium

ok, looks like it's building with a target minimum Windows of 8.1. Now I just have to figure out how to tell it not to do that. I can't find any docs about it for Python so far.

minrk avatar Jan 15 '21 13:01 minrk

I need to stop for today, but I'm going to merge #1473 and release 21.0.1 now as it at least moves the base required Windows back (to 8.1, I think). I'll look at fixing it for Windows 7 as soon as I can (or if someone else knows how, that would be awesome!).

minrk avatar Jan 15 '21 14:01 minrk

We were having the same issue on Windows 10, 64bit with Python 3.7 Downgrading to 20.0 solved it for now.

SoerenXD avatar Jan 15 '21 14:01 SoerenXD

@SoerenXD did you have 21.0.0 or 21.0.1? I would expect 21.0.0 to fail but 21.0.1 to fix your case.

minrk avatar Jan 18 '21 08:01 minrk

@m-melis I believe your case should be fixed by 21.0.1 as well, if you could confirm. I can't tell from the link what version of Windows it is, but assuming it's a version that's not EOL by Microsoft, I think it should work (oldest Windows versions in extended support appear to be Windows 8.1, Windows Server 2012 R2)

minrk avatar Jan 18 '21 09:01 minrk

@m-melis I believe your case should be fixed by 21.0.1 as well, if you could confirm. I can't tell from the link what version of Windows it is, but assuming it's a version that's not EOL by Microsoft, I think it should work (oldest Windows versions in extended support appear to be Windows 8.1, Windows Server 2012 R2)

Still crashing with 21.0.1. I've checked and our test environment should be Win-1809, actually. Python 3.6.

I'm going to test installing vcredist140 instead of vcredist2017 to see if anything changes.

m-melis avatar Jan 18 '21 11:01 m-melis

Hm, that's getting more mysterious. My test VM is Server 2012 R2 with Python 3.6.8 (from official Python.org installer) and no vcredist packages installed and it's working (both 32 and 64b). I also have an 1809 VM, also with no vcredist packages, also working.

How have you installed Python? What *.DLL files are bundled with Python itself?

minrk avatar Jan 18 '21 13:01 minrk

@PhilippSelenium I got some help and I believe #1475 will fix support for Windows 7. Can you test the wheels from #1475 and #1476 and report back?

minrk avatar Jan 20 '21 11:01 minrk

@minrk I tested the wheels from both PRs both of them still throw the missing DLL error :( Also I'm puzzled: I downloaded the artifacts from the build but now the build has failed and I can no longer download them ... did I use the correct ones (pyzmq-21.0.2.dev0)

PhilippSelenium avatar Jan 20 '21 12:01 PhilippSelenium

I realized I missed something. Can you try the ones form this build?

minrk avatar Jan 20 '21 13:01 minrk

Nope, sorry, messed it up again. The builds to test will be this one for vs2017 and this one for vs2019. I hope the vs2017 should work this time, but I'm less confident about vs2019.

minrk avatar Jan 20 '21 13:01 minrk

My understanding from this discussion is that vs2019 should work, but I may need to also update my bundle-vcruntime code.

minrk avatar Jan 20 '21 13:01 minrk

Nope again, maybe these builds will work:

  • https://github.com/zeromq/pyzmq/actions/runs/498669845
  • https://github.com/zeromq/pyzmq/actions/runs/498680583

There doesn't appear to be any way to test the supported Windows versions of the compiled artifacts other than "have an old Windows and try to import it" and I have no way to get any Windows older than Server 2012, so I cannot test the Windows 7 support.

minrk avatar Jan 20 '21 13:01 minrk

Nope sorry still the same error.

PhilippSelenium avatar Jan 20 '21 14:01 PhilippSelenium

ok, then I don't understand what to do and am out of ideas. Maybe i'm setting WINVER wrong, or maybe there's something else I need to turn off to prevent whatever mysterious thing that I didn't touch is requiring more recent Windows. Since all versions of Windows with any level of support from Microsoft appear to work fine (>=8.1), I'm not sure I can put any more time into this at the moment.

minrk avatar Jan 21 '21 10:01 minrk

Actually, one more to try: can you test this (Python 3.8) wheel: https://file.io/4t3qnohuDcOh

If that works, I have one last option before giving up.

Thank you so much for your dbugging help!

minrk avatar Jan 21 '21 11:01 minrk