EntropyOrg / p5-Devel-IPerl

:microscope::books: Perl5 language kernel for Jupyter <http://jupyter.org/>
http://p3rl.org/Devel::IPerl
93 stars 15 forks source link

IPerl Kernel does not start Jupyterlab #90

Closed sknigh closed 3 years ago

sknigh commented 6 years ago

I installed IPerl 0.009 using cpan and tried to launch a notebook in jupyterlab 0.32 installation. The kernel status indicator remains solid black and the hovertip will say "Kernel Connected" but it never becomes idle. All commands entered into the notebook hang forever.

The kernel definitely works because opening a jupyter notebook from the same environment (Help -> Launch Classic Notebook) will immediately load the kernel and operate normally.

dlukes commented 6 years ago

The same goes for a Jupyterlab console with the IPerl kernel. Let me know if I can help in diagnosing the issue :)

dlukes commented 6 years ago

FWIW, it looks like it might be the same problem as this issue reported for the Go kernel: gopherdata/gophernotes#99, and they already have a solution described in this comment:

https://github.com/gopherdata/gophernotes/issues/99#issuecomment-367556545

Unfortunately, I know next to nothing about the kernel protocol and nothing about IPerl itself, so I don't really know where to fit the fix.

dlukes commented 6 years ago

So based on the fix to the related Go kernel issue, I figured out a minimum viable workaround which makes it possible to start a Notebook or Console in JupyterLab: https://github.com/dlukes/p5-Devel-IPerl/commit/af4ca32e498c01d5ede47627f6370ddcb9be0c36

Note that there may be some hidden pitfalls -- there are probably other message handlers that need to be wrapped with busy-idle messages like this, and there may be other mismatches between the version of the protocol IPerl uses and the one expected by JupyterLab which should be addressed in a systematic way.

But as far as evaluating simple Perl code, which is all I've tested so far, this seems to work :)

dlukes commented 6 years ago

Here are a few things that I already know are broken with the minimum viable workaround:

dlukes commented 6 years ago

After wrapping everything I could plausibly identify as a message subroutine in a pair of busy-idle messages (https://github.com/dlukes/p5-Devel-IPerl/commit/af4ca32e498c01d5ede47627f6370ddcb9be0c36 + https://github.com/dlukes/p5-Devel-IPerl/commit/7031f5a9cda7e24f9bc0b67bffd802ba313d0286), restarting the kernel seems to work, but running multiple cells still doesn't, which leads me to think it might be a separate issue with the implementation of the kernel...?

(EDIT: I opened #93 to document the issue about running multiple cells)

zmughal commented 3 years ago

JupyterLab works after #98.

These are now fixed: