Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install Perl in Jupyter notebook on Ubuntu 16.04LTS

Sorry if the question is too obvious.

I'm having problems with the installation of Iperl from

https://github.com/EntropyOrg/p5-Devel-IPerl.git

I know that anyway Jupyter has the option to run Perl code through %%perl but it could be annoying to add this to every cell.

The steps that I followed where the next:

-First I installed Perl

sudo apt-get install perl

-next, I followed the steps that they provide:

sudo apt-get install libzmq3-dev ipython ipython-notebook libmagic-dev
git clone https://github.com/EntropyOrg/p5-Devel-IPerl.git

cd p5-Devel-IPerl
dzil build 

(I did this step before discover that I have to run cpanm --installdeps . inside /home/User/p5-Devel-IPerlto install dependencies required)

cpanm --installdeps .

./bin/iperl console  # start the console

./bin/iperl notebook # start the notebook --> These commands doesn't work because my Ipython notebooks are located in Anaconda2

My questions are:

When I follow these instructions, the installation I guess is done outside of Anaconda2 and maybe because of that, it doesn't appear in the notebook.

How to do it to include it inside of Anaconda2?

If it is not possible, how to run it at least in a parallel notebook outside of Anaconda2 parent folder?

Thank you a lot for any advice.

like image 820
Malj90 Avatar asked Aug 09 '17 15:08

Malj90


1 Answers

You can check real documentation for Devel::IPerl module here.

I could install it in my docker with Ubuntu, where I've installed the default Jupyter previously.

For IPerl I installed:

$ sudo apt install libzmq3-dev
$ sudo apt install cpanminus 
$ export ARCHFLAGS='-arch x86_64'
$ cpanm --build-args 'OTHERLDFLAGS=' ZMQ::LibZMQ3
$ cpanm Devel::IPerl

After this, both the console and the notebook worked for me (I start it as described in the doc):

# iperl console
Jupyter console 5.2.0

IPerl!


In [1]: print "hello world!"
hello world!Out[1]: 1

In [2]: sub pow { $_[0]**$_[1] }

In [3]: pow(2,3)
Out[3]: 8

In [4]: pow(3,2)
Out[4]: 9

"Hello world" in IPerl jupyter:

screen shot with opened IPerl notebook

I've recently started to investigate IPerl for Jupyter, but it works really good so far.

like image 104
Alexandr Sudakov Avatar answered Oct 20 '22 19:10

Alexandr Sudakov