Error: unable to load the dynamic library _api.dll

Hello,

I am trying to run the telemac2d API example. I am facing the following error

utils.exceptions.TelemacException: Error: unable to load the dynamic library _api.dll

You can check the environment variable: PYTHONPATH

No module named '_api'

I’m using windows 10 and Telemac v8p3r1. I managed to compile the API.

My PYTHONPATH:

%HOMETEL%\scripts\python3; C:\opentelemac-mascaret\v8p3r1\builds\win7gfors\wrap_api\lib

My user environment Path:

%HOMETEL%\scripts\python3

I tried all the suggestions in the previous forum posts about the same topic or related like “unable to load the dynamic library _hermes.dll”.

I have file named (_api.cp310-win_amd64.pyd) in (C:\opentelemac-mascaret\v8p3r1\builds\win7gfors\wrap_api\lib) I tried to change it to _api.pyd one time and _api.dll another time and copied it to “%HOMETEL%\scripts\python3”, Unfortuonately all these trials failed.

Any suggestions?

systel_v8p3r1.cfg (2.7 KB)

Hello [name removed],

In the other topic you have already posted, many of what I have already answered is also right here.

All you have already written here seem to show that your installation is not right and that it is not a TELEMAC-2D issue (can you run the TELEMAC-2D steering file simply by running telemac2d.py name_steering_file.cas?

I move your topic in the Windows installation section. Maybe you will get more answers,

[name removed]

1 Like

Thank you very much for your suggestions. As recommended I used telemac2d.py to run a simple simulation and it worked. So, I think it’s not related to the installation. Are there any other possible reasons?

I asked someone, he said if the software uses Cmake it could be the issue.

Hello [name removed],

I tried to install TELEMAC on another machine using Windows 10 and v8p3r1 I followed the instructions from the Installation on Windows http://wiki.opentelemac.org/doku.php?id=installation_on_windows_with_cygwin

and used the systel file as follows:

# _____                              _______________________________

# ____/ TELEMAC Project Definitions /______________________________/

#

[Configurations]

configs: win7gfors

# win7tels win7gfors win7gforsdbg  win7telsdbg

# _____                     ________________________________________

# ____/ windows 7 generals /_______________________________________/

[general]

#

root:       C:\opentelemac-mascaret\v8p3r1

version: v8p3r1

language:   2

modules:    system -dredgesim

options: api static

#

f2py_name: f2py

f2py_opt: -O3

pyd_fcompiler: gnu95

pyd_compiler: mingw32

libs_all:	

#

sfx_zip:    .zip

sfx_lib:    .a

sfx_mod:    .mod

sfx_exe:    .exe

#

val_root:   <root>\examples

val_rank:   all

cmd_obj_c: gcc -c <srcName> -o <objName>

# also possible val_rank:   <3 >7 6

#

# _____                         ____________________________________

# ____/ windows 7 intel scalar /___________________________________/

[win7tels]

#

cmd_obj:    ifort.exe /c /Ot /iface:cref /iface:nomixed_str_len_arg /nologo /fpp /names:uppercase /convert:big_endian <mods> <incs> <f95name>

cmd_lib:    xilib.exe /nologo /out:<libname> <objs>

cmd_exe:    xilink.exe /nologo /subsystem:console /stack:<US_PASSPORT> /out:<exename> <objs> <libs>

#

mods_all:   /include:<config>

#

sfx_obj:    .obj

#

# _____                               ____________________________________

# ____/ windows 7 intel scalar debug /___________________________________/

[win7telsdbg]

#

cmd_obj:    ifort.exe /c /debug:full /iface:cref /iface:nomixed_str_len_arg /nologo /fpp /names:uppercase /convert:big_endian <mods> <incs> <f95name>

cmd_lib:    xilib.exe /nologo /out:<libname> <objs>

cmd_exe:    xilink.exe /nologo /subsystem:console /stack:<US_SSN> /out:<exename> <objs> <libs>

#

mods_all:   /include:<config>

#

sfx_obj:    .obj

#

# _____                            _________________________________

# ____/ windows 7 gfortran scalar /________________________________/

[win7gfors]

#

cmd_obj:    gfortran -cpp -c -O3 -fopenmp -fconvert=big-endian -frecord-marker=4 <mods> <incs> <f95name>

cmd_lib:    ar cru <libname> <objs>

cmd_exe:    gfortran -fopenmp -fconvert=big-endian -frecord-marker=4 -v -lm -o <exename> <objs>  <libs>

#

mods_all:   -I <config>

#

sfx_obj:    .o

#

# _____                                  _________________________________

# ____/ windows 7 gfortran scalar debug /________________________________/

[win7gforsdbg]

#

cmd_obj:    gfortran -cpp -c -O3 -fopenmp -fconvert=big-endian -frecord-marker=4 <mods> <incs> <f95name>

cmd_lib:    ar cru <libname> <objs>

cmd_exe:    gfortran -fopenmp -fconvert=big-endian -frecord-marker=4 -v -lm -o <exename> <objs> <libs>

#

mods_all:   -I <config>

#

sfx_obj:    .o

#

TELEMAC compiled as shown in the attached figure but the same problem with the dynamic library still exists when trying to run the API telemac2d example.

I checked the TelAPY manual, it mentioned

the TELEMAC-MASCARET SYSTEM and all its external libraries must be compiled in dynamic form.

How I can compile in dynamic form in windows?

I found these lines

[gfortran.dyn]

brief: GFortran compiler with Open MPI in dynamic mode

#

options: api

#

sfx_lib:    .so

#

mpi_cmdexec: mpirun -machinefile MPI_HOSTFILE -np <ncsize> <exename>

#

cmd_obj:    mpif90 -c -cpp -fPIC -O2 -fconvert=big-endian -frecord-marker=4 -DHAVE_MPI -DHAVE_MUMPS -DHAVE_MED -DHAVE_VTK <mods> <incs> <f95name>

cmd_lib:    mpif90 -fPIC -shared -fconvert=big-endian -frecord-marker=4 -lpthread -lm -o <libname> <objs>

cmd_exe:    mpif90 -fPIC -fconvert=big-endian -frecord-marker=4 -lpthread -lm -o <exename> <objs> <libs>

#

libs_all: -L$MUMPSHOME/lib -ldmumps -lmumps_common -lpord

          -L$SCALAPACKHOME/lib -lscalapack

          -lblas

          -lm -L$MEDHOME/lib -lmed -L$HDF5HOME/lib -lhdf5 -ldl -lstdc++ -lz

          -L$METISHOME/lib -lmetis

 

cmd_obj_c: gcc -c -fPIC <srcName> -o <objName>

in the Installation on Linux, I added them to my configuration file, but nothing changed.

I’m really not familiar with these things.

I need your kind advice. Thank you for your understanding.

[name removed]

[name removed], have you solved the problem to run dynamic simulations on windows?

[name removed]

Hello [name removed],

I have stopped using the Windows version. Perhaps you can try the new version of Telemac v8p5, as it works well for me on Linux.

[name removed]

That’s great.

Maybe could you share your systel.cfg and pysource.sh files that have you used for dynamic telemac v8p5 compilation on Linux?

[name removed]