ImportError: DLL load failed while importing defs:

I am trying to use medcoupling together with h5py

my system details are as follows:

Operating System: Windows 10
Python version: 3.11
Where Python was acquired: Anaconda on Windows
h5py version: 3.11.0
HDF5 version: None
medcoupling version - V9_11_0
h5py version - 3.11.0

import medcoupling
import h5py

I get the following error

Traceback (most recent call last):
File “m:\named_selections\trial.py”, line 2, in
import h5py
File “M:\named_selections.conda\Lib\site-packages\h5py_init_.py”, line 33, in
from . import version
File “M:\named_selections.conda\Lib\site-packages\h5py\version.py”, line 15, in
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.

Could anyone help me with this please! Thanks.

you’re mixing Python 3.11 and Python 3.6 here. Here is how you can proceed:

  • ensure that your PATH does not contain any CONDA reference.

  • then, in a CMD terminal, simply run the following command line to setup MEDCOUPLING environment:
    call MEDCOUPLING-9.11.0\env_launch.bat

  • Install the following H5PY version which matches MEDCOUPLING 9.11.0 version:

    python -m pip install h5py==2.10.0

  • launch Python and check that you can import h5py

  • Check that you can create HDF5 files, read, etc.