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

Installation #107

Closed philiprbrenan closed 3 years ago

philiprbrenan commented 3 years ago

The basic idea is excellent. However, the installation procedure leaves me hanging at this point:

 iperl notebook
 App::REPL _ 

I was expecting to see a notebook in a browser but all I get is a command line REPL. Please tell me how to see Perl running in a browser using a Jupyter Perl kernel on my local machine provided by your module?

zmughal commented 3 years ago

What’s the output of jupyter --data-dir? Do you see an iperl kernel directory under there with a JSON configuration?

philiprbrenan commented 3 years ago
phil@pousadouros:~$ jupyter --data-dir
/home/phil/.local/share/jupyter
phil@pousadouros:~$ tree /home/phil/.local/share/jupyter
/home/phil/.local/share/jupyter
├── nbconvert
│   └── templates
│       ├── html
│       └── latex
├── nbsignatures.db
├── notebook_secret
└── runtime
    ├── kernel-3e84322e-b45c-45bb-873a-79d3889fd136.json
    ├── nbserver-313420.json
    ├── nbserver-313420-open.html
    ├── nbserver-314360.json
    ├── nbserver-314360-open.html
    ├── nbserver-314895.json
    ├── nbserver-314895-open.html
    ├── nbserver-316018.json
    ├── nbserver-316018-open.html
    ├── nbserver-316417.json
    ├── nbserver-316417-open.html
    └── notebook_cookie_secret

5 directories, 14 files
zmughal commented 3 years ago

That's interesting. It seems it was not able to generate the kernel spec file. Perhaps some debugging info might come out of

$ perl -Mautodie=:all -S iperl

What do you have for jupyter --version?

I have:

$ jupyter --version
jupyter core     : 4.7.1
jupyter-notebook : 6.3.0
qtconsole        : not installed
ipython          : 7.22.0
ipykernel        : 4.9.0
jupyter client   : 6.1.12
jupyter lab      : 3.0.12
nbconvert        : 6.0.7
ipywidgets       : 6.0.0
nbformat         : 5.1.3
traitlets        : 4.3.2

and after I run iperl or iperl notebook, I have the following output:

$ tree $( jupyter --data-dir )/kernels/
/home/zaki/.local/share/jupyter/kernels/
└── iperl
    ├── kernel.json
    ├── logo-32x32.png
    └── logo-64x64.png

1 directory, 3 files

where

$ jq '.' < $( jupyter --data-dir )/kernels/iperl/kernel.json
{
  "argv": [
    "/home/zaki/perl5/perlbrew/perls/perl-5.26.1/bin/perl",
    "-Mutf8",
    "-Mopen qw(:std :encoding(UTF-8))",
    "-MDevel::IPerl",
    "-e Devel::IPerl::main",
    "kernel",
    "{connection_file}"
  ],
  "display_name": "IPerl 0.010",
  "iperl_version": "0.010",
  "language": "perl"
}
zmughal commented 3 years ago

Oh, I believe I have figured it out. You are running a different iperl script. That is the output of https://metacpan.org/source/AYRNIEU/App-REPL-0.012/iperl.

philiprbrenan commented 3 years ago
jupyter --version
jupyter core     : 4.7.1
jupyter-notebook : 6.3.0
qtconsole        : 5.0.3
ipython          : 7.22.0
ipykernel        : 5.5.3
jupyter client   : 6.1.12
jupyter lab      : not installed
nbconvert        : 6.0.7
ipywidgets       : 7.6.3
nbformat         : 5.1.3
traitlets        : 5.0.5
zmughal commented 3 years ago

Can you ensure that the iperl script is this: https://github.com/EntropyOrg/p5-Devel-IPerl/blob/v0.010/bin/iperl?

zmughal commented 3 years ago

Any update?

philiprbrenan commented 3 years ago

Success after I cloned the github repo and followed the content of the github action. I had to install additional modules:

cpan install IPerl cpan install Devel::IPerl::Display::PNG

This makes for a difficult and unreliable install sequence on Ubuntu that most people will be unable to perform. The install sequence has to be:

cpan install IPerl

and nothing else to hope to gain any traction.

Thank you for your help and encouragement.

zmughal commented 3 years ago

Hmm, I will need to replicate this issue. Thanks for pointing out the steps you used.

Let me see if I can create a Dockerfile using an Ubuntu base to see what is going on. Those instructions should work with Devel::IPerl as the package name. The package that gets installed with IPerl is something else not by me (even if IPerl is used internally to control the kernel communication).

zmughal commented 3 years ago

I could not reproduce the issue using this Dockerfile:

ARG BASE_CONTAINER=jupyter/minimal-notebook
# jupyter/minimal-notebook depends on debian container

FROM $BASE_CONTAINER

USER root

RUN apt-get update \
    && apt-get install -yq --no-install-recommends \
        libzmq3-dev cpanminus curl \
    && cpanm -n App::cpm && cpm install -g Devel::IPerl PDL local::lib \
    && chown -R jovyan:users /home/jovyan

USER $NB_UID

RUN iperl --help
$ docker build -t iperl . && docker run --rm -p 8888:8888 -e JUPYTER_ENABLE_LAB=yes -v $(pwd):/home/jovyan/work iperl