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

Checking library dependencies for conflicts, I found that the issue seems to basically be in 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,