This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Error Calling The Fenics from Matlab

–8 votes

I need to call the script that I have in python in matlab. the script work by it self but when call it from matlab 2012a by ! python Smolyak.py
but I receive this Error. so the problem is with from dolfin import * line
Traceback (most recent call last):
File "Smolyak.py", line 2, in
from dolfin import *
File "/usr/lib/python2.7/dist-packages/dolfin/init.py", line 16, in
import cpp
File "/usr/lib/python2.7/dist-packages/dolfin/cpp/init.py", line 40, in
exec("import %s" % module_name)
File "", line 1, in
File "/usr/lib/python2.7/dist-packages/dolfin/cpp/common.py", line 30, in
_common = swig_import_helper()
File "/usr/lib/python2.7/dist-packages/dolfin/cpp/common.py", line 26, in swig_import_helper
_mod = imp.load_module('_common', fp, pathname, description)
ImportError: /usr/lib/libQVTK.so.5.8: undefined symbol: _ZN12QApplication10commitDataER15QSessionManager

I searched the internet and I couldn't find any solution. I am using linux Ubuntu 64 .
Thanks.

asked Jun 12, 2013 by Bahram FEniCS Novice (400 points)

Consult rather MATLAB-related resources for problems executing python scripts within MATLAB.

Does import dolfin in a plain python shell work?

yes it does work in a plain python shell.

It has a problem with VTK library. Maybe LD_LIBRARY_PATH in MATLAB environment points to another VTK than is working one which you compiled DOLFIN against.

I already checked that.
locate libQVTK.so.5.8
give me these two path:
/usr/lib/libQVTK.so.5.8
/usr/lib/libQVTK.so.5.8.0
then with I tried to fix the problem
sudo ln -sf /usr/lib/libQVTK.so.5.8 /usr/lib/libQVTK.so.5.8.0
but i receive the message ("ln: /usr/lib/libQVTK.so.5.8' and/usr/lib/libQVTK.so.5.8.0'") are the same file.

That's OK, 5.8 is symbolic link to 5.8.0. Did you reinstall VTK library without recompiling DOLFIN?

i have some problem now, did you guys have already find any solutions?

1 Answer

0 votes

I run into the same problem. A workaround is to clear LD_LIBRARY_PATH before calling Python:
system('bash -c "export LD_LIBRARY_PATH=; python whatever.py"');

answered Apr 25, 2014 by lsoksane FEniCS Novice (140 points)
...