niner / Inline-Python

Inline::Python for Perl 6
Artistic License 2.0
37 stars 14 forks source link

Cannot locate native library #46

Open librasteve opened 2 hours ago

librasteve commented 2 hours ago

My kit:

Welcome to Rakudo™ Star v2024.10.
Implementing the Raku® Programming Language v6.d.
Built on MoarVM version 2024.10.

On ubuntu

PRETTY_NAME="Ubuntu 22.04.5 LTS"

zef

0.22.4

I am trying to

zef install Inline::Python --exclude="python3"

And getting this error on the first test t/call.t...

===> Testing: Inline::Python:ver<0.5>:auth<cpan:NINE>
[Inline::Python] Cannot locate native library '/tmp/.zef.1731085229.69/1731085236.69.5931.3643253181135/resources/15A7732F70D51B37276F0C1819FD5F
[Inline::Python] 091BA26D2D.so': libpython3.11.so.1.0: cannot open shared object file: No such file or directory
[Inline::Python]   in method setup at /home/jovyan/rakudo/share/perl6/core/sources/14F0F0534C870E1E63E36F719EE99DE84801C5C3 (NativeCall) line 359
[Inline::Python]   in method setup at /home/jovy
[Inline::Python] an/rakudo/share/perl6/core/sources/14F0F0534C870E1E63E36F719EE99DE84801C5C3 (NativeCall) line 399
[Inline::Python]   in sub raku-nativecall at /home/jovyan/rakudo/share/perl6/core/sources/5228944CC4FA77F123C90F521225D03ABE23DF88 (NativeCall::Dispatcher) line 50
[Inline::Python]   in method BUILD at /home/jovyan/rakudo/share/perl6/site/sources/37653EDB728A26F20B16AF45FDA81F139277FD9B (Inline::Python) line 537
[Inline::Python]   in block <unit> at t/call.t line 8
[Inline::Python] 
[Inline::Python] Some exceptions were thrown in END blocks:
[Inline::Python]   X::AdHoc: Cannot locate native library '/tmp/.zef.1731085229.69/1731085236.69.5931.3643253181135/resources/15A7732F70D51B37276F0C1819FD5F091BA26D2D.so': libpython3.11.so.1.0: cannot open shared object file: No such file or directory
[Inline::Python]       in method setup at /home/jovyan/rakudo/share/perl6/core/sources/14F0F0534C870E1E63E36F719EE99DE84801C5C3 (NativeCall) line 359
[Inline::Python]       in method setup at /home/jovyan/rakudo/share/perl6/core/sources/14F0F0534C870E1E63E36F719EE99D
[Inline::Python] E84801C5C3 (NativeCall) line 399
[Inline::Python]       in sub raku-nativecall at /home/jovyan/rakudo/share/perl6/core/sources/5228944CC4FA77F123C90F521225D03ABE23DF88 (NativeCall::Dispatcher) line 50
[Inline::Python]       in block  at /home/jovyan/rakudo/share/perl6/site/sources/37653EDB728A26F20B16AF45FDA81F139277FD9B (Inline::Python) line 648
[Inline::Python]       in any <main> at /home/jovyan/rakudo/bin/../share/perl6/runtime/perl6.moarvm line 1
[Inline::Python]       in any <entry> at /home/jovyan/rakudo/bin/../share/perl6/runtime/perl6.moarvm line 1
[Inline::Python] 
[Inline::Python] t/call.t ................ Dubious, test returned 1

So I did a zef install Inline::Python -v --exclude="python3" --/test

And then ran this snippet:

#!/usr/bin/env perl6

use v6;
use Inline::Python;

say "1..13";

my $py = Inline::Python.new();

And got a clearer error:

(base) root@a8e00c935f1b:~/Inline-Python# raku -I. scum.raku 
1..13
Cannot locate native library '/home/jovyan/Inline-Python/resources/libraries/libpyhelper.so': /home/jovyan/Inline-Python/resources/libraries/libpyhelper.so: cannot open shared object file: No such file or directory
  in method setup at /home/jovyan/rakudo/share/perl6/core/sources/14F0F0534C870E1E63E36F719EE99DE84801C5C3 (NativeCall) line 359
  in method setup at /home/jovyan/rakudo/share/perl6/core/sources/14F0F0534C870E1E63E36F719EE99DE84801C5C3 (NativeCall) line 399
  in sub raku-nativecall at /home/jovyan/rakudo/share/perl6/core/sources/5228944CC4FA77F123C90F521225D03ABE23DF88 (NativeCall::Dispatcher) line 50
  in method BUILD at /home/jovyan/Inline-Python/lib/Inline/Python.pm6 (Inline::Python) line 537
  in block <unit> at scum.raku line 8

Some exceptions were thrown in END blocks:
  X::AdHoc: Cannot locate native library '/home/jovyan/Inline-Python/resources/libraries/libpyhelper.so': /home/jovyan/Inline-Python/resources/libraries/libpyhelper.so: cannot open shared object file: No such file or directory
      in method setup at /home/jovyan/rakudo/share/perl6/core/sources/14F0F0534C870E1E63E36F719EE99DE84801C5C3 (NativeCall) line 359
      in method setup at /home/jovyan/rakudo/share/perl6/core/sources/14F0F0534C870E1E63E36F719EE99DE84801C5C3 (NativeCall) line 399
      in sub raku-nativecall at /home/jovyan/rakudo/share/perl6/core/sources/5228944CC4FA77F123C90F521225D03ABE23DF88 (NativeCall::Dispatcher) line 50
      in block  at /home/jovyan/Inline-Python/lib/Inline/Python.pm6 (Inline::Python) line 648
      in any <main> at /home/jovyan/rakudo/bin/../share/perl6/runtime/perl6.moarvm line 1
      in any <entry> at /home/jovyan/rakudo/bin/../share/perl6/runtime/perl6.moarvm line 1

Here's the source

https://github.com/niner/Inline-Python/blob/05806b0aee2ded79391b63ee5537b7277d17a6b6/lib/Inline/Python.pm6#L10

There is no dir /home/jovyan/Inline-Python/resources at all which makes me suspect the "builder": "Distribution::Builder::MakeFromJSON"

Please can someone who knows how to get libpyhelper.so to the right place please take a look...?

librasteve commented 2 hours ago

One way to replicate my environment is to run this Dockerfile...

FROM librasteve/rakudo:scipy

#RUN    zef install https://github.com/niner/Inline-Python.git --exclude="python3"
RUN    zef install --/test Text::CSV

ENTRYPOINT ["/bin/bash"]

So go docker build -t test . and then docker run -it test and do the commented out command from the command line.