Libexpat.so incompatibility between Nipype and Matlab MCR

Hi there,

I am trying to run SPM standalone (which uses Matlab MCR v7.1.3) as a Nipype interface. So far I have followed this approach for doing so, however I get an error when trying to import Nipype in my script:

Traceback (most recent call last):
  File "./spm_run.py", line 2, in <module>
    import nipype.interfaces.spm as spm
...
  File "/opt/packages/python/2.7.14/lib/python2.7/xml/parsers/expat.py", line 4, in <module>
    from pyexpat import *
ImportError: /home/jhuguet/jhuguet_venv/lib/python2.7/lib-dynload/pyexpat.so: undefined symbol: XML_SetHashSalt
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/opt/packages/python/2.7.14/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/home/jhuguet/jhuguet_venv/lib/python2.7/site-packages/nipype/utils/config.py", line 363, in free_display
    from .. import config
SystemError: Parent module 'nipype' not loaded, cannot perform relative import

Checking pyexpat.so library dependencies for conflicts, I found that the issue seems to basically be in libexpat.so. Matlab MCR comes with an older version of the library (v1.5.0) that apparently is not compatible with Nipype. Newer versions of Matlab MCR also come bundled with the very same specific libexpat library version.

My question is, anyone has faced that issue before and/or knows an elegant way to solve it?

Many thanks,
Jordi