Notebook cells don't run after first error until PyQ kernel restart

421 views Asked by At

I'm running a jupyter notebook with PyQ kernel and able to run both python and q code. BUT: whenever a cell produces an error (like calling a nonexisting_function()), no more cells are executed until I restart the kernel. In contrast, with Python kernel, I can run other (or same) cells after an error, too, which I consider a normal behavior.
enter image description here I'm using miniconda3 with virtual environment (mypyq) on 64bit ubuntu.

(mypyq) user@workstation:~$ conda --version
conda 4.5.11
(mypyq) user@workstation:~$ conda list
# packages in environment at /home/user/miniconda3/envs/mypyq:
#
# Name                    Version                   Build  Channel
<lines skipped>
kdb                       3.6                  2018.10.23    kx
pyq                       4.1.4            py36h39e3cac_0    enlnt
pyq-kernel                1.0                       <pip>
python                    3.6.7                h0371630_0  
(mypyq) user@workstation:~$ jupyter notebook --debug
<lines skipped>

Running 6*7 in the notebook:

[D 09:37:54.476 NotebookApp] activity on ...: status
[D 09:37:54.476 NotebookApp] activity on ...: execute_input
[D 09:37:54.477 NotebookApp] activity on ...: execute_result
[D 09:37:54.479 NotebookApp] activity on ...: status

Cell output is 42, all ok so far.

Now running nonexisting() in the notebook:

[D 09:38:38.266 NotebookApp] activity on ...: status
[D 09:38:38.267 NotebookApp] activity on ...: execute_input
[D 09:38:38.315 NotebookApp] activity on ...: error
[D 09:38:38.317 NotebookApp] activity on ...: status

Notebook cell output:

------------------------------------
NameError   Traceback (most recent call last)
<ipython-input-2-124a31d9d771> in <module>
----> 1 nonexisting()

NameError: name 'nonexisting' is not defined

Running 6*7 cell again:

[D 09:39:29.799 NotebookApp] activity on ...: status
[D 09:39:29.799 NotebookApp] activity on ...: status

I'm missing at least ...: execute_result in the console. And there no output in the notebook as well, until I restart the kernel.

This does not happen with Python kernel, only with PyQ kernel. Running PyQ in the console is ok, too:

(mypyq) user@workstation:~$ pyq
Python 3.6.7 |Anaconda, Inc.| (default, Oct 23 2018, 19:19:38) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> q('9#til 3')
k('0 1 2 0 1 2 0 1 2')
>>> nonexisting()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'nonexisting' is not defined
>>> 6*7
42
>>> exit()

IPython is ok, too:

(mypyq) user@workstation:~$ pyq -m IPython
Python 3.6.7 |Anaconda, Inc.| (default, Oct 23 2018, 19:19:38) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.2.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: %load_ext pyq.magic                                                                                                          

In [2]: from pyq import q                                                                                                            

In [3]: q.til(10)                                                                                                                    
Out[3]: 0 1 2 3 4 5 6 7 8 9

In [4]: nonexisting()                                                                                                                
-------------------------------------------------------
NameError             Traceback (most recent call last)
<ipython-input-4-124a31d9d771> in <module>
----> 1 nonexisting()

NameError: name 'nonexisting' is not defined

In [5]: q.til(10)                                                                                                                    
Out[5]: 0 1 2 3 4 5 6 7 8 9

In [6]: exit()

After running an errorneous cell, when I shutdown jupyter notebook server with Ctrl-C, it reports timing out and killing the kernel.

Shutdown this notebook server (y/[n])? y
[C 11:03:05.086 NotebookApp] Shutdown confirmed
[I 11:03:05.086 NotebookApp] Shutting down 1 kernel
[D 11:03:10.100 NotebookApp] Kernel is taking too long to finish, killing
[I 11:03:10.106 NotebookApp] Kernel shutdown:
1

There are 1 answers

1
sashk On

This bug has been fixed in the pyq-kernel 1.0.1, which was recently released. Thank you for your report.

To upgrade please run:

pip install -U pyq-kernel
pyq -m pyq.kernel install

In the future, please feel free to open issue in the PyQ project repository for faster response.