Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in test_KratosCore if FluidDynamicsApplication is not compiled #2848

Closed
armingeiser opened this issue Sep 11, 2018 · 12 comments
Closed
Assignees

Comments

@armingeiser
Copy link
Member

I just noticed that there happens an error in the block of skipping the "test_materials_input.py" if the FluidDynamicsApplication is not compiled.

Running tests for KratosCore
/media/arming/Volume/04_Development/Kratos/kratos/tests/test_KratosCore.py
Traceback (most recent call last):
  File "/media/arming/Volume/04_Development/Kratos/kratos/tests/test_materials_input.py", line 7, in <module>
    import KratosMultiphysics.FluidDynamicsApplication as KratosFluid
  File "/media/arming/Volume/04_Development/Kratos/KratosMultiphysics/FluidDynamicsApplication.py", line 2, in <module>
    from KratosFluidDynamicsApplication import *
ModuleNotFoundError: No module named 'KratosFluidDynamicsApplication'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/media/arming/Volume/04_Development/Kratos/kratos/tests/test_KratosCore.py", line 13, in <module>
    import test_materials_input
  File "/media/arming/Volume/04_Development/Kratos/kratos/tests/test_materials_input.py", line 16, in <module>
    '{0}'.format(e)).group(1)
AttributeError: 'NoneType' object has no attribute 'group'
@armingeiser armingeiser changed the title Error in test_KratosCore if FluidApplication is not compiled Error in test_KratosCore if FluidDynamicsApplication is not compiled Sep 11, 2018
@armingeiser
Copy link
Member Author

The error happens if the FluidDynamicsApplication.py is available, but the pybind module KratosFluidDynamicsApplication is not. then a ModuleNotFoundError is thrown, and the extraction of the application name from the exception does not work:

    missing_application = re.search(r'''.*'KratosMultiphysics\.(.*)'.*''',
                                    '{0}'.format(e)).group(1)

@jcotela
Copy link
Member

jcotela commented Sep 12, 2018

Just in case someone else encounters this issue: This error is due to old files remaining in the KratosMultiphysics folder from a past compilation of the FluidDynamicsApplication (FluidDynamicsApplication.py in this case). The easiest fix is to modify your configure.sh to delete the folder KratosMultiphysics before a new compilation, just as we are doing now for libs.

@KratosMultiphysics/technical-committee should we update the example configures (and tutorials) to reflect this?

@roigcarlo
Copy link
Member

+1 to indicate that this may happen, but I think the behavior is correct. In fact it is the same problem than when we try to load outdated .so.

Maybe we can extend that RE so it captures this sort of problems. I was not aware of this mechanism, but as it seems that there are several files using it maybe we can even put it as part of the test utils.

@jcotela
Copy link
Member

jcotela commented Sep 12, 2018

Extending the RE would fix it for this test, but similar statements appear in other parts of the code. In fact, this RE is part of the recommended best practice for skipping tests in the wiki.

If we want to go in this direction, maybe we should provide a method to manage import errors somewhere in the core (or probably in the test suite).

@armingeiser
Copy link
Member Author

The hint of @jcotela solved the issue for me. I'll leave it to you to close it as you maybe consider this in the future.

@philbucher
Copy link
Member

@jcotela where is the code that deletes the libs folder while compiling?
I occasionally also struggle with this

@jcotela
Copy link
Member

jcotela commented Oct 5, 2018

It is not there officially, but most of us have added to our configure.sh at some point...

@philbucher
Copy link
Member

Could you please share how you do it?
I am not an expert in this

@jcotela
Copy link
Member

jcotela commented Oct 5, 2018

Well, in my configure I have

rm -f /home/jcotela/Kratos/libs/*
rm -r /home/jcotela/Kratos/KratosMultiphysics/*

rm CMakeCache.txt

cmake ..  
# cmake options....

(adjust for your local paths etc.) This removes installed files from a previous compilation, which cmake places in the libs (C++) and KratosMultiphysics (Python) folders during make install. It helps when switching between different compilation types, especially if you are not building the same set of applications in all of them.

@philbucher
Copy link
Member

thanks @jcotela

@pooyan-dadvand
Copy link
Member

It would be better to use CMake to cleanup these folders

@jcotela
Copy link
Member

jcotela commented Feb 20, 2019

Closing, for now we recommend deleting the installed files (KratosMultiphysics and libs folders) before calling cmake in the configure script if necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants