ImportError: DLL load failed on Windows (Python 3.x, cffi 1.11.3)

Issue #355 resolved
reaperhulk
created an issue

With cffi 1.11.3 if I install a project from sdist (like bcrypt or cryptography) on Windows with Python 3.x then I get an import error for all the cffi built pyd files. pyd files built with previous cffi versions import fine on 1.11.3.

Comments (15)

  1. reaperhulk reporter

    Your guess is actually right! There hasn't been a virtualenv release since 2016 so that patch is not available. Unfortunately this appears to mean that anyone using virtualenv on python 3 will be unable to use cffi packages compiled against 1.11.3.

  2. Armin Rigo

    Ok, so it means that for now, fixing cffi to link to python3.dll instead of python36.dll was a very bad idea. Is that correct? If so, I'll revert that change for now, add the reason to the docs, and release 1.11.4.

  3. reaperhulk reporter

    Yes, I think that's true. This isn't your bug but it's probably a good idea to revert until (some time) after a virtualenv that fixes the bug is released.

  4. Armin Rigo

    If I revert to the previous situation, the file is called foo.pyd but it is linking to python36.dll. Should I do that, or should I more clearly not define Py_LIMITED_API at all on Windows and have the file be called foo.cp36-win_amd64.pyd?

  5. Cosimo Lupo

    yeah, I think it would be better to not pass py_limited_api=True to setuptools.Extension for Windows until cffi properly define Py_LIMITED_API before including pyconfig.h.

  6. Cosimo Lupo

    Virtualenv 15.2.0 was quietly released last week, and includes a fix for the python3.dll on Windows. We should revert the change that disabled Py_LIMITED_API on Windows at some point.

  7. Log in to comment