Skip to content

matlab.engine throwing error message in jupyter notebook but not in terminal #2325

Open
@alexanderwhatley

Description

@alexanderwhatley

Platform: Ubuntu 16.10

I am trying to use the matlab-python interface in the jupyter notebook (https://www.mathworks.com/help/matlab/matlab-engine-for-python.html). The interface works fine in the terminal, but not in the notebook. It seems like the notebook does not have the same access to C++ compilers that the command line python does. See here where someone else also had this problem: http://stackoverflow.com/questions/36076395/import-of-matlab-engine-works-in-ipython-but-not-in-jupyter
The solution that they had, which was to set LD_LIBRARY_PATH, did not work for me.

When I try to run import matlab.engine in the notebook, I get the following error message, which indicates that it was unable to find the necessary C++ compiler:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
/home/alexander/anaconda3/lib/python3.5/site-packages/matlab/engine/__init__.py in <module>()
     41 try:
---> 42     pythonengine = importlib.import_module("matlabengineforpython"+_PYTHONVERSION)
     43 except:

/home/alexander/anaconda3/lib/python3.5/importlib/__init__.py in import_module(name, package)
    125             level += 1
--> 126     return _bootstrap._gcd_import(name[level:], package, level)
    127 

/home/alexander/anaconda3/lib/python3.5/importlib/_bootstrap.py in _gcd_import(name, package, level)

/home/alexander/anaconda3/lib/python3.5/importlib/_bootstrap.py in _find_and_load(name, import_)

/home/alexander/anaconda3/lib/python3.5/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)

/home/alexander/anaconda3/lib/python3.5/importlib/_bootstrap.py in _load_unlocked(spec)

/home/alexander/anaconda3/lib/python3.5/importlib/_bootstrap.py in module_from_spec(spec)

/home/alexander/anaconda3/lib/python3.5/importlib/_bootstrap_external.py in create_module(self, spec)

/home/alexander/anaconda3/lib/python3.5/importlib/_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)

ImportError: /home/alexander/anaconda3/lib/python3.5/site-packages/zmq/backend/cython/../../../../.././libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/local/MATLAB/R2017a/extern/engines/python/dist/matlab/engine/glnxa64/../../../../../../../bin/glnxa64/libmx.so)

During handling of the above exception, another exception occurred:

ImportError                               Traceback (most recent call last)
/home/alexander/anaconda3/lib/python3.5/site-packages/matlab/engine/__init__.py in <module>()
     57                 os.environ[_envs[_arch]] = _bin_dir
---> 58         pythonengine = importlib.import_module("matlabengineforpython"+_PYTHONVERSION)
     59     except Exception as e:

/home/alexander/anaconda3/lib/python3.5/importlib/__init__.py in import_module(name, package)
    125             level += 1
--> 126     return _bootstrap._gcd_import(name[level:], package, level)
    127 

/home/alexander/anaconda3/lib/python3.5/importlib/_bootstrap.py in _gcd_import(name, package, level)

/home/alexander/anaconda3/lib/python3.5/importlib/_bootstrap.py in _find_and_load(name, import_)

/home/alexander/anaconda3/lib/python3.5/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)

/home/alexander/anaconda3/lib/python3.5/importlib/_bootstrap.py in _load_unlocked(spec)

/home/alexander/anaconda3/lib/python3.5/importlib/_bootstrap.py in module_from_spec(spec)

/home/alexander/anaconda3/lib/python3.5/importlib/_bootstrap_external.py in create_module(self, spec)

/home/alexander/anaconda3/lib/python3.5/importlib/_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)

ImportError: /home/alexander/anaconda3/lib/python3.5/site-packages/zmq/backend/cython/../../../../.././libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/local/MATLAB/R2017a/extern/engines/python/dist/matlab/engine/glnxa64/../../../../../../../bin/glnxa64/libmx.so)

During handling of the above exception, another exception occurred:

OSError                                   Traceback (most recent call last)
<ipython-input-2-7ec811bb5400> in <module>()
----> 1 import matlab.engine

/home/alexander/anaconda3/lib/python3.5/site-packages/matlab/engine/__init__.py in <module>()
     59     except Exception as e:
     60         raise EnvironmentError('Please reinstall MATLAB Engine for Python or contact '
---> 61                                'MathWorks Technical Support for assistance: %s' % e)
     62 
     63 

OSError: Please reinstall MATLAB Engine for Python or contact MathWorks Technical Support for assistance: /home/alexander/anaconda3/lib/python3.5/site-packages/zmq/backend/cython/../../../../.././libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/local/MATLAB/R2017a/extern/engines/python/dist/matlab/engine/glnxa64/../../../../../../../bin/glnxa64/libmx.so)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions