Active Topics

 


Reply
Thread Tools
Posts: 1,269 | Thanked: 3,961 times | Joined on May 2011 @ Brazil
#1
IPython is an enhanced Python interactive shell.

IPython package is available for Saifish (& Mer & Nemo Mobile), so interactively using Python and its modules (like SymPy, NumPy, MatPlotLib, Uncertainties, etc) on Sailfish becomes a lot easier.

See the :
- "IPython for Maemo 4 & 5 & Meego Harmattan & Sailfish" topic in Talk Maemo.org for Maemo 4 Diablo and Maemo 5 Fremantle versions of IPython;
- "IPython (Notebook, QtConsole) 0.13.1 for MeeGo Harmattan" topic in Talk Maemo.org for MeeGo Harmattan versions of IPython.

IPython version history on Sailfish & Mer & Nemo Mobile :
- IPython 0.13.1 (21/10/2012) released for Mer & Nemo Mobile (25/02/2013), only with terminal interface;
- IPython 0.13.2 (05/04/2013) released for Mer & Nemo Mobile (01/06/2013), with terminal interface, Notebook web interface and Qt (for X11) console interface;
- IPython 1.2.1 (24/02/2014) released for Sailfish & Mer & Nemo Mobile (05/05/2014), with terminal interface and Notebook web interface;
- IPython 2.0.0 (01/04/2014) released for Sailfish & Mer & Nemo Mobile (05/05/2014), with terminal interface and Notebook web interface.
- IPython 2.1.0 (21/05/2014) a bug fix release, for Sailfish & Mer & Nemo Mobile (23/05/2014), with terminal interface and Notebook web interface.
- IPython 2.2.0 (06/08/2014) anoter bug fix release, for Sailfish & Mer & Nemo Mobile (16/09/2014), with terminal interface and Notebook web interface;
- IPython 2.3.0 (01/10/2014) is one more bug release, for Sailfish & Mer & Nemo Mobile (02/10/2014), with terminal interface and Notebook web interface.
- IPython 2.4.1 (09/02/2015) is the last 2.x release, for Sailfish & Mer & Nemo Mobile (07/08/2016), with terminal interface and Notebook web interface.

Screenshots of IPython on Sailfish


Screenshot of IPython 2.3.0 terminal interface Sailfish OS & Jolla :


Screenshot of IPython 2.0.0 Notebook web interface on Sailfish OS & Nexus 4 showing the dashboard with default web browser :


Screenshot of IPython 2.0.0 Notebook web interface on on Sailfish OS & Nexus 4 with default web browser, showing a MathJax example :


Screenshot of IPython 2.3.0 Notebook web interface on Sailfish OS & Jolla, with (Android) Firefox web browser, showing a SymPy example :


Screenshot of IPython 2.1.0 Notebook web interface using Webcat browser on Sailfish OS showing a SymPy plotting example :


Installing IPython on Sailfish

Install Warehouse (OpenRepos.net client) for Sailfish OS, see the Jolla Tides guide with screenshots.
Then open Warehouse, search for "IPython", enable the repository, then install it.

Screenshot of Warehouse on Sailfish showing the IPython 2.3.0 package on OpenRepos.net :


IPython v2.4.1 for Sailfish OS depends on libZMQ, Python-PyZMQ, PycURL, Pygments, Tornado, Jinja2 and MarkupSafe, so they will be installed, everything taking 33 MB of space after installation.

If you want mathematical formulas rendered in IPython Notebook in offline mode, install MathJax following this guide in your Sailfish smartphone. It is recommended because the rendering of mathematical formulas is a lot faster with local installation.

"ipython nbconvert" doesn't work on Mer/Sailfish due to missing dependencies (pandoc, Haskell language, etc).

Using IPython on Sailfish

To use IPython terminal interface, type in Terminal :
$ ipython
If you have SymPy installed, see the topic "SymPy (Computer Algebra System) for Maemo 4 & 5 & MeeGo Harmattan & Sailfish", to load SymPy in interactive mode :
$ isympy

IPython Qt console doesn't work on Sailfish because it is not compatible with PyQt5 and Wayland.

To use IPython Notebook, type in Terminal :
$ ipython notebook
If "$BROWSER" variable has no content, it will show :
[NotebookApp] The IPython Notebook is running at: http://127.0.0.1:8888/
[NotebookApp] Use Control-C to stop this server and shut down all kernels.
[NotebookApp] No web browser found: could not locate runnable browser.
So you can open a web browser and point it to "http://127.0.0.1:8888/".

Or you can configure the $BROWSER variable by choosing one web browser, using Terminal and typing "export BROWSER=<pathname-to-web-browser>". To make this configuration automatic for :
- Sailfish native web browser, type in Terminal :
$ echo 'export BROWSER=/usr/bin/sailfish-browser' >> ~/.bash_profile
- Webcat from Jolla Store, type :
$ echo 'export BROWSER=/usr/bin/harbour-webcat' >> ~/.bash_profile
- but the (Android) Firefox web browser doesn't open by setting the $BROWSER variable with :
export BROWSER='/usr/bin/apkd-launcher /data/app/org.mozilla.firefox-1.apk org.mozilla.firefox/org.mozilla.firefox.App'
It seens IPython Notebook doesn't like complex content in $BROWSER variable.
Then reboot your Jolla (or run in Terminal "source ~/.bash_profile") so this configuration will take effect.

My analysis of the web browsers for Sailfish :
- Sailfish web browser (default web browser) was very slow in Sailfish 1.x, but since last releases it is the best web browser to open and edit IPython Notebooks, rendering MathJax (mathematical symbols) very well, graphics, etc. Editing cells works, but to edit non-Code cells, just convert to Code cells, edit, then revert the type of the cell. With Bluetooth keyboard, almost all the keyboard shortcuts works;
- Firefox (Android version) (TO UPDATE);
- Chrome (Android version) (TO UPDATE).

IPython Notebook on Sailfish can also run as a server for remote web clients (PC's, Nokia N900, Nokia N9, Android devices, etc), see post #19 of the topic "IPython (Notebook, QtConsole) 0.13.1 for MeeGo Harmattan".

IPython documentation :
- online in the IPython.org site;
- examples in "/usr/share/doc/ipython-doc-2.4.1/examples/" after installing in Terminal :
$ pkcon install ipython-doc

Some features of the IPython interactive shell :
- tab (or ctrl+i) completion for objects;
- input history navigation using up (or Ctrl+p) and down (or Ctrl+n) arrows;
- search input history by typing partial input then up/down arrow to show matching lines, or ctrl+r to have a serch prompt;
- input line n can be retrieved using '_in', 'In[n]', '_ih[n]', and _i, _ii, _iii to access the previous, next previous and next-next previous inputs;
- output line n can be retrieved using '_n', 'Out[n]', '_oh[n]', and _, __, ___ access the previous, next previous and next-next previous outputs;
- information about objects using '?word' or 'word?', full information with '??word' or 'word??';
- magic command system, like '%run file.py', '%pwd';
- run system commands with '!' as prefix, e.g., '!ls".
More details in :
IPython interactive tutorial
IPython Interactive Reference

More scientific Python modules

Sailfish OS also has last versions of SymPy (0.7.6.1), NumPy (1.9.1) and MatPlotLib (1.4.2), together with IPython terminal/Notebook they are a very powerful scientific suite for numerical, symbolical and graphical computations.
__________________
Python, C/C++, Qt and CAS developer. For Maemo/MeeGo/Sailfish :
Integral, Derivative, Limit - calculating mathematical integrals, derivatives and limits. SymPy - Computer Algebra System.
MatPlotLib - 2D & 3D plots in Python. IPython - Python interactive shell.
-- My blog about mobile & scientific computing ---
Sailfish : Sony Xperia X, Gemini, Jolla, Jolla C, Jolla Tablet, Nexus 4. Nokia N9, N900, N810.

Last edited by rcolistete; 2016-08-16 at 14:40. Reason: Updated to IPython 2.4.1
 

The Following 15 Users Say Thank You to rcolistete For This Useful Post:
Posts: 64 | Thanked: 36 times | Joined on Feb 2012 @ US
#2
That's some firepower...
 
Posts: 1,269 | Thanked: 3,961 times | Joined on May 2011 @ Brazil
#3
IPython 2.1.0 (21/05/2014), a bug fix release, is now (23/05/2014) available for Sailfish.

See the list of bug fixes of IPython 2.1.0 here.
__________________
Python, C/C++, Qt and CAS developer. For Maemo/MeeGo/Sailfish :
Integral, Derivative, Limit - calculating mathematical integrals, derivatives and limits. SymPy - Computer Algebra System.
MatPlotLib - 2D & 3D plots in Python. IPython - Python interactive shell.
-- My blog about mobile & scientific computing ---
Sailfish : Sony Xperia X, Gemini, Jolla, Jolla C, Jolla Tablet, Nexus 4. Nokia N9, N900, N810.
 

The Following 2 Users Say Thank You to rcolistete For This Useful Post:
Posts: 245 | Thanked: 233 times | Joined on May 2010 @ Ljubljana, Slovenia
#4
Tryed to install but fails because of missing python-pygments.

Since I have problem with store (no apps after latest update), can this be the reason?

Thanks,
b.
 

The Following User Says Thank You to sponka For This Useful Post:
Posts: 1,269 | Thanked: 3,961 times | Joined on May 2011 @ Brazil
#5
Originally Posted by sponka View Post
Tryed to install but fails because of missing python-pygments.
Thanks a lot, yes, it is a bug, my fault ! python-pygments isn't in default Jolla repositories, but in mer-tools repository which can be easily enabled.

So I copied the python-pygments rpm package to OpenRepos.net, so users without mer-tools enabled will be able to install IPython.

I did the same with python-curl (dependency of python-tornado) which is in mer-tools repository and is now also in OpenRepos.net.

Please open Warehouse, select "Check updates", then search for IPython to install it.
__________________
Python, C/C++, Qt and CAS developer. For Maemo/MeeGo/Sailfish :
Integral, Derivative, Limit - calculating mathematical integrals, derivatives and limits. SymPy - Computer Algebra System.
MatPlotLib - 2D & 3D plots in Python. IPython - Python interactive shell.
-- My blog about mobile & scientific computing ---
Sailfish : Sony Xperia X, Gemini, Jolla, Jolla C, Jolla Tablet, Nexus 4. Nokia N9, N900, N810.

Last edited by rcolistete; 2014-06-11 at 01:38.
 

The Following User Says Thank You to rcolistete For This Useful Post:
Posts: 1,269 | Thanked: 3,961 times | Joined on May 2011 @ Brazil
#6
1st post edited with new analysis of web browsers for IPython Notebook use. Firefox (Android) is the best one, followed by Webcat (for 1-2 page notebooks).
__________________
Python, C/C++, Qt and CAS developer. For Maemo/MeeGo/Sailfish :
Integral, Derivative, Limit - calculating mathematical integrals, derivatives and limits. SymPy - Computer Algebra System.
MatPlotLib - 2D & 3D plots in Python. IPython - Python interactive shell.
-- My blog about mobile & scientific computing ---
Sailfish : Sony Xperia X, Gemini, Jolla, Jolla C, Jolla Tablet, Nexus 4. Nokia N9, N900, N810.
 
Posts: 1,269 | Thanked: 3,961 times | Joined on May 2011 @ Brazil
#7
IPython 2.2.0 (06/08/2014), another bug fix release, is now (16/09/2014) available for Sailfish.

See the list of bug fixes of IPython 2.2.0 here.

The analisys of using Sailfish web browser with IPython Notebook is also updated.
__________________
Python, C/C++, Qt and CAS developer. For Maemo/MeeGo/Sailfish :
Integral, Derivative, Limit - calculating mathematical integrals, derivatives and limits. SymPy - Computer Algebra System.
MatPlotLib - 2D & 3D plots in Python. IPython - Python interactive shell.
-- My blog about mobile & scientific computing ---
Sailfish : Sony Xperia X, Gemini, Jolla, Jolla C, Jolla Tablet, Nexus 4. Nokia N9, N900, N810.

Last edited by rcolistete; 2014-09-17 at 01:48.
 

The Following 3 Users Say Thank You to rcolistete For This Useful Post:
Posts: 1,269 | Thanked: 3,961 times | Joined on May 2011 @ Brazil
#8
IPython 2.3.0 (01/10/2014), one more bug fix release, is now (02/10/2014) available for Sailfish.

See the list of bug fixes of IPython 2.3.0 here.

Updated the 1st post with new screenshots and details about configuring the $BROWSER variable so IPython Notebook can open the web browser automatically.
__________________
Python, C/C++, Qt and CAS developer. For Maemo/MeeGo/Sailfish :
Integral, Derivative, Limit - calculating mathematical integrals, derivatives and limits. SymPy - Computer Algebra System.
MatPlotLib - 2D & 3D plots in Python. IPython - Python interactive shell.
-- My blog about mobile & scientific computing ---
Sailfish : Sony Xperia X, Gemini, Jolla, Jolla C, Jolla Tablet, Nexus 4. Nokia N9, N900, N810.

Last edited by rcolistete; 2014-10-05 at 15:03. Reason: About 1st post updates
 

The Following 2 Users Say Thank You to rcolistete For This Useful Post:
Posts: 1 | Thanked: 2 times | Joined on Mar 2015
#9
Any chance to get Python 3 version? For example, on Jolla, you pull a lot of dependencies including Python 2 when installing IPython.
 

The Following 2 Users Say Thank You to wrobell For This Useful Post:
Posts: 337 | Thanked: 891 times | Joined on Jul 2012 @ Royaume Uni.
#10
I have no idea what any of that means, but, cool!
 
Reply


 
Forum Jump


All times are GMT. The time now is 16:00.