Author Topic: [SOLVED] Kratos import error  (Read 1959 times)

Nelson

  • Newbie
  • *
  • Posts: 1
[SOLVED] Kratos import error
« on: March 03, 2016, 07:37:47 PM »
Hi guys,

I have compiled KRATOS using intel compiler and python 3.4 in Ubuntu 14.04 system.
Compilation was successfully done however i have this mistake when i run the example:

Traceback (most recent call last):
  File "cantilever2dstatic.py", line 37, in <module>
    from KratosMultiphysics import *
  File "/home/nelson/Kratos_Oficial/KratosMultiphysics/__init__.py", line 13, in <module>
    from Kratos import *
ImportError: dynamic module does not define init function (initKratos)

In my ./basrc i type the following things

export PYTHONPATH=/home/nelson/Kratos_Oficial/libs:$PYTHONPATH
export PYTHONPATH=/home/nelson/Kratos_Oficial:$PYTHONPATH
export PATH=/home/nelson/Kratos_Oficial:$PATH

I am wondering where is my mistake.

Regards

Nelson
 
 
« Last Edit: August 16, 2016, 12:01:32 AM by Miguel Angel Celigueta »

Miguel Angel Celigueta

  • Administrator
  • Newbie
  • *****
  • Posts: 38
Re: Kratos import error
« Reply #1 on: March 03, 2016, 07:49:23 PM »
Maybe you forgot to set LD_LIBRARY_PATH. Take a look at: http://kratos-wiki.cimne.upc.edu/index.php/LinuxInstall#Setting_up_your_enviroment

riccardo

  • Global Moderator
  • Newbie
  • *****
  • Posts: 47
Re: Kratos import error
« Reply #2 on: March 03, 2016, 08:28:19 PM »
Hi Nelson

this is the typical error you get by mixing somehow python2 and python3

just to be sure ... are u running your  example as:

python3 scriptname.py ?
(notice the 3)

cheers
Riccardo

Miguel Angel Celigueta

  • Administrator
  • Newbie
  • *****
  • Posts: 38
Re: Kratos import error
« Reply #3 on: March 09, 2016, 09:52:59 AM »
Nelson,
could you run Kratos finally? Did you check the solutions proposed in this thread? If not, send more details about what you tried, your Python version(s) and copy/paste the output from terminal when you try to run...
Greetings,
Miguel Angel

Alex Jarauta

  • Newbie
  • *
  • Posts: 2
Re: Kratos import error
« Reply #4 on: July 28, 2016, 07:35:18 PM »
 Hi all,

I recently downloaded the latest version of Kratos and I managed to successfully compile it using boost 1.61 (compiled with python 2.7) on openSUSE 13.1. However, when I try to run a python script, I obtain the following error:

"ImportError: No module named KratosMultiphysics"

I am wondering what could be the problem.

Thanks!

Alex

Miguel Angel Celigueta

  • Administrator
  • Newbie
  • *****
  • Posts: 38
Re: Kratos import error
« Reply #5 on: July 29, 2016, 02:53:17 AM »
Hi Alex,
Did you set correctly the value for the variables PYTHONPATH and LD_LIBRARY_PATH in the file .bashrc ?
Regards,
MA

Alex Jarauta

  • Newbie
  • *
  • Posts: 2
Re: Kratos import error
« Reply #6 on: August 04, 2016, 11:56:55 PM »
Hi Miguel Angel,

yes, that was it! Apparently, OpenSUSE wrote something else rather than "export PYTHONPATH=/path/to/my/kratos/installation:$PYTHONPATH".

Thank you!!

Regards

Miguel Angel Celigueta

  • Administrator
  • Newbie
  • *****
  • Posts: 38
Re: Kratos import error
« Reply #7 on: August 16, 2016, 12:01:06 AM »
I just had the same error as Nelson on a cluster. It was solved following Riccardo's advice. Kratos was compiled with Python 3, so in the terminal python3 must be called instead of python.

So in the case that we get import errors, they can be solved by:

a) calling python3 instead of python
b) making sure that the environment is correctly set (LD_LIBRARY_PATH, PYTHONPATH)