Missing IPython Notebook Environment? (`ipykernel.zmqshell` missing?)

(Brennan Saeta) #1

Hey all,

I’m getting a confusing exception when trying to use Jupyter Notebooks:

Python exception: No module named ipykernel.zmqshell

(Full error message below.) Anyone have any good ideas as to what’s going wrong? I have Jupyter appropriately installed, and can import ipykernel.

(venv) saeta@clattner-saeta-hack-box:~/fastai_docs/dev_course/dl2$ python
Python 3.6.7 (default, Oct 22 2018, 11:32:17) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ipython
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'ipython'
>>> import ipykernel
>>> dir(ipykernel)
['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '__version__', '_version', 'connect', 'connect_qtconsole', 'find_connection_file', 'get_connection_file', 'get_connection_info', 'kernel_protocol_version', 'kernel_protocol_version_info', 'version_info', 'write_connection_file']
>>> 
(venv) saeta@clattner-saeta-hack-box:~/fastai_docs/dev_course/dl2$ pip freeze | grep "ipy"
ipykernel==5.1.0
ipython==7.4.0
ipython-genutils==0.2.0
ipywidgets==7.4.2
(venv) saeta@clattner-saeta-hack-box:~/fastai_docs/dev_course/dl2$ pip freeze | grep "zmq"
pyzmq==18.0.1

Full error message:

Fatal error: 'try!' expression unexpectedly raised an error: Python exception: No module named ipykernel.zmqshell
Traceback:
  File "/home/saeta/swift-jupyter/swift_shell/__init__.py", line 15, in <module>
    from ipykernel.zmqshell import ZMQInteractiveShell
: file /swift-base/swift/stdlib/public/Python/Python.swift, line 675
Current stack trace:
0    libswiftCore.so                    0x00007fe4b32d38c0 _swift_stdlib_reportFatalErrorInFile + 115
1    libswiftCore.so                    0x00007fe4b321c54c <unavailable> + 3011916
2    libswiftCore.so                    0x00007fe4b321c63e <unavailable> + 3012158
3    libswiftCore.so                    0x00007fe4b30635b2 <unavailable> + 1205682
4    libswiftCore.so                    0x00007fe4b31e8f62 <unavailable> + 2801506
5    libswiftCore.so                    0x00007fe4b30a5e6b <unavailable> + 1478251
6    libswiftPython.so                  0x00007fe4bdecb69b <unavailable> + 63131
Current stack trace:
	frame #3: 0x00007fe4bdeb7a67 $__lldb_expr54`specialized static IPythonDisplay.enable() at EnableIPythonDisplay.swift:63:30
	frame #5: 0x00007fe4bdeb402b $__lldb_expr54`main at <REPL>:82

Minimal cell that reproduces this:

%include "EnableIPythonDisplay.swift"

Thanks!
-Brennan

0 Likes

(Walter Wiggins) #2

I ran into this error when the Swift-Jupyter kernel was invoking the wrong version of Python (=2.7). I was able to correct this by utilizing the --swift-python-library option when running register.py.

Note: I still haven’t been able to get the Swift REPL to recognize my env vars for Python interop, but at least it’s solved for Swift-Jupyter.

0 Likes

(Brennan Saeta) #3

Thanks for the pointer @neuradai! I can confirm that I was getting the wrong Python version (2.mumble). Thanks for the tip!

1 Like