# Error: unable to load the dynamic library \_api.dll

**URL:** <https://opentelemac.org/forum/t/error-unable-to-load-the-dynamic-library-api-dll/7049>\
**Category:** Windows Version\
**Created:** [October 31, 2022, 2:35pm UTC](https://opentelemac.org/forum/t/error-unable-to-load-the-dynamic-library-api-dll/7049 "2022-10-31T14:35:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![user\_16895](https://opentelemac.org/forum/letter_avatar_proxy/v4/letter/u/bcef8e/32.png) [@user\_16895](https://opentelemac.org/forum/u/user_16895)\
**Post date:** [October 31, 2022, 2:35pm UTC](https://opentelemac.org/forum/t/error-unable-to-load-the-dynamic-library-api-dll/7049/1 "2022-10-31T14:35:50Z")

</div>

Hello,

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

```auto
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](https://opentelemac.org/forum/uploads/short-url/2tHzYHLsNwWJ0SATOIl6S6lZsAh.cfg) (2.7 KB)

---

<div class="post-metadata">

**Author:** ![user\_438](https://opentelemac.org/forum/letter_avatar_proxy/v4/letter/u/c77e96/32.png) [@user\_438](https://opentelemac.org/forum/u/user_438)\
**Post date:** [November 2, 2022, 8:25pm UTC](https://opentelemac.org/forum/t/error-unable-to-load-the-dynamic-library-api-dll/7049/2 "2022-11-02T20:25:50Z")

</div>

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]

---

<div class="post-metadata">

**Author:** ![user\_16895](https://opentelemac.org/forum/letter_avatar_proxy/v4/letter/u/bcef8e/32.png) [@user\_16895](https://opentelemac.org/forum/u/user_16895)\
**Post date:** [November 3, 2022, 5:29pm UTC](https://opentelemac.org/forum/t/error-unable-to-load-the-dynamic-library-api-dll/7049/3 "2022-11-03T17:29:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![user\_16895](https://opentelemac.org/forum/letter_avatar_proxy/v4/letter/u/bcef8e/32.png) [@user\_16895](https://opentelemac.org/forum/u/user_16895)\
**Post date:** [November 11, 2022, 6:23pm UTC](https://opentelemac.org/forum/t/error-unable-to-load-the-dynamic-library-api-dll/7049/4 "2022-11-11T18:23:33Z")

</div>

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](http://wiki.opentelemac.org/doku.php?id=installation_on_windows_with_cygwin)

and used the systel file as follows:

```auto
# ____________________________________

# ____/ 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

```auto
[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]

 ![ApiCompiled.png](https://opentelemac.org/uploads/default/original/2X/a/ae3237130aa404fad177527614b343fc087d3d3b.png)

---

<div class="post-metadata">

**Author:** ![user\_16649](https://opentelemac.org/forum/letter_avatar_proxy/v4/letter/u/5fc32e/32.png) [@user\_16649](https://opentelemac.org/forum/u/user_16649)\
**Post date:** [August 6, 2024, 12:45pm UTC](https://opentelemac.org/forum/t/error-unable-to-load-the-dynamic-library-api-dll/7049/5 "2024-08-06T12:45:22Z")

</div>

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

[name removed]

---

<div class="post-metadata">

**Author:** ![user\_16895](https://opentelemac.org/forum/letter_avatar_proxy/v4/letter/u/bcef8e/32.png) [@user\_16895](https://opentelemac.org/forum/u/user_16895)\
**Post date:** [August 6, 2024, 5:17pm UTC](https://opentelemac.org/forum/t/error-unable-to-load-the-dynamic-library-api-dll/7049/6 "2024-08-06T17:17:45Z")

</div>

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]

---

<div class="post-metadata">

**Author:** ![user\_16649](https://opentelemac.org/forum/letter_avatar_proxy/v4/letter/u/5fc32e/32.png) [@user\_16649](https://opentelemac.org/forum/u/user_16649)\
**Post date:** [August 6, 2024, 5:51pm UTC](https://opentelemac.org/forum/t/error-unable-to-load-the-dynamic-library-api-dll/7049/7 "2024-08-06T17:51:11Z")

</div>

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]
