vendredi 7 mars 2014

ipython notebook : un premier essai

Depuis longtemps je parcours les articles parlant de python  et de ipython, quelques fois je me suis aventuré à installer ipython, mais avec ipython ....  sans sujet , projet intéressant pour ce type d'approche, c'est difficile de comprendre.

Et puis avec la dernière mouture de Linux Pratique ( mars-avril 2014), contenant deux articles sur l'approche ipython notebook,  j'ai décidé de me lancer dans l'exploration de cet outil. ( installation ....)

Bien m'en a pris car justement deux jours plus tard un sujet bien adapté est arrivé sur mon email .

J'ai donc saisi l'occasion d'explorer ipython notebook et je dois vous avouer que je suis séduit.

J'ai pu répondre à la question qui m'était posé pas de manière élégante mais rapidement et avec un petit graphique en plus. ( histogramme )

Je remercie à cette occasion Sébastien Chazallet et Tristan Colombo pour leur deux articles paru dans Linux Pratique N°82.

Je vous décris ici l'installation sur manjaro.

installation de Ipython et des paquets nécessaire pour ipython notebook.

pacman -S ipython
resolving dependencies...
looking for inter-conflicts...

Packages (2): python-setuptools-2.2-1  ipython-1.2.1-1

Total Download Size:    2.20 MiB
Total Installed Size:   11.48 MiB

:: Proceed with installation? [Y/n] Y
:: Retrieving packages ...
 python-setuptools-2...   314.9 KiB   770K/s 00:00 [######################] 100%
 ipython-1.2.1-1-any     1941.3 KiB  2.07M/s 00:01 [######################] 100%
(2/2) checking keys in keyring                     [######################] 100%
(2/2) checking package integrity                   [######################] 100%
(2/2) loading package files                        [######################] 100%
(2/2) checking for file conflicts                  [######################] 100%
(2/2) checking available disk space                [######################] 100%
(1/2) installing python-setuptools                 [######################] 100%
(2/2) installing ipython                           [######################] 100%
Optional dependencies for ipython
    wxpython: needed for ipythonx and ipython-wx
    python-nose: if you want to run IPython's test suite
    python-pyqt4: for ipython qtconsole
    python-sip: for ipython qtconsole
    python-pygments: for ipython qtconsole
    python-pyzmq: for ipython notebook and ipython qtconcole
    python-tornado: for ipython notebook
    python-jinja: for ipython notebook
    haskell-pandoc: ipython notebook conversion

pacman -S python-pyzmq
pacman -S python-tornado
pacman -S python-jinja

Une fois installé ces paquets j'ai pu lancé l'interface dans une fenètre terminale :
tout d'abord la version.

ipython --version
1.2.1

Une bonne nouvelle car avec ubuntu la version des repository est la version 0.12.... la solution est alors de faire une installation par l'utilitaire pip.

ipython notebook
2014-03-07 21:20:06.092 [NotebookApp] Using existing profile dir: '/home/pboizot/.config/ipython/profile_default'
2014-03-07 21:20:06.098 [NotebookApp] Using MathJax from CDN: http://cdn.mathjax.org/mathjax/latest/MathJax.js
2014-03-07 21:20:06.110 [NotebookApp] Serving notebooks from local directory: /home/pboizot
2014-03-07 21:20:06.111 [NotebookApp] The IPython Notebook is running at: http://127.0.0.1:8888/
2014-03-07 21:20:06.111 [NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
Created new window in existing browser session.

voici le résultat d'un court test.

... j'aborderai dans un prochain post l'analyse d'un ensemble de fichier sar fait avec ipython.

PS : les corrections n'ont concernés que les ordres print. 

Aucun commentaire: