albertz / background-zmq-ipython

Background ZMQ IPython/Jupyter kernel
BSD 2-Clause "Simplified" License
17 stars 4 forks source link

zmq.error.ZMQError: Address already in use #1

Closed albertz closed 5 years ago

albertz commented 5 years ago

(This is a report I got from a user.)

To connect another client to this IPython kernel, use: jupyter console --existing kernel-1508.json
IPython: Start kernel now. pid: 1508, thread: <Thread(IPython kernel, started daemon 123145421287424)>
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/Users/chris/.local/share/virtualenvs/embed_ipython_in_sep_thread-cp19ARWU/lib/python3.7/site-packages/ipykernel/heartbeat.py", line 91, in run
    self._bind_socket()
  File "/Users/chris/.local/share/virtualenvs/embed_ipython_in_sep_thread-cp19ARWU/lib/python3.7/site-packages/ipykernel/heartbeat.py", line 74, in _bind_socket
    self._try_bind_socket()
  File "/Users/chris/.local/share/virtualenvs/embed_ipython_in_sep_thread-cp19ARWU/lib/python3.7/site-packages/ipykernel/heartbeat.py", line 61, in _try_bind_socket
    return self.socket.bind('%s://%s' % (self.transport, self.ip) + c + str(self.port))
  File "zmq/backend/cython/socket.pyx", line 550, in zmq.backend.cython.socket.Socket.bind
  File "zmq/backend/cython/checkrc.pxd", line 25, in zmq.backend.cython.checkrc._check_rc
zmq.error.ZMQError: Address already in use

But connecting to the kernel works fine anyway.

Package versions: ipykernel==5.1.2 ipython==7.8.0 ipython-genutils==0.2.0 ipywidgets==7.5.1 jupyter==1.0.0 jupyter-client==5.3.3 jupyter-console==6.0.0 jupyter-core==4.5.0

albertz commented 5 years ago

For reference, I don't see the error, on this setup: MacOSX, Python 3.6. ipykernel==5.1.1 ipython==7.5.0 ipython-genutils==0.2.0 ipywidgets==7.4.2 jupyter==1.0.0 jupyter-client==5.2.4 jupyter-console==6.0.0 jupyter-core==4.4.0 pyzmq==18.0.1

Edit: Also fine after updater updating all my packages, which are now: ipykernel==5.1.1 ipython==7.8.0 ipython-genutils==0.2.0 ipywidgets==7.4.2 jupyter==1.0.0 jupyter-client==5.2.4 jupyter-console==6.0.0 jupyter-core==4.4.0 pyzmq==18.1.0 And latest background-zmq-ipython now.

albertz commented 5 years ago

This looks like an upstream bug in ipykernel==5.1.2, which was fixed here, here.