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

kernel.json not found when launching iperl console #80

Closed yulivee closed 6 years ago

yulivee commented 6 years ago

Hi, I just installed IPerl via github and your readme and when trying to start iperl console it prints the error message Can't read ~/.local/share/jupyter/kernels/iperl/kernel.json: No such file or directory at ./bin/iperl line 98.

I cannot find a kernel.json file on my system. Did something go wrong in the installation process and the file did not get created? Where and when is kernel.json expected to be created?

Kind regards, Sandra

zmughal commented 6 years ago

Hello!

What else is in that directory? If you remove the directory and rerun iperl, does it generate the kernel.json?

-(master)-♥ jq -M < $(jupyter --data-dir)/kernels/iperl/kernel.json
{
  "language": "perl",
  "argv": [
    "perl",
    "-MDevel::IPerl",
    "-e Devel::IPerl::main",
    "kernel",
    "{connection_file}"
  ],
  "display_name": "IPerl [git]",
  "iperl_version": "[git]"
}
zmughal commented 6 years ago

Just following up: did this work for you?

yulivee commented 6 years ago

Sorry for not following up - actually that did unfortunately not work for me. I listed below what I tried - basically in the iperl directory there are only two images, no kernel.json. Removing the directory and running iperl again causes a segfault but it seems to recreate the directory - again without the kernel.json.

perl --version

This is perl 5, version 22, subversion 1 (v5.22.1) built for x86_64-linux-gnu-thread-multi
(with 60 registered patches, see perl -V for more detail)

ls $(jupyter --data-dir)/kernels/iperl
logo-32x32.png  logo-64x64.png

rm -r $(jupyter --data-dir)/kernels/iperl
removed '/home/sschuhmacher/.local/share/jupyter/kernels/iperl/logo-32x32.png'
removed '/home/sschuhmacher/.local/share/jupyter/kernels/iperl/logo-64x64.png'
removed directory '/home/sschuhmacher/.local/share/jupyter/kernels/iperl'

./bin/iperl console  # start the console               
Directory for Perl kernel spec does not exist...
[1]    5366 segmentation fault (core dumped)  ./bin/iperl console

ls $(jupyter --data-dir)/kernels/iperl
logo-32x32.png  logo-64x64.png

I also tried manually creating the kernel.json you posted above. When doing that, iperl segfaults. Interesting :grin:

Kind regards, Sandra

yulivee commented 6 years ago

Added some of my system specs:

OS_version.txt perl_version.txt

yulivee commented 6 years ago

I started iperl in the debugger and found the part where the segfault is happening:

109==>b         my $kernel_spec = {
110:                display_name => "IPerl @{[get_devel_iperl_version()]}",
111                 argv => [ "perl", "-MDevel::IPerl", "-e Devel::IPerl::main", "kernel", "{connection_file}" ],
112                 language => "perl",
113                 iperl_version => get_devel_iperl_version(),
114             };

It seems to be the get_devel_iperl_version() function - as soon as I call it, my debugger dies. Looking at the subroutine I tried the individual statements listed in it by hand and discovered that performing require Devel::IPerl;is the statement that kills it:

  DB<4> x require Devel::IPerl;
Signal SEGV at /home/sschuhmacher/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/Ref/Util/XS.pm line 43.
    require Ref/Util/XS.pm called at /home/sschuhmacher/perl5/lib/perl5/Ref/Util.pm line 13
    eval {...} called at /home/sschuhmacher/perl5/lib/perl5/Ref/Util.pm line 13
    require Ref/Util.pm called at /home/sschuhmacher/perl5/lib/perl5/Specio/Library/Builtins.pm line 21
    eval {...} called at /home/sschuhmacher/perl5/lib/perl5/Specio/Library/Builtins.pm line 21
    Specio::Library::Builtins::BEGIN() called at /home/sschuhmacher/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/Ref/Util/XS.pm line 0
    eval {...} called at /home/sschuhmacher/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/Ref/Util/XS.pm line 0
    require Specio/Library/Builtins.pm called at /home/sschuhmacher/perl5/lib/perl5/Markdent/Types/Internal.pm line 11
    Markdent::Types::Internal::BEGIN() called at /home/sschuhmacher/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/Ref/Util/XS.pm line 0
    eval {...} called at /home/sschuhmacher/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/Ref/Util/XS.pm line 0
    require Markdent/Types/Internal.pm called at /home/sschuhmacher/perl5/lib/perl5/Markdent/Types.pm line 8
    Markdent::Types::BEGIN() called at /home/sschuhmacher/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/Ref/Util/XS.pm line 0
    eval {...} called at /home/sschuhmacher/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/Ref/Util/XS.pm line 0
    require Markdent/Types.pm called at /home/sschuhmacher/perl5/lib/perl5/Markdent/Role/Event.pm line 9
    Markdent::Role::Event::BEGIN() called at /home/sschuhmacher/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/Ref/Util/XS.pm line 0
    eval {...} called at /home/sschuhmacher/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/Ref/Util/XS.pm line 0
    require Markdent/Role/Event.pm called at /home/sschuhmacher/perl5/lib/perl5/Module/Runtime.pm line 314
    Module::Runtime::require_module("Markdent::Role::Event") called at /home/sschuhmacher/perl5/lib/perl5/Module/Runtime.pm line 391
    eval {...} called at /home/sschuhmacher/perl5/lib/perl5/Module/Runtime.pm line 391
    Module::Runtime::use_package_optimistically("Markdent::Role::Event") called at /home/sschuhmacher/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/Moose/Util.pm line 352
    Moose::Util::_load_user_class("Markdent::Role::Event", HASH(0x300d708)) called at /home/sschuhmacher/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/Moose/Util.pm line 147
    Moose::Util::_apply_all_roles(Moose::Meta::Class::__ANON__::SERIAL::1=HASH(0x41aa3a0), undef, "Markdent::Role::Event", HASH(0x300d708)) called at /home/sschuhmacher/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/Moose/Util.pm line 114
    Moose::Util::apply_all_roles(Moose::Meta::Class::__ANON__::SERIAL::1=HASH(0x41aa3a0), "Markdent::Role::Event", HASH(0x300d708)) called at /home/sschuhmacher/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/Moose.pm line 57
    Moose::with(Moose::Meta::Class::__ANON__::SERIAL::1=HASH(0x41aa3a0), "Markdent::Role::Event", HASH(0x300d708)) called at /home/sschuhmacher/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/Moose/Exporter.pm line 419
    Moose::with("Markdent::Role::Event", HASH(0x300d708)) called at /home/sschuhmacher/perl5/lib/perl5/Markdent/Event/StartDocument.pm line 12
    require Markdent/Event/StartDocument.pm called at /home/sschuhmacher/perl5/lib/perl5/Markdent/Parser/BlockParser.pm line 11
    Markdent::Parser::BlockParser::BEGIN() called at /home/sschuhmacher/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/Ref/Util/XS.pm line 0
    eval {...} called at /home/sschuhmacher/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/Ref/Util/XS.pm line 0
    require Markdent/Parser/BlockParser.pm called at /home/sschuhmacher/perl5/lib/perl5/Markdent/Parser.pm line 9
    Markdent::Parser::BEGIN() called at /home/sschuhmacher/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/Ref/Util/XS.pm line 0
    eval {...} called at /home/sschuhmacher/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/Ref/Util/XS.pm line 0
    require Markdent/Parser.pm called at /home/sschuhmacher/perl5/lib/perl5/Markdown/Pod.pm line 11
    Markdown::Pod::BEGIN() called at /home/sschuhmacher/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/Ref/Util/XS.pm line 0
    eval {...} called at /home/sschuhmacher/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/Ref/Util/XS.pm line 0
    require Markdown/Pod.pm called at /home/sschuhmacher/Projekte/github/p5-Devel-IPerl/bin/../lib/Devel/IPerl/NBConvert.pm line 9
    Devel::IPerl::NBConvert::BEGIN() called at /home/sschuhmacher/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/Ref/Util/XS.pm line 0
    eval {...} called at /home/sschuhmacher/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/Ref/Util/XS.pm line 0
    require Devel/IPerl/NBConvert.pm called at /home/sschuhmacher/Projekte/github/p5-Devel-IPerl/bin/../lib/Devel/IPerl.pm line 8
    Devel::IPerl::BEGIN() called at /home/sschuhmacher/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/Ref/Util/XS.pm line 0
    eval {...} called at /home/sschuhmacher/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/Ref/Util/XS.pm line 0
    require Devel/IPerl.pm called at ./bin/iperl line 59
    main::get_devel_iperl_version() called at (eval 48)[/usr/share/perl/5.22/perl5db.pl:737] line 2
    eval 'no strict; ($@, $!, $^E, $,, $/, $\\, $^W) = @DB::saved;package main; $^D = $^D | $DB::db_stop;
  get_devel_iperl_version();
' called at /usr/share/perl/5.22/perl5db.pl line 737
    DB::eval called at /usr/share/perl/5.22/perl5db.pl line 3110
    DB::DB called at ./bin/iperl line 109
    main::create_kernel_spec() called at ./bin/iperl line 25
    main::main() called at ./bin/iperl line 19
[1]    21791 abort (core dumped)  perl -d ./bin/iperl console

Update: I individually tried loading the modules used by Devel::IPerl and the Error segfault is created by Devel::IPerl::NBConvert. Following further along, I identified the Markdown::Pod module to cause the segfault. Further research lead me to this issue Error in markdent. So I guess its not related to your code but rather a problem with Markdown::Pod. I am trying to integrate the fix from your pullrequest on this issue and keep you updated on the result. thanks for looking into this so far!

yulivee commented 6 years ago

Update for completeness: Installing Markdent with cpanm Markdent@0.26 Markdown::Pod@0.006 solved the issue (See also Markdown-Pod Issue 8 )

zmughal commented 6 years ago

Ah, I see! Good thing I looked into that Markdown-Pod bug earlier when I had issues installing IPerl on a new machine! ;-)

I'll try to see if I can make Markdown-Pod an optional dependency for my next CPAN release.