How to replace "from IPython.kernel import KernelManager"?

Viewed 2552

I have some code which tries to import a KernalManager from IPython, but I get a Warning

/home/alex/Projects/VETests/ipyrunner/local/lib/python2.7/site-packages/IPython/kernel/__init__.py:13: ShimWarning: The `IPython.kernel` package has been deprecated since IPython 4.0.You should import from ipykernel or jupyter_client instead.
  "You should import from ipykernel or jupyter_client instead.", ShimWarning)

but when I do the following

from ipykernel import KernelManager

I get an error

ImportError: cannot import name KernelManager

How to do it right?

1 Answers

Replace

from IPython.kernel import KernelManager/from ipykernel import KernelManager

with

from jupyter_client.manager import KernelManager.

Related