Welcome, Guest
Username: Password: Remember me

TOPIC: ModuleNotFoundError: No module named '_hermes'

Error compiling api & hermes 4 years 7 months ago #35701

  • cyamin
  • cyamin's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 997
  • Thank you received: 234
I assumed 'vcruntime140.dll' was needed after compilation. Anyway, I copied it to 'wrap_api\lib' and retried, but it did not resolve the issue. :(
The administrator has disabled public write access.

Error compiling api & hermes 4 years 7 months ago #35722

  • cyamin
  • cyamin's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 997
  • Thank you received: 234
Hello,

Having another go at it, I discovered that the order of libraries I had defined was incorrect, but was able to compile telemac by using the '-Xlinker --start-group' option that resolves dependencies in cyclic manner.
Obviously, that wasn't the case with 'f2py' and api compilation, thus it failed. Sorting the libraries in proper manner enabled compiling telemac without the '-Xlinker --start-group' flag.
I changed 'compil_tools.py' back to original and api compilation failed with undefined references to _gortran functions which was resolved by adding '-lgfortran' to 'ld_flags'. Compilation now completes and api remains to be tested.
I have noticed that I ask for static compilation (in systel.cfg + all my libraries are static) and hardcoded f2py command has '-shared' flag set no matter what (see below). Could that be a source for concern?
C:\msys64\mingw64\bin\gfortran.exe -Wall -g -Wall -g -shared tmp\Release\tmp\src.win-amd64-3.8\lib\_apimodule.o tmp\Release\tmp\src.win-amd64-3.8\tmp\src.win-amd64-3.8\lib\fortranobject.o tmp\Release\tmp\src.win-amd64-3.8\lib\_api-f2pywrappers2.o \\hydra\opentelemac\trunk\builds\gfmsmpi\lib\libapi.a \\hydra\opentelemac\trunk\builds\gfmsmpi\lib\libtelemac3d4api.a \\hydra\opentelemac\trunk\builds\gfmsmpi\lib\libtelemac2d4api.a \\hydra\opentelemac\trunk\builds\gfmsmpi\lib\libsisyphe4api.a \\hydra\opentelemac\trunk\builds\gfmsmpi\lib\libgaia4api.a \\hydra\opentelemac\trunk\builds\gfmsmpi\lib\libnestor4api.a \\hydra\opentelemac\trunk\builds\gfmsmpi\lib\libtomawac4api.a \\hydra\opentelemac\trunk\builds\gfmsmpi\lib\libartemis4api.a \\hydra\opentelemac\trunk\builds\gfmsmpi\lib\libkhione4api.a \\hydra\opentelemac\trunk\builds\gfmsmpi\lib\libwaqtel4api.a \\hydra\opentelemac\trunk\builds\gfmsmpi\lib\libgretel4api.a \\hydra\opentelemac\trunk\builds\gfmsmpi\lib\libpartel4api.a \\hydra\opentelemac\trunk\builds\gfmsmpi\lib\libbief4api.a \\hydra\opentelemac\trunk\builds\gfmsmpi\lib\libparallel4api.a \\hydra\opentelemac\trunk\builds\gfmsmpi\lib\libhermes4api.a \\hydra\opentelemac\trunk\builds\gfmsmpi\lib\libdamocles4api.a \\hydra\opentelemac\trunk\builds\gfmsmpi\lib\libspecial4api.a \\hydra\opentelemac\trunk\..\libraries\mumps-5.2.1\lib\libdmumps.a \\hydra\opentelemac\trunk\..\libraries\mumps-5.2.1\lib\libmumps_common.a \\hydra\opentelemac\trunk\..\libraries\mumps-5.2.1\lib\libpord.a \\hydra\opentelemac\trunk\..\libraries\scalapack-2.1.0\libscalapack.a \\hydra\opentelemac\trunk\..\libraries\OpenBLAS\libopenblas-r0.3.9.a \\hydra\opentelemac\trunk\..\libraries\parmetis-4.0.3\libmetis.a \\hydra\opentelemac\trunk\..\libraries\parmetis-4.0.3\libparmetis.a \\hydra\opentelemac\trunk\..\libraries\msmpi-10.1.12\Lib\x64\libmsmpi.a -LC:\msys64\mingw64\lib\gcc\x86_64-w64-mingw32\9.3.0 -LC:\Users\cyamin\WPy64-3820\python-3.8.2.amd64\libs -LC:\Users\cyamin\WPy64-3820\python-3.8.2.amd64\PCbuild\amd64 -lgfortran -lpython38 -lgfortran -o .\_api.cp38-win_amd64.pyd

Costas
The administrator has disabled public write access.

Error compiling api & hermes 4 years 7 months ago #35723

  • yugi
  • yugi's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 851
  • Thank you received: 244
Happy to hear that.

The -shared from f2py is normal because in the end the _hermes and _api lib are shared library hence the -shared of f2py.

Yes I remember that option now it was in telemac before when we used to compil in static.

When you have tested the api could you post your updated systel.cfg for those that encounter the same issue.
There are 10 types of people in the world: those who understand binary, and those who don't.
The administrator has disabled public write access.

Error compiling api & hermes 4 years 7 months ago #35724

  • cyamin
  • cyamin's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 997
  • Thank you received: 234
What is the proper way to append '-lgfortran' to f2pY libraries? At the moment it is appended in 'ld_flags' inside 'compil_tools.py'. Of course I could add it to libs_all but I'd rather not tamper with the compilation of the rest of TELEMAC.
What would be an easy way to test the api? ATM, I only intend to use hermes for post processing with TelemacFile.
The administrator has disabled public write access.

Error compiling api & hermes 4 years 7 months ago #35725

  • yugi
  • yugi's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 851
  • Thank you received: 244
Indeed it is by adding it to libs_all.
It should not tamper with the compilation of Telemac.
As it is included by mpi anyway.

To test hermes just run the hermes validation:
validate_telemac.py examples/python3/TelApy_hermes/vnv_hermes.py

To test the api run (you need mpi4py installed)
validate_telemac.py examples/python3/TelApy_api/vnv_api.py
There are 10 types of people in the world: those who understand binary, and those who don't.
The administrator has disabled public write access.
The following user(s) said Thank You: cyamin

Error compiling api & hermes 4 years 7 months ago #35726

  • cyamin
  • cyamin's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 997
  • Thank you received: 234
Obviously, there is something wrong:

File Attachment:

File Name: validate_hermes.txt
File Size: 3 KB


Where is _hermes.dll supposed to be located should everything be alright?
The administrator has disabled public write access.

Error compiling api & hermes 4 years 7 months ago #35728

  • yugi
  • yugi's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 851
  • Thank you received: 244
In builds/<yourconfig>/wrap_api/lib

I should be named _hermes.. With some stuff after (informations on f2py version).
If the file is there:
- Did you add this path to PYTHONPATH ?
- You need to make sure that f2py is using the same compiler as Telemac

You can test by running starting a python3 session
and just doing:
import _hermes
There are 10 types of people in the world: those who understand binary, and those who don't.
The administrator has disabled public write access.

Error compiling api & hermes 4 years 7 months ago #35729

  • cyamin
  • cyamin's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 997
  • Thank you received: 234
  • There is only one compiler in my PATH (MINGW64 from MSYS2) so it must be the same for all.
  • Inside my wrap_api/lib directory there is a bunch of static .a libraries plus two .pyd files with that structure (_hermes.cp38-win_amd64.pyd and _api.cp38-win_amd64.pyd), ~700kb and ~30mb respectively.
I added the folder to PYTHONPATH, but it didn't make any difference.
:S
The administrator has disabled public write access.

Error compiling api & hermes 4 years 7 months ago #35730

  • Jose_filho
  • Jose_filho's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 42
  • Thank you received: 2
Hi Christophe,

Please, could you share your config file? Since I have the same operational system and python version as you, but did not compile the api as well...

Regards,
The administrator has disabled public write access.

ModuleNotFoundError: No module named '_hermes' 4 years 7 months ago #35738

  • cyamin
  • cyamin's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 997
  • Thank you received: 234
Hello all,

The problem proved to be Python 3.8.2. Although it manages to compile, the import fails for some reason. Using Python 3.7.7 compiles the api but fails to compile hermes for being unable to find '-lvcruntime140'. I copied it to the mingw64/lib folder and compilation completed successfully. Both _api and _hermes can be imported in a python shell.

I have organized my Windows configuration following the readme and EDF's one. I attach it here for anyone interested.

File Attachment:

File Name: systel_gfmsmpi_2020-04-13.cfg
File Size: 5 KB


Best Regards,
Costas
The administrator has disabled public write access.
Moderators: borisb

The open TELEMAC-MASCARET template for Joomla!2.5, the HTML 4 version.