Welcome, Guest
Username: Password: Remember me

TOPIC: ModuleNotFoundError: No module named '_hermes'

ModuleNotFoundError: No module named '_hermes' 4 years 8 months ago #35485

  • huangziyi2017
  • huangziyi2017's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 19
  • Thank you received: 2
Hi,

Try to do postprocess, using "postel" of Python3 scripts of v8p1r0.
Error occurs when calling "Class TelemacFile". The error is at the line 84 of "telapy.api.hermes.py":
import _hermes

Do I need to make a dll myself?

Command line error message is:
Traceback (most recent call last):
File "C:\opentelemac-mascaret\v8p1\scripts\python3\telapy\api\hermes.py", line 84, in __init__
import _hermes
ModuleNotFoundError: No module named '_hermes'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "TelPlot.py", line 11, in <module>
res = TelemacFile(file_name)
File "C:\opentelemac-mascaret\v8p1\scripts\python3\data_manip\extraction\telemac_file.py", line 34, in __init__
HermesFile.__init__(self, file_name,
File "C:\opentelemac-mascaret\v8p1\scripts\python3\telapy\api\hermes.py", line 92, in __init__
raise TelemacException(\
utils.exceptions.TelemacException: Error: unable to load the dynamic library _hermes.dll
You can check the environment variable: PYTHONPATH
No module named '_hermes'
The administrator has disabled public write access.

ModuleNotFoundError: No module named '_hermes' 4 years 8 months ago #35593

  • yugi
  • yugi's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 851
  • Thank you received: 244
Hi,

Did you compile the api ?
Could you post your configuration file (systel.cfg) and your environment file if you have one.
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.

ModuleNotFoundError: No module named '_hermes' 4 years 8 months ago #35594

  • huangziyi2017
  • huangziyi2017's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 19
  • Thank you received: 2
Hi, yugi

I have compiled the sources, by using the script "compile_telemac.py". Now the "builds" folder has files of exe(inside "bin"), lib & cmdx(inside "lib"), and o & mod & cmdo(inside "obj").

Attached is the configuration file. I don't have a environment file.

Thanks!
Attachments:
The administrator has disabled public write access.

ModuleNotFoundError: No module named '_hermes' 4 years 8 months ago #35595

  • yugi
  • yugi's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 851
  • Thank you received: 244
You need to add the following:
options: api static
f2py_name: f2py3
pyd_fcompiler: gfortran

f2py3 might have to be replace by f2py depending on you Python installation.

As for the environment you can have a look at configs/pysource.template.bat to see what you need to set.
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: huangziyi2017

ModuleNotFoundError: No module named '_hermes' 4 years 8 months ago #35607

  • huangziyi2017
  • huangziyi2017's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 19
  • Thank you received: 2
Thanks, yugi.

The compilation of api is started, but with an error at second step in "compile_api_f2py" function of script "compil_tools.py". The "cmd" subprocess is run with a returncode of 1, raising "CalledProcessError".

The error message is:
Traceback (most recent call last):
File "C:\opentelemac-mascaret\v8p1\scripts\python3\compilation\compil_tools.py", line 918, in compile_api_f2py
output = check_output(cmd, shell=True, stderr=STDOUT)
File "C:\Python38\lib\subprocess.py", line 411, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "C:\Python38\lib\subprocess.py", line 512, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'f2py --quiet -c C:\opentelemac-mascaret\v8p1\builds\win10gfors\wrap_api\lib\api.pyf --fcompiler=gfortran --opt="" -IC:\opentelemac-mascaret\v8p1\builds\win10gfors\wrap_api\include C:\opentelemac-mascaret\v8p1\builds\win10gfors\wrap_api\lib\libapi.lib C:\opentelemac-mascaret\v8p1\builds\win10gfors\wrap_api\lib\libtelemac3d.lib C:\opentelemac-mascaret\v8p1\builds\win10gfors\wrap_api\lib\libtelemac2d.lib C:\opentelemac-mascaret\v8p1\builds\win10gfors\wrap_api\lib\libsisyphe.lib C:\opentelemac-mascaret\v8p1\builds\win10gfors\wrap_api\lib\libgaia.lib C:\opentelemac-mascaret\v8p1\builds\win10gfors\wrap_api\lib\libnestor.lib C:\opentelemac-mascaret\v8p1\builds\win10gfors\wrap_api\lib\libtomawac.lib C:\opentelemac-mascaret\v8p1\builds\win10gfors\wrap_api\lib\libartemis.lib C:\opentelemac-mascaret\v8p1\builds\win10gfors\wrap_api\lib\libkhione.lib C:\opentelemac-mascaret\v8p1\builds\win10gfors\wrap_api\lib\libwaqtel.lib C:\opentelemac-mascaret\v8p1\builds\win10gfors\wrap_api\lib\libgretel.lib C:\opentelemac-mascaret\v8p1\builds\win10gfors\wrap_api\lib\libpartel.lib C:\opentelemac-mascaret\v8p1\builds\win10gfors\wrap_api\lib\libbief.lib C:\opentelemac-mascaret\v8p1\builds\win10gfors\wrap_api\lib\libparallel.lib C:\opentelemac-mascaret\v8p1\builds\win10gfors\wrap_api\lib\libhermes.lib C:\opentelemac-mascaret\v8p1\builds\win10gfors\wrap_api\lib\libdamocles.lib C:\opentelemac-mascaret\v8p1\builds\win10gfors\wrap_api\lib\libspecial.lib ' returned non-zero exit status 1.

In addition, I have added a key of [libs_all] in "systel.cfg" with empty value, because of
cfg['libs_all']
in "get_api_ld_flags" function.
The administrator has disabled public write access.

ModuleNotFoundError: No module named '_hermes' 4 years 8 months ago #35609

  • yugi
  • yugi's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 851
  • Thank you received: 244
Indeed the empty libs_all is a bug that was corrected in the trunk version.

As for your error could you edit the file C:\opentelemac-mascaret\v8p1\scripts\python3\compilation\compil_tools.py
And remove "--quiet" that should be at line 883 and 906.

This we make f2py more verbose.
By the way changing the extension to .a instead of .lib might be a good idea as well. (key sfx_lib in your systel.cfg)

Then run compilation again and post the listing here
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.

ModuleNotFoundError: No module named '_hermes' 4 years 8 months ago #35614

  • huangziyi2017
  • huangziyi2017's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 19
  • Thank you received: 2
The argument
--quiet
has been removed.

Also [sfx_lib] is set to ".a".

It still turns out the "CalledProcessError", same as before.

By the way, following the "CalledProcessError", another exception will always occur in the "raise" statement of the "except" block:
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "compile_telemac.py", line 144, in <module>
main()
File "compile_telemac.py", line 135, in main
compile_api_files(silent=not options.verbose,
File "C:\opentelemac-mascaret\v8p1\scripts\python3\compilation\compil_tools.py", line 973, in compile_api_files
compile_api_f2py('api', api_dir, source_api, skip_source, ld_flags,
File "C:\opentelemac-mascaret\v8p1\scripts\python3\compilation\compil_tools.py", line 926, in compile_api_f2py
execpt.output.decode('utf-8')))
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xce in position 1436: invalid continuation byte
The administrator has disabled public write access.

ModuleNotFoundError: No module named '_hermes' 4 years 8 months ago #35621

  • cyamin
  • cyamin's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 997
  • Thank you received: 234
Just a little note:
The closest I have being to compiling the api in Windows is by using the following config (mingw-64 compiler, WinPython 3.7.1):
f2py_name: python -m numpy.f2py
pyd_fcompiler: gnu95
Costas
The administrator has disabled public write access.

ModuleNotFoundError: No module named '_hermes' 4 years 8 months ago #35629

  • huangziyi2017
  • huangziyi2017's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 19
  • Thank you received: 2
Whenever the line 918 in "compil_tool.py" is executed, a new path will be generated as:
C:\opentelemac-mascaret\v8p1\builds\win10gfors\wrap_api\lib\Users\<Username>\AppData\Local\Temp\tmp807e6x63\src.win-amd64-3.8\opentelemac-mascaret\v8p1\builds\win10gfors\wrap_api\lib
where <Username> is the username of the current Windows account, and "tmp807e6x63" updates for each execution.


At the same time, a path will also be generated as:
C:\Users\<Username>\AppData\Local\Temp\tmp807e6x63
but with nothing under the folder "tmp807e6x63".

Not sure if this matters of the "CalledProcessError".
The administrator has disabled public write access.

ModuleNotFoundError: No module named '_hermes' 4 years 8 months ago #35640

  • huangziyi2017
  • huangziyi2017's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 19
  • Thank you received: 2
Could anyone kindly share me with compiled modules of "_api" and "_hermes" that can be directly imported.

The compilation of api just cannot go through for some unknown reason.
The administrator has disabled public write access.
Moderators: borisb

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