Why do I receive an error about "undefined symbol: PyUnicodeUCS4_DecodeUTF16" when importing MATLAB engine module in Python 2.7 on Linux?
3 views (last 30 days)
Show older comments
MathWorks Support Team
on 26 Oct 2018
Edited: MathWorks Support Team
on 10 Nov 2025 at 11:51
I can input "import matlab" successfully, but when I input "import matlab.engine", the terminal will print "
ERROR: Traceback (most recent call last): File "<stdin>", line 1, in module File "/home/usr/Documents/Python/matlab_engines_install/lib/python2.7/site-packages/matlab/engine/__init__.py", line 62, in module 'MathWorks Technical Support for assistance: %s' % e) EnvironmentError: Please reinstall MATLAB Engine for Python or contact MathWorks Technical Support for assistance: /cad/adi/apps/mathworks/matlab/2017b/extern/engines/python/dist/matlab/engine/glnxa64/matlabengineforpython2_7.so: undefined symbol: PyUnicodeUCS4_DecodeUTF16".
The version of matlab & python is matlab 2017b and Python 2.7.9, both are 64 bit, but sys.maxunicode is narrow.
Accepted Answer
MathWorks Support Team
on 10 Nov 2025 at 0:00
Edited: MathWorks Support Team
on 10 Nov 2025 at 11:51
The build of this Python distribution uses narrow Unicode while Python Engine is built to support wide Unicode:
"To enable wide-unicode support for Python 2.7 on Linux, configure the build with the --enable-unicode=ucs4 option."
0 Comments
More Answers (0)
See Also
Categories
Find more on Call MATLAB from Python in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!