An IJulia Preview

2,210 views
Skip to first unread message

Steven G. Johnson

unread,
Aug 6, 2013, 9:48:35 PM8/6/13
to julia...@googlegroups.com, Fernando Perez
As some of you know, several of us have been working on hooking up a Julia backend to the IPython front-end, a combination that we've come to call "IJulia".  This will give Julia users access to IPython's beautiful interface, powerful networking and interoperability features, and rich multimedia display.

I'm happy to say that much of the basic functionality is now working, and I've put together a little IJulia notebook demo, which you can view here:

       http://nbviewer.ipython.org/url/jdj.mit.edu/~stevenj/IJulia%2520Preview.ipynb

(Thanks especially to Fernando Perez for his help and for bringing Jeff, Stefan and I to the IPython developer workshop in Berkeley a couple of weeks ago, and to the IPython developers Matthias Bussonnier and Min RK for continual advice and patches.)

Warning: installing IJulia right now (https://github.com/JuliaLang/IJulia.jl) is not easy for casual users.  You need bleeding-edge (git master) versions of a whole bunch of packages in addition to git master of Julia and IPython.  However, I expect this to get easier shortly, once the following are addressed:

* The ZMQ and JSON packages need to be updated in METADATA; the latest versions break backwards compatibility, so several other packages will need to be updated.
* GnuTLS needs to be updated in METADATA.
* The tab-completion functionality of loladiro's experimental REPL.jl package needs to be split into its own package and added to METADATA.
* IJulia needs to be converted into a proper Pkg and have its dependencies set up.
* Julia pull requests #3949 and especially #3932 need vetting and merging.

#3932 (https://github.com/JuliaLang/julia/pull/3932) in particular will be a major new functionality in Julia.  By itself, the patch doesn't do much, but it provides a mechanism to (a) allow user-defined types to define how to export themselves to arbitrary MIME types and (b) to separately define multimedia backends capable of displaying these types.

So, a package like Winston will only need to define a couple of writemime methods in order to specify how its plots can be exported to image/png and image/svg+xml (for example).  The implementation of a backend capable of displaying this information can be entirely separate (via Tim Holy's ImageView package, for example), and IJulia will provide a baseline capable of displaying HTML, LaTeX, and several image formats.  So, Winston doesn't need to worry about Tk, Gtk, or whatever windowing system.  (One can implement a windowing-based backend specifically for Winston which allows a richer UI, such as mouse-control of zooming and panning, but this can be done in an entirely separate package.)  And I expect that lots of other packages will want to enable display of their types as formatted text (via HTML), equations (via LaTeX), and so on.

--SGJ

Elliot Saba

unread,
Aug 6, 2013, 10:58:52 PM8/6/13
to julia...@googlegroups.com, Fernando Perez
This is really amazing.  Incredible work, every time I look at how that @pyimport magic syncs up with what you've done with PyPlot, my jaw drops.  I can't wait to start using this in my research!
-E

Stefan Karpinski

unread,
Aug 6, 2013, 11:24:16 PM8/6/13
to julia...@googlegroups.com, Fernando Perez
Yes, this is really amazing. Thanks, Steven for carrying through the work we started the other week in Berkeley. It's really panned out well.

Viral Shah

unread,
Aug 7, 2013, 1:05:28 AM8/7/13
to julia...@googlegroups.com, Fernando Perez
This truly is awesome. Thanks Steve, and everyone else working on this. Once all the issues Steve talks about are addressed, I am going to try and see if we can provide hosted julia on AWS. It would be a great experience for anyone wanting to try julia.

-viral

Tim Holy

unread,
Aug 7, 2013, 3:10:59 AM8/7/13
to julia...@googlegroups.com
I'm _extremely_ excited about this, and I'll definitely be trying it once I get
a bit of free time.

Regarding ZMQ and JSON and packages that depend on them, this looks like a
great opportunity to exercise the package manager's dependency-version
resolution mechanism. We should set the requires files for existing packages to
versions prior to the break, and then create new versions that use the new
libraries.

--Tim

Matthias Bussonnier

unread,
Aug 7, 2013, 4:08:13 AM8/7/13
to julia...@googlegroups.com, Fernando Perez
Hey guys,

Really happy to see how fast you were able to integrate julia with all IPython
protocol. It was really a fun week to work with you and I'm looking forward 
to see the IJulia 1.0.

As a new julia user I woudl like to say that having IJulia working was not **that** hard.
But I'm more confortable on IPython side :-)

I like to say that you are really lucky as you have the chance to built most of this things directly
into the language itself which is a real plus, and you will most likely comme up with much better
abstraction than we do in IPython for some things. And you input on that is really appreciated.

Just a small precision on in demo-notebook.

The highlighting is off but can be fixed more easily on nbviewer than in live notebook
as it is done in server side with pygments and there is already a julia theme for pygment.
But, we need to find a way to tag julia notebook so that nbviewer know the highlight to use.

Also, a small correction:

> MIME types not handled by the IPython notebook (such as video or audio).

which is not totally true, you just need to wrap it in html.

audio embeded in notebook :

and video

Cheers, 
-- 
Matthias

Steven G. Johnson

unread,
Aug 7, 2013, 8:34:49 AM8/7/13
to julia...@googlegroups.com, Fernando Perez

On Wednesday, August 7, 2013 4:08:13 AM UTC-4, Matthias Bussonnier wrote:
I like to say that you are really lucky as you have the chance to built most of this things directly
into the language itself which is a real plus, and you will most likely comme up with much better
abstraction than we do in IPython for some things.

Yes, it is a big advantage to be doing this in the early stages of Julia, so that if the language or standard library has a problem we can just change it.
 
The highlighting is off but can be fixed more easily on nbviewer than in live notebook
as it is done in server side with pygments and there is already a julia theme for pygment.
But, we need to find a way to tag julia notebook so that nbviewer know the highlight to use.

I  agree; in later IPython versions we should add some kind of metadata to the notebook to indicate the kernel etc. that it goes with.

It would be very helpful if someone who was involved in writing the Julia mode for various editors could work on the syntax highlighting etc. in IJulia:

https://github.com/JuliaLang/IJulia.jl/issues/17
https://github.com/JuliaLang/IJulia.jl/issues/18

Any volunteers?

Matthias BUSSONNIER

unread,
Aug 7, 2013, 9:22:10 AM8/7/13
to julia...@googlegroups.com, Fernando Perez
Le 7 août 2013 à 14:34, Steven G. Johnson a écrit :


On Wednesday, August 7, 2013 4:08:13 AM UTC-4, Matthias Bussonnier wrote:
I like to say that you are really lucky as you have the chance to built most of this things directly
into the language itself which is a real plus, and you will most likely comme up with much better
abstraction than we do in IPython for some things.

Yes, it is a big advantage to be doing this in the early stages of Julia, so that if the language or standard library has a problem we can just change it.

I guess this include sending tracebacks as tokens instead of stings and some other stuff like
that where in IPython those are string with escape sequences we need to tokenize afterward...

 
The highlighting is off but can be fixed more easily on nbviewer than in live notebook
as it is done in server side with pygments and there is already a julia theme for pygment.
But, we need to find a way to tag julia notebook so that nbviewer know the highlight to use.

I  agree; in later IPython versions we should add some kind of metadata to the notebook to indicate the kernel etc. that it goes with.

This is already planed with a top level key that will be called language IIRC. 
you can already right now set notebook.metadata.language = julia if you wish as metadata can be arbitrary. 
Tools like nbviewer can be updated to support it afterward. Once IJulia is more mature, I suppose you'll send 
it with an IPython profile with some default conf, I'll show you how to load an extension that does it automatically
for you.


It would be very helpful if someone who was involved in writing the Julia mode for various editors could work on the syntax highlighting etc. in IJulia:

https://github.com/JuliaLang/IJulia.jl/issues/17
https://github.com/JuliaLang/IJulia.jl/issues/18

Any volunteers?

-- 
Matthias

Viral Shah

unread,
Aug 7, 2013, 9:30:22 AM8/7/13
to julia...@googlegroups.com

Is there support in ipynb for hooking into the profiler?

-viral

Matthias BUSSONNIER

unread,
Aug 7, 2013, 9:37:44 AM8/7/13
to julia...@googlegroups.com
Le 7 août 2013 à 15:30, Viral Shah a écrit :

Is there support in ipynb for hooking into the profiler?

Not sure I understand what you mean. 
I probably don't pay attention to the vocabulary I use. 

For me .ipynb is a json structure that contains data which are text use in the input of the cell 
and representation of output value. So there is no real notion of execution in ipynb, beyond the fact that one input did produce an output.
-- 
Matthias

Viral Shah

unread,
Aug 7, 2013, 9:42:37 AM8/7/13
to julia...@googlegroups.com

What I meant to ask is whether ipynb understands how to format a backtrace, output of the performance profiler, or a debugger when we have one.

Currently these can all be strings, but the output could be prettier.

-viral

Steven G. Johnson

unread,
Aug 7, 2013, 9:50:03 AM8/7/13
to julia...@googlegroups.com
On Wednesday, August 7, 2013 9:22:10 AM UTC-4, Matthias Bussonnier wrote:
Yes, it is a big advantage to be doing this in the early stages of Julia, so that if the language or standard library has a problem we can just change it.

I guess this include sending tracebacks as tokens instead of stings and some other stuff like
that where in IPython those are string with escape sequences we need to tokenize afterward...


We already have that information, since the code to show the traceback as a string, like most of the Julia standard library, is written in Julia; it would be easy to write a version that sends a lists of filenames (= input cells in IJulia) and line numbers instead if you update your pyerr message format to use that data. 

> you can already right now set notebook.metadata.language = julia if you wish as metadata can be arbitrary.

Where is this done, in profile_julia/ipython_config.py?


Steven G. Johnson

unread,
Aug 7, 2013, 9:52:32 AM8/7/13
to julia...@googlegroups.com


On Wednesday, August 7, 2013 9:42:37 AM UTC-4, Viral Shah wrote:

What I meant to ask is whether ipynb understands how to format a backtrace, output of the performance profiler, or a debugger when we have one.

Currently these can all be strings, but the output could be prettier.


No.  Backtraces are currently lists of strings, but as Matthias alluded to they are looking at changing this.

For the profiler, I'm not sure why the notebook needs to care about this.  Can't the profiler data be just another Julia type?  Then you can write whatever rich representation (e.g. and HTML table or whatever) by adding writemime functions for that type.

Matthias BUSSONNIER

unread,
Aug 7, 2013, 10:18:48 AM8/7/13
to julia...@googlegroups.com
Slightly more complicated you'll have to inject some javascript that would be run at notebook load time.

something around the following should work.

profile_julia/static/custom/custom.js

$([IPython.events]).on('notebook_loaded.Notebook', function(){
    IPython.notebook.metadata.language = 'julia';
})

Elliot Saba

unread,
Aug 7, 2013, 12:04:10 PM8/7/13
to julia...@googlegroups.com

I'll take a look at the syntax highlighting. I rewrote the textmate syntax highlighting as one of the my first ever contributions. It'll be nice to come full circle. ;)

Brian Granger

unread,
Aug 7, 2013, 1:44:23 PM8/7/13
to julia...@googlegroups.com, Fernando Perez
Congrats, this is really exciting!

Cheers,

Brian (IPython dev)

Steven G. Johnson

unread,
Aug 9, 2013, 12:28:45 AM8/9/13
to julia...@googlegroups.com, Fernando Perez
On Tuesday, August 6, 2013 9:48:35 PM UTC-4, Steven G. Johnson wrote: 
Warning: installing IJulia right now (https://github.com/JuliaLang/IJulia.jl) is not easy for casual users.  You need bleeding-edge (git master) versions of a whole bunch of packages in addition to git master of Julia and IPython.  However, I expect this to get easier shortly, once the following are addressed:

This should be considerably easier now than it was a few days ago.  IPython 1.0 has been officially released, and I've just posted an IJulia package to METADATA.

So, assuming you have installed IPython 1.0 (and probably the jinja2 Python package if you want to use the notebook interface), you can just do:

Pkg2.update()
Pkg2.add("IJulia")

and this should install various packages and the necessary configuration settings for you to simply run

ipython notebook --profile julia

I'm sure there will be a few kinks in the dependency resolution, but as people bang on it over the next couple of weeks I hope these can be resolved quickly.

--SGJ

John Myles White

unread,
Aug 9, 2013, 9:50:39 AM8/9/13
to julia...@googlegroups.com
Awesome. Tried doing this and saw the error I found late last night in the build script: my version of iPython reports a version string that's not in the format you use:

jmwmacbookpro:ipython johnmyleswhite$ ipython --version
1.0dev

 -- John

Stefan Karpinski

unread,
Aug 9, 2013, 10:06:29 AM8/9/13
to Julia Users
That's probably pretty common – maybe our version parser should be a little more lenient and interpret suffixes with no separator as pre-release versions. On the other hand, IPython should probably use version strings that conform to the semver.org spec (I think when I asked, Brian and/or Fernando said they were using semantic versioning).

Stefan Karpinski

unread,
Aug 9, 2013, 10:09:12 AM8/9/13
to Julia Users
Ah, I see that the development version of IPython is already using a semver format:

$ IPython/scripts/ipython --version
2.0.0-dev

Matthias Bussonnier

unread,
Aug 9, 2013, 10:23:00 AM8/9/13
to julia...@googlegroups.com
Yes, had some issues where the 'dev' suffix was replacing the 'patch' number in semver. Was fix during berkley meeting IIRC. 
Should not happens anymore. 

Maybe just got repo tag that might start with rel-$version

Envoyé de mon iPhone

Stefan Karpinski

unread,
Aug 9, 2013, 10:27:27 AM8/9/13
to Julia Users, Fernando Perez
This is great – I just deleted my existing copy of IJulia and reinstalled via Pkg2 and everything was completely smooth. Love the IJulia logo in the corner too :-)

Matthias BUSSONNIER

unread,
Aug 9, 2013, 10:38:59 AM8/9/13
to julia...@googlegroups.com, Fernando Perez

Le 9 août 2013 à 16:27, Stefan Karpinski a écrit :

> This is great – I just deleted my existing copy of IJulia and reinstalled via Pkg2 and everything was completely smooth. Love the IJulia logo in the corner too :-)

Tooltip for mutating function too ?

can you check the notebook metadata to see if there is the "language":"julia" field (head <the file> should be enough, or `IPython.notebook.metadata` in a js console)

--
M

Blake Johnson

unread,
Aug 9, 2013, 10:44:53 AM8/9/13
to julia...@googlegroups.com, Fernando Perez
This worked smoothly for me, including inline plots via your PyPlot module. Awesome work!

--Blake

Randy Zwitch

unread,
Aug 9, 2013, 11:06:23 AM8/9/13
to julia...@googlegroups.com
Install was as smooth as can be for me on OSX, very impressive!


On Tuesday, August 6, 2013 9:48:35 PM UTC-4, Steven G. Johnson wrote:

Viral Shah

unread,
Aug 9, 2013, 1:13:05 PM8/9/13
to julia...@googlegroups.com
The only hiccup I had was to install tornado. Otherwise, very smooth. I am already dreaming about interactive zooming and panning of arrays and dataframes.

-viral

Stefan Karpinski

unread,
Aug 9, 2013, 3:01:29 PM8/9/13
to julia...@googlegroups.com
Those features will require significant additional infrastructure in the IPython protocol but it is planned for 2.0 I believe.

Matthias BUSSONNIER

unread,
Aug 9, 2013, 3:29:24 PM8/9/13
to julia...@googlegroups.com

Le 9 août 2013 à 21:01, Stefan Karpinski a écrit :

> Those features will require significant additional infrastructure in the IPython protocol but it is planned for 2.0 I believe.

Yes, we will try to have basic example of bidirectional communication js<->kernel, but we will probably leave the implementation
of specific plugin like panning zooming of DataFrame into extensions :-)

Randy Zwitch

unread,
Aug 9, 2013, 4:12:53 PM8/9/13
to julia...@googlegroups.com, Fernando Perez
There might actually be a hiccup...when I open IPython notebook to use for Python, I still get the Julia logo in my profile_default profile.

Patrick O'Leary

unread,
Aug 9, 2013, 4:17:12 PM8/9/13
to julia...@googlegroups.com, Fernando Perez
Already identified and fixed (or at least worked around): https://github.com/JuliaLang/IJulia.jl/issues/41

Pablo Winant

unread,
Aug 11, 2013, 10:22:49 PM8/11/13
to julia...@googlegroups.com, Fernando Perez
Hi guys,

I have followed these simple instructions and installation works just fine. However, if I run "ipython console --profile=julia" it apparently launches a kernel but I can't communicate with it. Do you know what can be wrong, or how can I investigate the problem ? I don't even know on wich side (julia, ipython) the problem occurs.

Best,

Pablo

PS. here is the output I get :


~/.julia/IJulia/src$ ipython console --profile=julia

Python 2.7.5 |Anaconda 1.6.1 (64-bit)| (default, Jun 28 2013, 22:10:09)
Type "copyright", "credits" or "license" for more information.

IPython 1.0.0 -- An enhanced Interactive Python.

IPython profile: julia
Starting kernel event loops.

Amit Murthy

unread,
Aug 11, 2013, 11:44:45 PM8/11/13
to julia...@googlegroups.com
Same issue as Pablo.

Both the Web interface and the QT interface do not work for me. The QT interface is unresponsive while the Web interface accepts input but does not print any responses.

Latest Julia build, fresh .julia, installed IJulia using Pkg2.


julia> versioninfo()
Julia Version 0.2.0-prerelease+3177
Commit c8a536e 2013-08-11 20:48:20 UTC
Platform Info:
  System: Linux (x86_64-linux-gnu)
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY)
  LAPACK: libopenblas
  LIBM: libopenlibm



Amit Murthy

unread,
Aug 12, 2013, 3:32:36 AM8/12/13
to julia...@googlegroups.com
Managed to get it working.

- Ubuntu system repositories install zmq version 2.x. Had to manually install zeromq version 3.2.3 
- Ubuntu system only had libgnutls26 installed. Also installed libgnutls28.
- Ran Pkg2.fixup()




Steven G. Johnson

unread,
Aug 12, 2013, 8:17:20 AM8/12/13
to julia...@googlegroups.com
On Monday, August 12, 2013 3:32:36 AM UTC-4, Amit Murthy wrote:
- Ubuntu system repositories install zmq version 2.x. Had to manually install zeromq version 3.2.3 
- Ubuntu system only had libgnutls26 installed. Also installed libgnutls28.

Are you sure that the libzmq upgrade was needed, and the problem wasn't just the libgnutls?

Steven G. Johnson

unread,
Aug 12, 2013, 8:36:52 AM8/12/13
to julia...@googlegroups.com, Fernando Perez


On Sunday, August 11, 2013 10:22:49 PM UTC-4, Pablo Winant wrote:
I have followed these simple instructions and installation works just fine. However, if I run "ipython console --profile=julia" it apparently launches a kernel but I can't communicate with it. Do you know what can be wrong, or how can I investigate the problem ? I don't even know on wich side (julia, ipython) the problem occurs.

Try setting verbose=true at the top of .julia/IJulia/src/IJulia.jl

Tracy Wadleigh

unread,
Aug 12, 2013, 9:35:00 AM8/12/13
to julia...@googlegroups.com
I was having a similar issue on Ubuntu. I was able to get past it by following Amit's instructions, but without the need for upgrading zmq. That is, I:
 - installed libgnutls28-dev
 - ran Pkg2.fixup()

Colm Ryan

unread,
Aug 12, 2013, 9:55:29 AM8/12/13
to julia...@googlegroups.com
Installing libgnutls28 on Mint 15 was sufficient.  Building pyzmq against either the system zmq 2.x or the bundled 3.x works. 

Amit Murthy

unread,
Aug 12, 2013, 10:09:49 AM8/12/13
to julia...@googlegroups.com
Initially I did not have libzmq on the system and "easy_install ipython[all]" was unable to install the bundled libzmq. Then I installed libzmq via Ubuntu's synaptic package manager. Figured out on cross-checking with Viral's system that I had an older version of libzmq. So uninstalled from Ubuntu and did a manual install.

Then I did the libgnutls28 install.

While I cannot be absolutely sure that the older version of libzmq was a problem, I am certain that the easy_install of ipython had a problem installing the bundled libzmq.

Pablo Winant

unread,
Aug 12, 2013, 1:15:35 PM8/12/13
to julia...@googlegroups.com
Same thing worked for me. Updating libgnutls was enough on ubuntu 13.10. Now it works like a charm.

Matthias BUSSONNIER

unread,
Aug 12, 2013, 2:23:31 PM8/12/13
to julia...@googlegroups.com
Hi all,

To emacs user,

I don't know how many of you are emacs user, but you might be interested in
the fact that emacs should be able to speak to IJulia-notebook and have inline plot.

https://github.com/tkf/emacs-ipython-notebook

I am not an emacs user, so I can't tell you how easy this is to install,
or how much the mode assume python for highlighting and so on.


To vim users,

Nobody wrote a web socket library for vim, but you should still be able to
connect directly to IJulia Kernel with vim-IPython

https://github.com/ivanov/vim-ipython

I personally was not able to install it on OS X but did not tried a lot.

To other, and all,

I've heard of other plugin for other text-editor (like sublime) so you might be able to find
something that also suits you.

Hope this will be informative for some of you.
--
Matthias
Reply all
Reply to author
Forward
0 new messages