We use matlab's python engine to interface with matlab code from python. There seems to be some conflict with the used libexpact.so library.
A minimal buggy example would be:
#!/usr/bin/env python
from xml.dom import minidom
import matlab.engine
a = minidom.parse("solution_example.xml")
print(a)
This produces the output:
File "./minimal.py", line 9, in <module>
a = minidom.parse("solution_example.xml") File "/usr/lib/python2.7/xml/dom/minidom.py", line 1917, in parse
from xml.dom import expatbuilder File "/usr/lib/python2.7/xml/dom/expatbuilder.py", line 32, in <module>
from xml.parsers import expat File "/usr/lib/python2.7/xml/parsers/expat.py", line 4, in <module>
from pyexpat import * ImportError: /usr/lib/python2.7/lib-dynload/pyexpat.x86_64-linux-gnu.so: undefined symbol: XML_SetHashSalt
However, the program runs fine when the line import matlab.engine
is omitted.
Any ideas what the problem could be or how we could debug the python import procedure?
Thanks in advance!
setenv('LD_LIBRARY_PATH', '')
and then calling your python code from MATLAB. – Thomas Ibbotson