Syrthesmpi error end Syrthes.gui With Python error

This forum is dedicated to Syrthes related issues, as the Syrthes tool does not have its own forum.
Post Reply
Kanssoune
Posts: 12
Joined: Tue Aug 02, 2022 8:05 am

Syrthesmpi error end Syrthes.gui With Python error

Post by Kanssoune »

Hello everyone!

I just installed syrthes 5.0 and i am having some errors which i would like to share here see if anyone can help.

The first error concerns syrthesmpi: I correctly entered the Openmpi path in the setup.ini file. But he can't install it. When I look in syrthesmpi.log I notice that in line 8 (syrthesmpi.log attached) it retrieves two directories in a row (/usr/lib64/openmpi/bin//usr/lib64/openmpi/bin/mpicc: Command not found) instead of one (/usr/lib64/openmpi/bin/mpicc). Anyone know why it retrieves these two paths and therefore returns me an error?

The second error concerns syrthes gui: When I run the calculation with syrthes gui (syrthes.gui --> Open Data File --> Run SYRTHES), I get a python error (python3: symbol lookup error: python3: undefined symbol: _Py_LegacyLocaleDetected). But if I run with command (for example python3 syrthes.py -n 2 -r 1 -d square.syd -t scotch -v ensight -l listing, I have no issue. Any idea about this error?


Thank you in advance for your help.

Kanssoune
Attachments
syrthesmpi.log
(1.2 KiB) Downloaded 165 times
Yvan Fournier
Posts: 4069
Joined: Mon Feb 20, 2012 3:25 pm

Re: Syrthesmpi error end Syrthes.gui With Python error

Post by Yvan Fournier »

Hello,

I'm not sure about the first error, but I have a probable explanation for the second.

Unless things have changed, Syrthes packages a binary distribution of Python+Qt (and other tools).
So :

- when you run syrthes.gui, it is using the path to the packaged version, which is probably built on a different Linux distribution and has not-quite compatible binaries.

- when you run python3 syrthes.py, you are probably using your own Python (though this depends on what was sourced; you can check with "which python3")

If this is the case, you can probably edit syrthes.gui (which is a small script) to adjust the path to the working Python.

The first error is similar to an issue we seem to have patched in our Syrthes 4 "source-only" backup version (https://www.code-saturne.org/cms/web/si ... _27.tar.gz), due to the way the Syrthes scripts work. I did not check the Syrthes 5 build, which adds many dependencies, and too many (potentially incompatible) binary files to my taste. The Syrthes developers have access to our internal patched git branch, but have not integrated/adapted our patches, so I can't do more.

In case the patch matches, try to apply this to your Syrthes 5 build (+ for added lines, - for removed, the rest for context).:

Code: Select all

 ##  Compiler
         makefileinFile.write("# Compiler path for gcc\n")
         makefileinFile.write("FRONT_CC="+self.comp+"\n")
 
+        p_mpicc = None
         if self.dicolib['mpi']['USE'].upper()=='YES':
             makefileinFile.write("# Compiler path for mpicc\n")
-            makefileinFile.write("CC="+self.dicolib['mpi']['PATH']+"/bin/"+self.wrapperc+"\n"+"\n")
+            for s in ('/', '/bin/', '/bin64/'):
+                p1 = self.dicolib['mpi']['PATH'] + s + self.wrapperc
+                if os.path.isfile(p1):
+                    p_mpicc = p1
+                    break
+
+        if p_mpicc:
+            makefileinFile.write("CC="+p_mpicc+"\n")
         else:
             makefileinFile.write("CC="+self.comp+"\n")
Regards,

Yvan
Kanssoune
Posts: 12
Joined: Tue Aug 02, 2022 8:05 am

Re: Syrthesmpi error end Syrthes.gui With Python error

Post by Kanssoune »

Hello Yvan,

Thank you a lot for your reply.

When I look at the syrthes.gui file, I don't see how to modify it in order to adjust the version of python that works.

Attached is the syrthes.gui file.

Regards,

Kanssoune
Attachments
syrthes.gui.txt
(344 Bytes) Downloaded 136 times
Yvan Fournier
Posts: 4069
Joined: Mon Feb 20, 2012 3:25 pm

Re: Syrthesmpi error end Syrthes.gui With Python error

Post by Yvan Fournier »

Hello,

Since you are using a binary build, things might be a bit different from what I have on my side with Syrthes 4, but you can try checking /opt/local/syrthes/syrthes5.0/arch/Linux_x86_64/lib/syrthes-GUI_exe/SyrthesMain to see if it is a text or binary file. If it is a text file, it might contain the relevant lines. If it is binary, it would be necessary to recompile it, but I am not sure of the procedure (i.e. we patched the v4.0 install on the code_saturne website so as to streamline that part, and I do not remember how is is done in the reference version, but you have some form of build documentation in the syrthes-gui directory).

Regards,

Yvan
Kanssoune
Posts: 12
Joined: Tue Aug 02, 2022 8:05 am

Re: Syrthesmpi error end Syrthes.gui With Python error

Post by Kanssoune »

Hello Yvan,

Thank you for your answer.

/opt/local/syrthes/syrthes5.0/arch/Linux_x86_64/lib/syrthes-GUI_exe/SyrthesMain is a binary file.

I followed the compilation steps from the attached README_build_GUI.txt file to recompile it.

At the build step with cx_freeze, I got some errors without any indication:
Installation : generation with cxfreeze ...
Erreur : Aucune correspondance trouvée
Erreur : Aucune correspondance trouvée
Erreur : Aucune correspondance trouvée
Erreur : Aucune correspondance trouvée
Erreur : Aucune correspondance trouvée
running build
running build_exe

After that, the build apparently is done without any problem (see the Install_output.txt attached for more information if needed).

To test the syrthes GUI, I type in the ex.linux-x86_64 directory (as described in Readme file) ./SyrtesMain. But I got the following error:
[root@hotcell exe.linux-x86_64]# ./SyrthesMain
Traceback (most recent call last):
File "bit_generator.pyx", line 40, in numpy.random.bit_generator
ModuleNotFoundError: No module named 'secrets'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib64/python3.6/site-packages/cx_Freeze/initscripts/__startup__.py", line 120, in run
module_init.run(name + "__main__")
File "/usr/local/lib64/python3.6/site-packages/cx_Freeze/initscripts/Console.py", line 16, in run
exec(code, module_main.__dict__)
File "SyrthesMain.py", line 29, in <module>
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "/opt/local/syrthes/syrthes5.0/src/syrthes-gui/src/install/calcView.py", line 21, in <module>
import numpy
File "/usr/local/lib64/python3.6/site-packages/numpy/__init__.py", line 151, in <module>
from . import random
File "/usr/local/lib64/python3.6/site-packages/numpy/random/__init__.py", line 179, in <module>
from . import _pickle
File "/usr/local/lib64/python3.6/site-packages/numpy/random/_pickle.py", line 1, in <module>
from .mtrand import RandomState
File "mtrand.pyx", line 1, in init numpy.random.mtrand
File "bit_generator.pyx", line 43, in init numpy.random.bit_generator
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "/usr/lib64/python3.6/random.py", line 46, in <module>
from hashlib import sha512 as _sha512
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "/usr/lib64/python3.6/hashlib.py", line 219, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "/usr/lib64/python3.6/hashlib.py", line 124, in __get_openssl_constructor
if not _hashlib.get_fips_mode():
AttributeError: module '_hashlib' has no attribute 'get_fips_mode'

It look that the "secrets" module is not found. But when I type pthon in the terminal and "import secrets", I have no error:

[root@hotcell exe.linux-x86_64]# python
Python 3.6.8 (default, Jun 23 2022, 19:01:59)
[GCC 8.5.0 20210514 (Red Hat 8.5.0-13)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import secrets
>>> secrets.token_hex(16)
'fd8b171488c1960560c4a7ad237e3d33'

Any idea what went wrong?

Best regards,
Kanssoune
Attachments
Install_output.txt
(453.51 KiB) Downloaded 162 times
README_build_GUI.txt
(1.73 KiB) Downloaded 162 times
Yvan Fournier
Posts: 4069
Joined: Mon Feb 20, 2012 3:25 pm

Re: Syrthesmpi error end Syrthes.gui With Python error

Post by Yvan Fournier »

Hello,

Not quite sure, but it still seems like an issue with different Python builds, or an incomplete "cxfreeze" build.

In our patch for Syrthes 4, we removed cxfreeze entirely:

in syrthes-gui/src/Install.sh, remove the last section (everythin after cxfreeze comment).

Then, in syrthes-install.py, try replacing the installGUI function with the following one (hoping this also works with Syrthes 5).

Code: Select all

   def installGUI(self):

        pre_built_gui = False
        pre_built_dir = ""

        if "x86_64" in os.uname()[4]: # <-> self.arch = "Linux_x86_64" or "Linux_IA64"
            pre_built_dir = "exe.linux-x86_64"
        elif "CYGWIN" in os.uname()[0]:
            pre_built_dir = "exe.WIN32"

        if pre_built_dir:
            try:
                shutil.copytree(self.installPath+'syrthes-gui/'+pre_built_dir, self.destPath+self.arch+'/lib/syrthes-GUI_exe')
                pre_built_gui = True
            except:
                print(" ")
                print("--> No precompiled GUI build "+self.installPath+"syrthes-gui/"+pre_built_dir)
                print(" ")


        if not pre_built_gui:
            print("--> building GUI ")
            print(" ")
            cur_dir = os.getcwd()
            print(self.installPath)
            gui_build_dir = self.installPath + 'syrthes-gui/src'
            os.chdir(gui_build_dir)
            os.system('./Install.sh')
            shutil.copytree(gui_build_dir + '/install',
                            self.destPath+self.arch+'/lib/syrthesGui')
            shutil.rmtree(gui_build_dir + '/install')
            os.chdir(cur_dir)

        # Create a shortcut to syrthes-GUI program
        os.chdir(self.destPath+self.arch+'/bin')
        f = open("syrthes.gui",'w')
        f.write('#/bin.sh\n')
        f.write('# GUI Launcher\n')
        if pre_built_gui:
            f.write(self.destPath+self.arch+'/lib/syrthes-GUI_exe/SyrthesMain $1 $2 $3 $4 $5')
        else:
            f.write('python3 ' + self.destPath+self.arch+'/lib/syrthesGui/SyrthesMain.py $1 $2 $3 $4 $5')
        f.close()
        os.system('chmod +x syrthes.gui')
Best regards,

Yvan
Kanssoune
Posts: 12
Joined: Tue Aug 02, 2022 8:05 am

Re: Syrthesmpi error end Syrthes.gui With Python error

Post by Kanssoune »

Hello Yvan,

Thanks a lot for your help.

It works!!!!

Thanks again and best regards,

Kanssoune
JRU
Posts: 1
Joined: Tue Feb 07, 2023 11:32 pm

Re: Syrthesmpi error end Syrthes.gui With Python error

Post by JRU »

Hello,

this is my first post and sorry for jumping in an old thread. I want to say that I also managed to build code saturne 7 on a Ubuntu Jammy with the patch Yvan gave on this post. Compiling opensource FEA on it are difiicult. I managed to build them with gcc-10, gfortan-10, but with no succsess using gcc-11 etc.
Thanks!

Jos
Post Reply