Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

h5py import failure: "DLL load failed while importing defs" #6612

Closed
sbourdeauducq opened this issue Jun 21, 2020 · 8 comments
Closed

h5py import failure: "DLL load failed while importing defs" #6612

sbourdeauducq opened this issue Jun 21, 2020 · 8 comments

Comments

@sbourdeauducq
Copy link
Sponsor

On a fresh installation of MSYS2 (from msys2-x86_64-20200602.exe), I cannot import the h5py module in Python after installing the package:

> pacman -S mingw64/mingw-w64-x86_64-python-h5py
resolving dependencies... 
looking for conflicting packages... 
 
Packages (33) mingw-w64-x86_64-bzip2-1.0.8-1  mingw-w64-x86_64-ca-certificates-20190110-1  mingw-w64-x86_64-expat-2.2.9-1        
              mingw-w64-x86_64-gcc-libgfortran-10.1.0-3  mingw-w64-x86_64-gcc-libs-10.1.0-3  mingw-w64-x86_64-gettext-0.19.8.1-8 
              mingw-w64-x86_64-gmp-6.2.0-1  mingw-w64-x86_64-hdf5-1.12.0-2  mingw-w64-x86_64-libffi-3.3-1
              mingw-w64-x86_64-libiconv-1.16-1  mingw-w64-x86_64-libsystre-1.0.1-4  mingw-w64-x86_64-libtasn1-4.16.0-1
              mingw-w64-x86_64-libtre-git-r128.6fb7206-2  mingw-w64-x86_64-libwinpthread-git-8.0.0.5906.c9a21571-1
              mingw-w64-x86_64-mpc-1.1.0-1  mingw-w64-x86_64-mpdecimal-2.4.2-1  mingw-w64-x86_64-mpfr-4.0.2-2
              mingw-w64-x86_64-ncurses-6.2-1  mingw-w64-x86_64-openblas-0.3.9-1  mingw-w64-x86_64-openssl-1.1.1.g-1
              mingw-w64-x86_64-p11-kit-0.23.20-2  mingw-w64-x86_64-python-3.8.3-1  mingw-w64-x86_64-python-numpy-1.18.4-1
              mingw-w64-x86_64-python-six-1.14.0-1  mingw-w64-x86_64-readline-8.0.004-1  mingw-w64-x86_64-sqlite3-3.32.1-1
              mingw-w64-x86_64-szip-2.1.1-2  mingw-w64-x86_64-tcl-8.6.10-1  mingw-w64-x86_64-termcap-1.3.1-5
              mingw-w64-x86_64-tk-8.6.10-1  mingw-w64-x86_64-xz-5.2.5-1  mingw-w64-x86_64-zlib-1.2.11-7
              mingw-w64-x86_64-python-h5py-2.10.0-1
[...]

> python
Python 3.8.3 (default, May 14 2020, 12:19:09)  [GCC 10.1.0 64 bit (AMD64)] on win32 
Type "help", "copyright", "credits" or "license" for more information.
>>> import h5py 
Traceback (most recent call last): 
  File "<stdin>", line 1, in <module> 
  File "C:\MSYS64\mingw64\lib\python3.8\site-packages\h5py\__init__.py", line 34, in <module>
    from . import version
  File "C:\MSYS64\mingw64\lib\python3.8\site-packages\h5py\version.py", line 17, in <module>
    from . import h5 as _h5
  File "h5py/h5.pyx", line 1, in init h5py.h5
ImportError: DLL load failed while importing defs: The specified procedure could not be found.
@zhubr
Copy link

zhubr commented Jul 8, 2020

I'm facing the same problem. Just wiped the entire msys and did a fresh clean install today in hope to fix it but nope, the problem persists.

@Finalfantasykid
Copy link

I'm having the same issue with opencv after I upgraded all my mingw packages.

ImportError: DLL load failed while importing cv2: The specified procedure could not be found.

I double checked to see if the dll is there, and it is in the site-packages folder, so it should work. pip freeze doesn't even list opencv anywhere.

@zhubr
Copy link

zhubr commented Jul 12, 2020

Workaround that worked for me:

  1. Remove hdf5 version 1.12.x
  2. Obtain hdf5 version 1.8.21 (E.g. fetch from git history, rebuild and install manually), add to "IgnorePkg=" in pacman.conf to prevent damage by updates in the future. Notify mingw hdf5 maintainer that hdf5 1.12.x breaks stuff in mingw.
  3. Fetch current h5py source package from git, rebuild and install normally.
  4. Bingo!

@mati865
Copy link
Collaborator

mati865 commented Jul 12, 2020

Does it work if you rebuild h5py?

@zhubr
Copy link

zhubr commented Jul 12, 2020

AFAIK there is no way to build h5py against hdf5 1.12 yet (at least not without some sorts of dirty messing).

@lazka
Copy link
Member

lazka commented Aug 21, 2020

Had a quick look too. Upstream isn't ready, we need to wait for a new h5py release..

@Antoine-bal
Copy link

Had a quick look too. Upstream isn't ready, we need to wait for a new h5py release..

Hello, so you mean that we are not able to solve the problem until the next release ?

@sbourdeauducq
Copy link
Sponsor Author

Resolved in the latest version with these packages installed:

mingw-w64-x86_64-gcc-libgfortran-11.2.0-2-any.pkg.tar.zst                  mingw-w64-x86_64-openblas-0.3.18-4-any.pkg.tar.zst
mingw-w64-x86_64-gcc-libs-11.2.0-2-any.pkg.tar.zst                         mingw-w64-x86_64-python-3.9.7-4-any.pkg.tar.zst
mingw-w64-x86_64-hdf5-1.12.1-2-any.pkg.tar.zst                             mingw-w64-x86_64-python-h5py-3.5.0-1-any.pkg.tar.zst
mingw-w64-x86_64-libaec-1.0.6-1-any.pkg.tar.zst                            mingw-w64-x86_64-python-numpy-1.21.3-1-any.pkg.tar.zst
mingw-w64-x86_64-libwinpthread-git-9.0.0.6346.6cc97775a-1-any.pkg.tar.zst  mingw-w64-x86_64-zlib-1.2.11-9-any.pkg.tar.zst

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants