Giter VIP home page Giter VIP logo

Comments (9)

minrk avatar minrk commented on May 28, 2024

The multiple-instance error is because of something amiss with the shim. If you import from ipykernel.datapub it should work.

from ipykernel.

jakirkham avatar jakirkham commented on May 28, 2024

Tried that same error. See below for example.

$ ipython
Python 2.7.10 |Continuum Analytics, Inc.| (default, Oct 19 2015, 18:31:17) 
Type "copyright", "credits" or "license" for more information.

IPython 4.0.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: from ipykernel.datapub import publish_data

In [2]: import numpy as np

In [3]: myarr = np.ones(2 * 1024 * 1024 * 1024 * 8 // 64)

In [4]: publish_data({'x': myarr})
---------------------------------------------------------------------------
MultipleInstanceError                     Traceback (most recent call last)
<ipython-input-4-49f20562eb3f> in <module>()
----> 1 publish_data({'x': myarr})

/zopt/conda/envs/nanshenv/lib/python2.7/site-packages/ipykernel/datapub.pyc in publish_data(data)
     55     """
     56     from ipykernel.zmqshell import ZMQInteractiveShell
---> 57     ZMQInteractiveShell.instance().data_pub.publish_data(data)

/zopt/conda/envs/nanshenv/lib/python2.7/site-packages/traitlets/config/configurable.pyc in instance(cls, *args, **kwargs)
    389             raise MultipleInstanceError(
    390                 'Multiple incompatible subclass instances of '
--> 391                 '%s are being created.' % cls.__name__
    392             )
    393 

MultipleInstanceError: Multiple incompatible subclass instances of ZMQInteractiveShell are being created.

from ipykernel.

minrk avatar minrk commented on May 28, 2024

Oh, I didn't notice that you were using regular terminal IPython. Terminal IPython doesn't have data publication, so the bug is actually that it should raise an AttributeError or NotImplementedError or some such. Make sure you are using an IPython kernel, such as jupyter console, notebook, or qtconsole.

from ipykernel.

jakirkham avatar jakirkham commented on May 28, 2024

There's a jupyter console?! Cool! I did not even know this existed. How does it determine what kernel to use?

from ipykernel.

jakirkham avatar jakirkham commented on May 28, 2024

So, I tried the same exercise with jupyter_console version 4.0.3. Here's what happened. Placed in this issue ( jupyter/jupyter_console#33 ).

$ jupyter console
Jupyter Console 4.0.3

[ZMQTerminalIPythonApp] Loading IPython extension: storemagic
[ZMQTerminalIPythonApp] Loading IPython extension: h5py.ipy_completer

In [1]: from ipykernel.datapub import publish_data

In [2]: import numpy as np

In [3]: myarr = np.ones(2 * 1024 * 1024 * 1024 * 8 // 64)

In [4]: publish_data({'x': myarr})
Traceback (most recent call last):
  File "/zopt/conda/envs/nanshenv/bin/jupyter-console", line 5, in <module>
    app.main()
  File "/zopt/conda/envs/nanshenv/lib/python2.7/site-packages/jupyter_core/application.py", line 267, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/zopt/conda/envs/nanshenv/lib/python2.7/site-packages/traitlets/config/application.py", line 592, in launch_instance
    app.start()
  File "/zopt/conda/envs/nanshenv/lib/python2.7/site-packages/jupyter_console/app.py", line 155, in start
    super(ZMQTerminalIPythonApp, self).start()
  File "/zopt/conda/envs/nanshenv/lib/python2.7/site-packages/IPython/terminal/ipapp.py", line 353, in start
    self.shell.mainloop()
  File "/zopt/conda/envs/nanshenv/lib/python2.7/site-packages/jupyter_console/interactiveshell.py", line 420, in mainloop
    self.interact(display_banner=display_banner)
  File "/zopt/conda/envs/nanshenv/lib/python2.7/site-packages/jupyter_console/interactiveshell.py", line 588, in interact
    self.run_cell(source_raw)
  File "/zopt/conda/envs/nanshenv/lib/python2.7/site-packages/jupyter_console/interactiveshell.py", line 174, in run_cell
    self.handle_iopub(msg_id)
  File "/zopt/conda/envs/nanshenv/lib/python2.7/site-packages/jupyter_console/interactiveshell.py", line 262, in handle_iopub
    sub_msg = self.client.iopub_channel.get_msg()
  File "/zopt/conda/envs/nanshenv/lib/python2.7/site-packages/jupyter_client/blocking/channels.py", line 55, in get_msg
    return self._recv()
  File "/zopt/conda/envs/nanshenv/lib/python2.7/site-packages/jupyter_client/blocking/channels.py", line 41, in _recv
    msg = self.socket.recv_multipart(**kwargs)
  File "/zopt/conda/envs/nanshenv/lib/python2.7/site-packages/zmq/sugar/socket.py", line 361, in recv_multipart
    part = self.recv(flags, copy=copy, track=track)
  File "zmq/backend/cython/socket.pyx", line 676, in zmq.backend.cython.socket.Socket.recv (zmq/backend/cython/socket.c:6507)
  File "zmq/backend/cython/socket.pyx", line 710, in zmq.backend.cython.socket.Socket.recv (zmq/backend/cython/socket.c:6307)
  File "zmq/backend/cython/socket.pyx", line 147, in zmq.backend.cython.socket._recv_copy (zmq/backend/cython/socket.c:1877)
  File "zmq/backend/cython/checkrc.pxd", line 19, in zmq.backend.cython.checkrc._check_rc (zmq/backend/cython/socket.c:6920)
    raise Again(errno)
Again: Resource temporarily unavailable

If you suspect this is an IPython bug, please report it at:
    https://github.com/ipython/ipython/issues
or send an email to the mailing list at [email protected]

You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.

Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
    %config Application.verbose_crash=True

from ipykernel.

takluyver avatar takluyver commented on May 28, 2024

Closing because that function is being moved to ipyparallel in any case.

from ipykernel.

jakirkham avatar jakirkham commented on May 28, 2024

So, should this issue be moved somewhere else? AFAICT this is still not fixed.

from ipykernel.

takluyver avatar takluyver commented on May 28, 2024

It sounds like the fix is just to make the error message clearer. If there's still anything to do, ipyparallel is the relevant repo:
https://github.com/ipython/ipyparallel

from ipykernel.

jakirkham avatar jakirkham commented on May 28, 2024

Sorry, its been awhile since I look at this. I was wrong. There was a bug. It was a bug in zeromq. @minrk added a workaround for pyzmq. ( zeromq/pyzmq#782 ) So, this is actually fixed.

from ipykernel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.