xonsh / xontrib-jupyter

Xonsh jupyter kernel allows to run Xonsh shell code in Jupyter, JupyterLab, Euporia, etc.
MIT License
32 stars 4 forks source link

`NotImplementedError` trying to start xonsh kernel in Jupyter notebook #5

Closed bobhy closed 1 year ago

bobhy commented 4 years ago

Brand new virtual environemt containing latest-and-greatest of everything. I'm trying this for the first time in order to add it to getting-started docs.

xonfig

``` +------------------+----------------------+ | xonsh | 0.9.19.dev87 | | Git SHA | 1c9fffed | | Commit Date | Aug 16 16:31:17 2020 | | Python | 3.8.5 | | PLY | 3.11 | | have readline | False | | prompt toolkit | 3.0.6 | | shell type | prompt_toolkit | | pygments | 2.6.1 | | on posix | False | | on linux | False | | on darwin | False | | on windows | True | | on cygwin | False | | on msys2 | False | | is superuser | False | | default encoding | utf-8 | | xonsh encoding | utf-8 | | encoding errors | surrogateescape | +------------------+----------------------+ ```

pip list

``` Package Version ----------------- ------- argon2-cffi 20.1.0 attrs 19.3.0 backcall 0.2.0 bleach 3.1.5 cffi 1.14.2 colorama 0.4.3 decorator 4.4.2 defusedxml 0.6.0 entrypoints 0.3 ipykernel 5.3.4 ipython 7.17.0 ipython-genutils 0.2.0 jedi 0.17.2 Jinja2 2.11.2 jsonschema 3.2.0 jupyter-client 6.1.6 jupyter-core 4.6.3 MarkupSafe 1.1.1 mistune 0.8.4 nbconvert 5.6.1 nbformat 5.0.7 notebook 6.1.3 packaging 20.4 pandocfilters 1.4.2 parso 0.7.1 pickleshare 0.7.5 pip 20.1.1 prometheus-client 0.8.0 prompt-toolkit 3.0.6 ptk 1.3.7 pycparser 2.20 Pygments 2.6.1 pyparsing 2.4.7 pyrsistent 0.16.0 python-dateutil 2.8.1 pywin32 228 pywinpty 0.5.7 pyzmq 19.0.2 Send2Trash 1.5.0 setuptools 47.1.0 six 1.15.0 terminado 0.8.3 testpath 0.4.4 tornado 6.0.4 traitlets 4.3.3 wcwidth 0.2.5 webencodings 0.5.1 wheel 0.35.1 xonsh 0.9.19 ```

Repro

  1. python -m venv .venv-jup
  2. pip install notebook
  3. python setup.py install
    (Did this because pip install . did not run install_jupyter_hook).
  4. cd <notebooks>
  5. jupyter notebook
  6. Switch to browser, open notebook page
  7. Open new notebook, select kernel xonsh, as expected
  8. In first cell, enter xonfig

Expect

To see output from xonsh command in cell.

Observe

On notebook page, kernel status hangs at "Kernel starting, please wait"

Traceback

``` PS C:\Users\bobhy\work\nb> C:\Users\bobhy\src\xonsh\.venv-jup\Scripts\activate.ps1 (.venv-jup) PS C:\Users\bobhy\work\nb> jupyter notebook [I 01:51:13.987 NotebookApp] Serving notebooks from local directory: C:\Users\bobhy\work\nb [I 01:51:13.988 NotebookApp] Jupyter Notebook 6.1.3 is running at: [I 01:51:13.988 NotebookApp] http://localhost:8888/?token=3ad07542ebdacb6928d66ac7ebc739b7d959c74b1856d6d3 [I 01:51:13.989 NotebookApp] or http://127.0.0.1:8888/?token=3ad07542ebdacb6928d66ac7ebc739b7d959c74b1856d6d3 [I 01:51:13.989 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [C 01:51:14.248 NotebookApp] To access the notebook, open this file in a browser: file:///C:/Users/bobhy/AppData/Roaming/jupyter/runtime/nbserver-14856-open.html Or copy and paste one of these URLs: http://localhost:8888/?token=3ad07542ebdacb6928d66ac7ebc739b7d959c74b1856d6d3 or http://127.0.0.1:8888/?token=3ad07542ebdacb6928d66ac7ebc739b7d959c74b1856d6d3 [I 01:51:34.385 NotebookApp] Creating new notebook in [I 01:51:43.399 NotebookApp] Kernel started: 2d72feed-9e3d-4044-8da2-4bc7b9df9190, name: xonsh [W 01:51:43.475 NotebookApp] 404 GET /nbextensions/widgets/notebook/js/extension.js (::1) 25.00ms referer=http://localhost:8888/notebooks/Untitled1.ipynb?kernel_name=xonsh C:\Users\bobhy\src\xonsh\.venv-jup\lib\site-packages\xonsh\jupyter_kernel.py:137: DeprecationWarning: zmq.eventloop.ioloop is deprecated in pyzmq 17. pyzmq now works with default tornado and asyncio eventloops. ioloop.install() Traceback (most recent call last): File "C:\Program Files\Python38\lib\runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Program Files\Python38\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\bobhy\src\xonsh\.venv-jup\lib\site-packages\xonsh\jupyter_kernel.py", line 478, in kernel.start() File "C:\Users\bobhy\src\xonsh\.venv-jup\lib\site-packages\xonsh\jupyter_kernel.py", line 155, in start self.iopub_stream = zmqstream.ZMQStream(self.iopub_socket) File "C:\Users\bobhy\src\xonsh\.venv-jup\lib\site-packages\zmq\eventloop\zmqstream.py", line 127, in __init__ self._init_io_state() File "C:\Users\bobhy\src\xonsh\.venv-jup\lib\site-packages\zmq\eventloop\zmqstream.py", line 552, in _init_io_state self.io_loop.add_handler(self.socket, self._handle_events, self.io_loop.READ) File "C:\Users\bobhy\src\xonsh\.venv-jup\lib\site-packages\tornado\platform\asyncio.py", line 100, in add_handler self.asyncio_loop.add_reader(fd, self._handle_events, fd, IOLoop.READ) File "C:\Program Files\Python38\lib\asyncio\events.py", line 501, in add_reader raise NotImplementedError NotImplementedError [I 01:52:13.391 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports C:\Users\bobhy\src\xonsh\.venv-jup\lib\site-packages\xonsh\jupyter_kernel.py:137: DeprecationWarning: zmq.eventloop.ioloop is deprecated in pyzmq 17. pyzmq now works with default tornado and asyncio eventloops. ioloop.install() Traceback (most recent call last): File "C:\Program Files\Python38\lib\runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Program Files\Python38\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\bobhy\src\xonsh\.venv-jup\lib\site-packages\xonsh\jupyter_kernel.py", line 478, in kernel.start() File "C:\Users\bobhy\src\xonsh\.venv-jup\lib\site-packages\xonsh\jupyter_kernel.py", line 155, in start self.iopub_stream = zmqstream.ZMQStream(self.iopub_socket) File "C:\Users\bobhy\src\xonsh\.venv-jup\lib\site-packages\zmq\eventloop\zmqstream.py", line 127, in __init__ self._init_io_state() File "C:\Users\bobhy\src\xonsh\.venv-jup\lib\site-packages\zmq\eventloop\zmqstream.py", line 552, in _init_io_state self.io_loop.add_handler(self.socket, self._handle_events, self.io_loop.READ) File "C:\Users\bobhy\src\xonsh\.venv-jup\lib\site-packages\tornado\platform\asyncio.py", line 100, in add_handler self.asyncio_loop.add_reader(fd, self._handle_events, fd, IOLoop.READ) File "C:\Program Files\Python38\lib\asyncio\events.py", line 501, in add_reader raise NotImplementedError NotImplementedError [I 01:52:31.410 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports Traceback (most recent call last): File "C:\Program Files\Python38\lib\runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Program Files\Python38\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\bobhy\src\xonsh\.venv-jup\lib\site-packages\xonsh\jupyter_kernel.py", line 464, in setup( File "C:\Users\bobhy\src\xonsh\.venv-jup\lib\site-packages\xonsh\__amalgam__.py", line 24603, in setup execer = Execer(xonsh_ctx=ctx) File "C:\Users\bobhy\src\xonsh\.venv-jup\lib\site-packages\xonsh\__amalgam__.py", line 23448, in __init__ load_builtins(execer=self, ctx=xonsh_ctx) File "C:\Users\bobhy\src\xonsh\.venv-jup\lib\site-packages\xonsh\__amalgam__.py", line 23166, in load_builtins [I 01:52:34.282 NotebookApp] Interrupted... [I 01:52:34.340 NotebookApp] Shutting down 1 kernel ... ```

For community

⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment

scopatz commented 4 years ago

Thanks for reporting @bobhy - do you have the output of setup.py install? This reports whether the jupyter hook was installed or not

bobhy commented 4 years ago

It did log installing the hook (manual run), and jupyter kernelspec list shows xonsh and python. More details details when I get home.

On Wed, Aug 19, 2020, 5:26 PM Anthony Scopatz notifications@github.com wrote:

Thanks for reporting @bobhy https://github.com/bobhy - do you have the output of setup.py install? This reports whether the jupyter hook was installed or not

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <xonsh/xontrib-jupyter#5>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPBIZFN7PHSEVVCQE5NWETSBRUTTANCNFSM4QBJMUAQ .

joouha commented 1 year ago

This should now be fixed by b6671d39ab71d770b1987f48dab7af2e4f1848ad