Hot questions for Using ZeroMQ in ipython

Question:

I'm trying to install cl-jupyter (A common-lisp kernel for Jupyter), and I can't make it work: when I open a new lisp notebook (or change the kernel of an existing notebook), it crashes after displaying the following messages:

[I 18:26:50.855 NotebookApp] Kernel started: ccba815a-9065-4fad-9d95-06f6291136d2
To load "cl-jupyter":
  Load 1 ASDF system:
    cl-jupyter
; Loading "cl-jupyter"
...............

cl-jupyter: an enhanced interactive Common Lisp REPL
(Version 0.7 - Jupyter protocol v.5.0)
--> (C) 2014-2015 Frederic Peschanski (cf. LICENSE)

kernel configuration = ((hb_port . 58864) (shell_port . 37462)
                        (transport . tcp) (iopub_port . 43232)
                        (signature_scheme . hmac-sha256)     (control_port . 52184)
                        (stdin_port . 45879)
                        (key . 2ae7d65f-65f9-40d8-bfd4-21760eaec0ca)
                        (ip . 127.0.0.1))
[Hearbeat] starting...
[Heartbeat] thread started
[Heartbeat] thread started
[Kernel] Entering mainloop ...
[Shell] loop started
Argh! corrupted error depth, halting
fatal error encountered in SBCL pid 24605(tid 140737353922304):
%PRIMITIVE HALT called; the party is over.
Some details:
  • Jupyter works fine with python (both 2x and 3x).
  • sbcl also seems to work fine (I'm just starting with common-lisp, so I might be missing something - but I can run code, and use asdf and quicklisp).
  • I installed it by running "python3 ./install-cl-jupyter.py".
  • My .sbclrc file now contains just "(load "~/quicklisp/setup.lisp")".
System Information:
  • OS: Linux 4.1.13-1-MANJARO x86_64 GNU/Linux
  • Python 3.5.0
  • SBCL 1.3.0
  • Jupyter version 4.0.6
Some things I've tried:

The file ~/.ipython/kernels/lisp/kernel.json contains:

{"argv": ["sbcl", "--non-interactive", "--load", "/home/myusername/lisp/systems/cl-jupyter/cl-jupyter.lisp", "/homemyusername/lisp/systems/cl-jupyter/src", "/home/myusername/lisp/systems/cl-jupyter", "{connection_file}"], "display_name": "SBCL Lisp", "language": "lisp"}

All the paths are correct. When I run the same code manually:

sbcl --non-interactive --load "/home/myusername/lisp/systems/cl-jupyter/cl-jupyter.lisp" "/homemyusername/lisp/systems/cl-jupyter/src" "/home/myusername/lisp/systems/cl-jupyter" kernel-07e04903-c562-4c67-bcc1-b68f4047d8d2.json

(where "kernel-07e04903-c562-4c67-bcc1-b68f4047d8d2.json" is an auto-generated file for a lisp-kernel that I saved), it "looks ok" (e.g. it runs, and waits with no errors).

I tried to do some quick debug-printing, and my best guess is that it crashes in src/shell.lisp, in the line

 (vbinds (identities sig msg buffers)  (message-recv (shell-socket shell))

But again, I could be wrong. Since it kinda looks like it has something to do with communication, I made sure that zeromq is updated.

I'm not sure what's next besides learning some more lisp, and then come back to properly debug the code - but I was hoping to learn it using Jupyter :)

I'd appreciate any suggestions, Thanks.


Answer:

This issue is caused by a change in the size of the message structure, zmq_msg_t, in 0MQ version 4.1.x to 64 bytes from a size of 32 bytes in version 4.0.x.

The 0MQ interface library used by cl-jupyter is pzmq, and that library is stated to support 0MQ up to version 4.0. At the time of this writing, pzmq uses a 0MQ message size of 32 bytes. This leads to internal errors if 0MQ version 4.1.x is installed.

There are two solutions here:

  1. Downgrade the 0MQ installation to version 4.0.x
  2. Fix the pzmq library by updating the definition of msg% in c-api.lisp from 32 to 64 bytes.

Update - 9 May 2016

The pzmq library was updated to support 0MQ version 4.1.x, (preserving compatibility with older versions). The new version of pzmq is planned for release as part of the May 2016 Quicklisp release.

Update - 1 June 2016

The May 2016 Quicklisp release includes updates to the pzmq library which resolve this issue. A downgrade of 0MQ or modifications to the pzmq library are no longer necessary.

Question:

I'm wondring which protocol Apache Zeppelin is using to connect to Apache Spark?

Is it also the iPython Protocol on ZeroMQ?

Thanks a lot!

best regards

Romeo


Answer:

Spark Interpreter for Apache Zeppelin (incubating) actually uses neither of them.

It just hosts Spark Driver inside spark interpreter process and submits a job per paragraph though SparkIMain, in the same way as spark-shell does.

I believe an internal low-level communication between Driver and Master is based on Akka but is a Spark-specific implementation detail.

Question:

I am trying to use the ipyparallel library to run an ipcontroller and ipengine on different machines.

My setup is as follows:

Remote machine: Windows Server 2012 R2 x64, running an ipcontroller, listening on port 5900 and ip=0.0.0.0.

Local machine: Windows 10 x64, running an ipengine, listening on the remote machine's ip and port 5900.

Controller start command: ipcontroller --ip=0.0.0.0 --port=5900 --reuse --log-to-file=True

Engine start command: ipengine --file=/c/Users/User/ipcontroller-engine.json --timeout=10 --log-to-file=True

I've changed the interface field in ipcontroller-engine.json from "tcp://127.0.0.1" to "tcp://" for ipengine.

On startup, here is a snapshot of the ipcontroller log:

2016-10-10 01:14:00.651 [IPControllerApp] Hub listening on tcp://0.0.0.0:5900 for registration. 2016-10-10 01:14:00.677 [IPControllerApp] Hub using DB backend: 'DictDB' 2016-10-10 01:14:00.956 [IPControllerApp] hub::created hub 2016-10-10 01:14:00.957 [IPControllerApp] task::using Python leastload Task scheduler 2016-10-10 01:14:00.959 [IPControllerApp] Heartmonitor started 2016-10-10 01:14:00.967 [IPControllerApp] Creating pid file: C:\Users\Administrator\.ipython\profile_default\pid\ipcontroller.pid 2016-10-10 01:14:02.102 [IPControllerApp] client::client b'\x00\x80\x00\x00)' requested 'connection_request' 2016-10-10 01:14:02.102 [IPControllerApp] client::client [b'\x00\x80\x00\x00)'] connected 2016-10-10 01:14:47.895 [IPControllerApp] client::client b'82f5efed-52eb-46f2-8c92-e713aee8a363' requested 'registration_request' 2016-10-10 01:15:05.437 [IPControllerApp] client::client b'efe6919d-98ac-4544-a6b8-9d748f28697d' requested 'registration_request' 2016-10-10 01:15:17.899 [IPControllerApp] registration::purging stalled registration: 1

And the ipengine log:

2016-10-10 13:44:21.037 [IPEngineApp] Registering with controller at tcp://172.17.3.14:5900 2016-10-10 13:44:21.508 [IPEngineApp] Starting to monitor the heartbeat signal from the hub every 3010 ms. 2016-10-10 13:44:21.522 [IPEngineApp] Completed registration with id 1 2016-10-10 13:44:27.529 [IPEngineApp] WARNING | No heartbeat in the last 3010 ms (1 time(s) in a row). 2016-10-10 13:44:30.539 [IPEngineApp] WARNING | No heartbeat in the last 3010 ms (2 time(s) in a row). ... 2016-10-10 13:46:52.009 [IPEngineApp] WARNING | No heartbeat in the last 3010 ms (49 time(s) in a row). 2016-10-10 13:46:55.028 [IPEngineApp] WARNING | No heartbeat in the last 3010 ms (50 time(s) in a row). 2016-10-10 13:46:55.028 [IPEngineApp] CRITICAL | Maximum number of heartbeats misses reached (50 times 3010 ms), shutting down.

(There is a 12.5 hour time difference between the local machine and the remote VM)

Any idea why this may happen?


Answer:

If you are using --reuse, make sure to remove the files if you change settings. It's possible that it doesn't behave well when --reuse is given and you change things like --ip, as the connection file may be overriding your command-line arguments.

When setting --ip=0.0.0.0, it may be useful to also set --location=a.b.c.d where a.b.c.d is an ip address of the controller that you know is accessible to the engines. Changing the

If registration works and subsequent connections don't, this may be due to a firewall only opening one port, e.g. 5900. The machine running the controller needs to have all the ports listed in the connection file open. You can specify these to be a port-range by manually entering port numbers in the connection files.

Question:

I am trying to use pymatbridge. I am using python 2.7.9 64 bits on Windows and Canopy 1.5.5 and when I put the following code in ipython notebook

from pymatbridge import Matlab
mlab = Matlab(executable='matlab')
mlab.start()

I receive this error:


ZMQError Traceback (most recent call last) in ()

1 from pymatbridge import Matlab

2 mlab = Matlab(executable='matlab')

----> 3 mlab.start()

C:\Users\Administrateur\AppData\Local\Enthought\Canopy\User\lib\site-packages\pymatbridge\pymatbridge.pyc in start(self) 205 port = self.socket.bind_to_random_port(self.socket_addr) 206 self.socket_addr = self.socket_addr + ":%s"%port --> 207 self.socket.unbind(self.socket_addr) 208 209 # Start the MATLAB server in a new process

C:\Users\Utilisateur\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.5.3123.win-x86_64\lib\site-packages\zmq\backend\cython\socket.pyd in zmq.backend.cython.socket.Socket.unbind (zmq\backend\cython\socket.c:5247)()

ZMQError: No such file or directory

I've tried pip install pyzmq. What am I doing wrong?


Answer:

Under executable you should not call matlab but add the path to the location of your MATLAB executable. In my case (using OSX) it is: '/Applications/MATLAB_R2014b.app/bin/matlab'.

I found this by typing matlabroot in the MATLAB Command Window (returns /Applications/MATLAB_R2014b.app) and adding /bin/matlab.

In some cases just mlab = Matlab() works, see my earlier error running pymatbridge on a cluster and the pymatbridge github page.