code-saturne / code_saturne

code_saturne public mirror
https://www.code-saturne.org
GNU General Public License v2.0
215 stars 80 forks source link

Cannot compile master - error from Python script #88

Closed paspro closed 1 year ago

paspro commented 2 years ago

When trying to compile master I get the following error:

Traceback (most recent call last):
  File "/home/panos/Development/Code_Saturne/CS_master/build/src/apps/../../../build-aux/cs_compile_build.py", line 375, in <module>
    pkg = package(config_file=config_file, install_mode=True)
  File "/home/panos/Development/Code_Saturne/CS_master/bin/cs_package.py", line 72, in __init__
    self.config = cs_config.config(config_dict)
TypeError: __init__() takes 1 positional argument but 2 were given

The currently released version does not produce such an error. Any clues?

YvanFournier commented 2 years ago

Hello,

Did you start from a clean/empty build directory ?

The cs_package.py and cs_config.py file have changed : they is now no longer generated from templates, but fixed, and read the configuration in a code_saturne_build.cfg file. Du to the workings of the build system, it seems it is required to do a clean rebuild when updating.

paspro commented 2 years ago

I did start with a clean build directory. I managed to avoid this problem by modifying the top part of file bin/cs_package.py as

import cs_config

#try:
#    from code_saturne import cs_config
#except Exception:
#    import cs_config

This makes the script to work properly.

paspro commented 2 years ago

I found out that when installing code_saturne to a specific directory after the compilation is completed, the Python scripts are installed in my local Python site-packages directory and not inside the directory where code_saturne is installed. As a result, when building more than one versions of code_saturne the Python site-packages/code_saturne directory is overwritten breaking the previous versions.

In order to avoid this issue I have to use the --with-python_prefix option to set the correct directory e.g.

                "--prefix=/home/panos/Applications/Code_Saturne/code_saturne-7",
                "--with-python_prefix=/home/panos/Applications/Code_Saturne/code_saturne-7"

This is an issue for both CS 7 and the master. With this additional option there is no need to modify the cs_package.py file. I think that the Python prefix should by default be set to be the same as the installation prefix.

YvanFournier commented 2 years ago

The modification to cs_package.py is risky, as it may improve things for the build stage (though I don't understand why, as it simply calls the "Except" clause in all caes, but once code_saturne is installed, the Python path should relate to "site-packages", and so require the from code_saturne import cs_config version.

What system are you running on ? I might try to reproduce this on a VM if I have a similar setup available.

As to your second issue, is it related to an autoconf or automake update on your system ? I have had the same issue with automake 1.16.4 (https://lists.gnu.org/archive/html/automake/2021-08/msg00006.html), and this even affects older versions of the code. This is an external issue, and the only thing I can do is update the installation documentation.

YvanFournier commented 1 year ago

I guess we can close this for now, and reopen if the issue resurfaces.