Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Error installing perl bindings #6379

Closed
rbnx opened this issue May 22, 2017 · 25 comments
Closed

Error installing perl bindings #6379

rbnx opened this issue May 22, 2017 · 25 comments

Comments

@rbnx
Copy link

rbnx commented May 22, 2017

OS: Ubuntu 16.04
Compiler: gcc 5.4.0
Package used: Perl
MXNet version: (0.9.3)

I am trying to install the perl bindings (AI::MXNet).
I downloaded this repo, compiled everything then moved to the perl-package folder but I am unable to install AI::MXNetCAPI or AI::NNVMCAPI
I keep getting this error:

"/usr/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- NNVMCAPI.bs blib/arch/auto/AI/NNVMCAPI/NNVMCAPI.bs 644
rm -f blib/arch/auto/AI/NNVMCAPI/NNVMCAPI.so
LD_RUN_PATH="/home/r/Programming/mxnet/perl-package/AI-NNVMCAPI/../../lib" x86_64-linux-gnu-gcc  -shared -L/usr/local/lib -fstack-protector-strong nnvm_wrap.o  -o blib/arch/auto/AI/NNVMCAPI/NNVMCAPI.so  \
   -L/home/r/Programming/mxnet/perl-package/AI-NNVMCAPI/../../lib -lmxnet   \
  
x86_64-linux-gnu-gcc: error: nnvm_wrap.o: No such file or directory
Makefile:481: recipe for target 'blib/arch/auto/AI/NNVMCAPI/NNVMCAPI.so' failed
make: *** [blib/arch/auto/AI/NNVMCAPI/NNVMCAPI.so] Error 1
@rbnx
Copy link
Author

rbnx commented May 22, 2017

@sergeykolychev Any suggestions?
Thanks.

@sergeykolychev
Copy link
Contributor

sergeykolychev commented May 22, 2017

@rbnx
Hi Ruben,
You'll find the instructions for ubuntu at the bottom of this page
https://github.com/dmlc/mxnet/blob/master/docs/get_started/ubuntu_setup.md
From the looks of it you did not install the 'swig' that is used to generate the .cc files.

@rbnx
Copy link
Author

rbnx commented May 22, 2017

@sergeykolychev you are right I hadn't installed SWIG, thanks for all your hard work!

@rbnx rbnx closed this as completed May 22, 2017
@davehodg
Copy link

And this is exactly what I just found!

@davehodg
Copy link

@davehodg
Copy link

@sergeykolychev
Copy link
Contributor

sergeykolychev commented Nov 16, 2017

@davehodg can you help with maintaining the project ?
This this is most up to date link
http://mxnet.incubator.apache.org/install/ubuntu_setup.html#install-the-mxnet-package-for-perl
The MXNet is in transition mode to Apache organization so there's some confusion at the moment.

@davehodg
Copy link

davehodg commented Nov 17, 2017 via email

@davehodg
Copy link

@sergeykolychev
Copy link
Contributor

@davehodg AI::FANN ? You've got me confused, how's related to AI::MXNet ?

@davehodg
Copy link

davehodg commented Nov 17, 2017 via email

@sergeykolychev
Copy link
Contributor

@davehodg Cool, thanks. Just in a case you can also get working mxnet/perl via docker from https://hub.docker.com/r/mxnet/perl/

@davehodg
Copy link

davehodg commented Nov 17, 2017 via email

@sergeykolychev
Copy link
Contributor

yeah I get it, just wanted to let you know that with already precompiled docker image you do not need to go through trouble of compiling the mxnet lib and perl bindings if you want just to try it.
It's as simple (assuming you've got docker installed)

docker pull mxnet/perl
docker run mxnet/perl perl -e 'use AI::MXNet qw(mx); my $ar = mx->nd->ones([2,2]); print (($ar*2)->aspdl)'

I apologize if these instructions are redundant.

@davehodg
Copy link

davehodg commented Nov 17, 2017 via email

@sergeykolychev
Copy link
Contributor

@davehodg
It's just a harmless warning from OpenCV (a prerequisite of mxnet) that does not affect anything, but if you want to get rid of it just link /dev/raw1394 to /dev/null

docker run -v /dev/null:/dev/raw1394 mxnet/perl perl -e 'use AI::MXNet qw(mx); my $ar = mx->nd->ones([2,2]); print (($ar*2)->aspdl)'

https://stackoverflow.com/questions/12689304/ctypes-error-libdc1394-error-failed-to-initialize-libdc1394

@sergeykolychev
Copy link
Contributor

@davehodg
you can run (for example) the calculator.pl from the examples dir by

## see http://blogs.perl.org/users/sergey_kolychev/2017/04/machine-learning-in-perl-part2-a-calculator-handwritten-digits-and-roboshakespeare.html
docker run -v /dev/null:/dev/raw1394 mxnet/perl mxnet/perl-package/AI-MXNet/examples/calculator.pl

@davehodg
Copy link

davehodg commented Nov 17, 2017 via email

@davehodg
Copy link

davehodg commented Dec 19, 2017 via email

@sergeykolychev
Copy link
Contributor

@davehodg not at all, please play with it as you see fit.
The more attention this gets from perl community the better.

@xFFFFF
Copy link

xFFFFF commented May 20, 2018

I have this issue too, you ommited this warning: No library found for -lmxnet

Makefile.PL:
LIBS => ['-L../../lib -lmxnet'],

UPDATE
I tried to compile and install again and succeeded. It is possible that the catalogs were mistaken for me because I cloned the repository first, and then I did it again inside the clon using the command included in the tutorial. Even didnt know that i cloned this same inside clone. The lib directory and two files inside exist. Now im going play with it! Thanks! :)
Linux SAMASUNG 4.13.0-26-generic #29~16.04.2-Ubuntu SMP Tue Jan 9 22:00:44 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
This is perl 5, version 26, subversion 1 (v5.26.1) built for x86_64-linux-thread-multi
MXnet for CPU.

@sergeykolychev
Copy link
Contributor

@xFFFFF Cool!, glad to see some interest. Let me know if you'll run by any bug.

@sergeykolychev
Copy link
Contributor

@xFFFFF
Just tested the lib on perl 5.26.1
You'll need small patch to get all tests to pass on this perl. I am working on larger patch that will include this fix as well.

--- a/perl-package/AI-MXNet/lib/AI/MXNet/AutoLoad.pm
+++ b/perl-package/AI-MXNet/lib/AI/MXNet/AutoLoad.pm
@@ -27,7 +27,7 @@ sub AUTOLOAD
     my $sub = "_${prefix}_$name";
     {
         no strict 'refs';
-        *{"$class::$name"} = sub { shift; $real_class->$sub(@_); };
+        *{"${class}::$name"} = sub { shift; $real_class->$sub(@_); };
     }
     goto $class->can($name);
 }

@xFFFFF
Copy link

xFFFFF commented May 20, 2018

I did not notice any error ... an example from your blog with gluon start without any warning. Only I did not finished train, because I want do something else and im using CPU. I gave up today. I am a total novice and will take some time to run what I want to run :) - ML with buy or sell. It's a pity that most of the examples are operations on images, not numbers :(

@sergeykolychev
Copy link
Contributor

@xFFFFF
One of the tests fail on perl 5.26.1 without that patch above. If you don't care, just ignore.
check out calculator.pl :-) as close to numbers as they come. Images are also converted to numbers before being fed into the network.
On serious note, if you are really new to the subject start with this book. http://neuralnetworksanddeeplearning.com/chap1.html

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants