Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Every time I try to connect the kernel it dies #95

Open
v-iashin opened this issue Apr 3, 2017 · 10 comments
Open

Every time I try to connect the kernel it dies #95

v-iashin opened this issue Apr 3, 2017 · 10 comments

Comments

@v-iashin
Copy link

v-iashin commented Apr 3, 2017

It constantly dies without starting whatsoever.

I installed the package as follows:
$sudo pip3 install matlab-kernel
$python3 -m matlab_kernel install
$jupyter notebook
Then I selected Matlab kernel in the 'New' button. However it fails to connect to the kernel.

Output from Notebook console:
[I 11:55:33.064 NotebookApp] KernelRestarter: restarting kernel (1/5) Traceback (most recent call last): File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main "__main__", mod_spec) File "/usr/lib/python3.5/runpy.py", line 85, in _run_code exec(code, run_globals) File "/usr/local/lib/python3.5/dist-packages/matlab_kernel/__main__.py", line 3, in <module> MatlabKernel.run_as_main() File "/usr/local/lib/python3.5/dist-packages/metakernel/_metakernel.py", line 115, in run_as_main MetaKernelApp.launch_instance(kernel_class=cls) File "/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py", line 657, in launch_instance app.initialize(argv) File "<decorator-gen-120>", line 2, in initialize File "/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py", line 87, in catch_config_error return method(app, *args, **kwargs) File "/usr/local/lib/python3.5/dist-packages/ipykernel/kernelapp.py", line 454, in initialize self.init_kernel() File "/usr/local/lib/python3.5/dist-packages/ipykernel/kernelapp.py", line 365, in init_kernel user_ns=self.user_ns, File "/usr/local/lib/python3.5/dist-packages/traitlets/config/configurable.py", line 412, in instance inst = cls(*args, **kwargs) File "/usr/local/lib/python3.5/dist-packages/matlab_kernel/kernel.py", line 65, in __init__ """)
ImportError: Matlab engine not installed: See https://www.mathworks.com/help/matlab/matlab-engine-for-python.htm

@v-iashin v-iashin changed the title Every time I try to connect kernel it dies Every time I try to connect the kernel it dies Apr 3, 2017
@blink1073
Copy link
Contributor

Hi @vdyashin, it looks like the matlab engine itself is not properly installed, which is required by the kernel. https://www.mathworks.com/help/matlab/matlab-engine-for-python.html.

@v-iashin
Copy link
Author

v-iashin commented Apr 3, 2017

@blink1073 okay. It seems I have not noticed the links in the README.md

@v-iashin
Copy link
Author

v-iashin commented Apr 3, 2017

I followed instructions on the MATLAB website and now I get the following:
`
[I 16:12:41.293 NotebookApp] KernelRestarter: restarting kernel (4/5)
WARNING:root:kernel 577951c0-2184-47e6-9a68-71a52bd385ec restarted
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/matlab/engine/init.py", line 42, in
pythonengine = importlib.import_module("matlabengineforpython"+_PYTHONVERSION)
File "/usr/lib/python3.5/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 986, in _gcd_import
File "", line 969, in _find_and_load
File "", line 956, in _find_and_load_unlocked
ImportError: No module named 'matlabengineforpython3_5'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/matlab/engine/init.py", line 58, in
pythonengine = importlib.import_module("matlabengineforpython"+_PYTHONVERSION)
File "/usr/lib/python3.5/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 986, in _gcd_import
File "", line 969, in _find_and_load
File "", line 958, in _find_and_load_unlocked
File "", line 666, in _load_unlocked
File "", line 577, in module_from_spec
File "", line 906, in create_module
File "", line 222, in _call_with_frames_removed
ImportError: /usr/local/MATLAB/R2016b/extern/engines/python/dist/matlab/engine/glnxa64/../../../../../../../bin/glnxa64/libssl.so.1.0.0: undefined symbol: EVP_idea_cbc

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
"main", mod_spec)
File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.5/dist-packages/matlab_kernel/main.py", line 2, in
from .kernel import MatlabKernel
File "/usr/local/lib/python3.5/dist-packages/matlab_kernel/kernel.py", line 24, in
import matlab.engine
File "/usr/local/lib/python3.5/dist-packages/matlab/engine/init.py", line 61, in
'MathWorks Technical Support for assistance: %s' % e)
OSError: Please reinstall MATLAB Engine for Python or contact MathWorks Technical Support for assistance: /usr/local/MATLAB/R2016b/extern/engines/python/dist/matlab/engine/glnxa64/../../../../../../../bin/glnxa64/libssl.so.1.0.0: undefined symbol: EVP_idea_cbc
[W 16:12:44.307 NotebookApp] KernelRestarter: restart failed
[W 16:12:44.307 NotebookApp] Kernel 577951c0-2184-47e6-9a68-71a52bd385ec died, removing from map.
ERROR:root:kernel 577951c0-2184-47e6-9a68-71a52bd385ec restarted failed!
[W 16:12:44.351 NotebookApp] Kernel deleted before session
[W 16:12:44.352 NotebookApp] 410 DELETE /api/sessions/10b592e1-9ad4-4b81-a6be-9e72dfaf4157 (127.0.0.1) 4.75ms referer=http://localhost:8892/notebooks/Untitled3.ipynb?kernel_name=matlab

`
any ideas?

@blink1073
Copy link
Contributor

No, sorry, I don't have a Matlab license. You'd have to ask MathWorks technical support (I'm not affiliated with them).

@DMRobertson
Copy link

I'm having a very similar error: namely libssl.so.1.0.0: undefined symbol: EVP_idea_cbc. There seems to be something similar happening at this link; perhaps MATLAB is loading a library from its own directories rather than a system library?

It's also worth mentioning that I don't get this error if I import matlab.engine directly in the interpreter.

@DMRobertson
Copy link

To follow up, having done some more experimentation: if I run

import matlab.engine
from matlab_kernel.kernel import MatlabKernel
MatlabKernel.run_as_main()

then the kernel starts correctly, without any errors.

Something on my system doesn't seem to be happy with tempfile.

>>> import tempfile
>>> import matlab.engine
Traceback (most recent call last):
...
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
...
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/data/b0036119/home/software/jupyter-playground/lib/python3.4/site-packages/matlab/engine/__init__.py", line 69, in <module>
    'MathWorks Technical Support for assistance: %s' % e)
OSError: Please reinstall MATLAB Engine for Python or contact MathWorks Technical Support for assistance: /usr/local/apps/matlab/R2016a/extern/engines/python/dist/matlab/engine/glnxa64/../../../../../../../bin/glnxa64/libssl.so.1.0.0: undefined symbol: EVP_idea_cbc

Could tempfile be using some ssl functions perhaps?

@blink1073
Copy link
Contributor

It could very well be that tempfile is bringing along a different ssl. Does the kernel work if you move the tempfile import to after the matlab engine import?

@DMRobertson
Copy link

It seems to! I tried to import the engine as soon as possible by replacing __main__.py with

if __name__ == "__main__":
    import matlab.engine
    from .kernel import MatlabKernel
    MatlabKernel.run_as_main()

(the only addition is line 2; everything else is as in the repo).
With that change, python -m matlab_kernel seems to start the kernel fine.

@blink1073
Copy link
Contributor

I released 0.14.3 with an import reorder, does that release do the trick?

@expectopatronum
Copy link

I had an issue where the kernel didn't start because of Kaspersky blocking it. I don't recall the error messages though. For eliminating this possiblity, can you answer the following questions:

  1. are there any virus scanners/firewalls active?
  2. can you create a "normal" jupyter notebook (e.g. with python)?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants