GDL kernel for Jupyter ?

239 views
Skip to first unread message

Edward Sternin

unread,
Oct 16, 2017, 7:26:54 PM10/16/17
to Project Jupyter
I am NOT python-competent at all, but I am very curious about other kernels within Jupyter environment.

I searched in vain for a gdl_kernel.py and its matching kernel.json.

$ jupyter kernelspec list
Available kernels:
  python3    /usr/local/share/jupyter/kernels/python3
  octave     /usr/share/jupyter/kernels/octave
  python2    /usr/share/jupyter/kernels/python2

How can I install additional kernels?  This is under RHEL 7, so "anaconda" is not an option, though pip is installed.

Any and all guidance will be appreciated.

Matthias Bussonnier

unread,
Oct 16, 2017, 11:53:46 PM10/16/17
to jup...@googlegroups.com
Hello Edward,

Thanks for your interest ! I'm curious of where/what GDL kernel you
are referring to, there is not many mentions of id beyond this one:

https://github.com/lstagner/idl_kernel

Which itself refer to the page of an official one
(https://www.harrisgeospatial.com/docs/IDL_Kernel.html). I'm not sure
where you've seen a gdl_kernel.py (I'm unfamiliar with IDL/GDL so I
may miss something for their docs). If you can point me to it that
would be helpful to narrow down your problem.

From the docs I can read (once the Python bridge is installed):

> Once IPython (Jupyter) has been installed, you need to install the IDL kernel. The IDL kernel can be found in:
> <IDL_DIR>/lib/bridges/kernels/IDL/kernel.json

You likely want to replace that by the following command:

$ jupyter kernelspec install <IDL_DIR>/lib/bridges/kernels/IDLl --user

But I guess that depends to the exact content of
<IDL_DIR>/lib/bridges/kernels/IDL

One that is done `jupyter kernelspec list` should list the IDL kernel
(the kernel may not be able to start, but it should at least be
listed).
The content of the kernel.json file may be helpful to figure out the
rest of the instruction (like what program it is attempting to start)
to give you more instructions.

Hope that helps a bit.
--
M
> --
> You received this message because you are subscribed to the Google Groups
> "Project Jupyter" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jupyter+u...@googlegroups.com.
> To post to this group, send email to jup...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jupyter/9352df6d-b0ad-4f88-aa0e-1759ee30ef21%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Edward Sternin

unread,
Oct 18, 2017, 2:09:28 PM10/18/17
to Project Jupyter
Thanks, Matthias.

Yes, https://github.com/lstagner/idl_kernel is the page I was referring to. In it, there is a statement:
   #This package is no longer maintained since IDL now has an official Jupyter kernel #IDL/GDL kernel for IPython/Jupyter
and the link is as you described.

What I failed to realize is that IDL is a commercial software. Once it is bought and installed, perhaps there will be a IDL_DIR with the appropriate file.

Because of the syntax (mostly) compatibility between the two (IDL & GDL), I was under the impression that the same .py file can be used to link up Jupyter and GDL, with possibly minor modifications, but perhaps I am being too simple-minded about what a Jupyter kernel actually is. I have never seen a gdl_kernel.py, I was hoping one existed somewhere.

I do not know much about python, but since Jupyter is trying to be a language-agnostic tool, which I like very much and would like to use in my teaching, I sort of assumed that a way to link a pipe to an external executable that would receive my text and return a tagged (html?) stream, a mixture of text and svg graphics, would be a matter of adjusting a configuration file, mostly. Isn't this what Jupyter does when the cell magic is set to %%bash, for example?

The instructions for installing a new kernel that I have found out there are universally inadequate. Under RHEL 7, I have access to pip, but not conda. Unfortunately, the simple-minded
  pip install gnuplot_kernel
to use an example, I have tried several, not one of them showing up under the list of Jupiter notebook kernels available. However, if I do this instead
pip install --upgrade --no-cache-dir git+https://github.com/has2k1/gnuplot_kernel.git@master
it works as expected! I have not yet discovered the equivalent solutions for other kernels, or how to make my own (to an external executable... see above).
$ pip list | grep kernel
gnuplot-kernel (0.2.3)
ipykernel (4.6.1)
metakernel (0.20.8)
octave-kernel (0.28.1)
scilab-kernel (0.8.1)

yet the Jupiter kernel drop down menu only lists Python, Python 3, and octave. And, after I re-did the installation as above, gnuplot, but no scilab, for example.

My interest is to unite several different legacy tools under one Jupyter "roof", and I want to use multiple kernels in a single notebook, though I am having trouble with that
right now: it seems that it's only possible if the "primary" kernel is python, because in my octave-kernel notebook, the command
%load_ext gnuplot-kernel
does not seem to be working for me, presumably because octave kernel does not have the load_ext functionality, like a python kernel does. Before I start looking into
writing custom kernel interfaces to my other tools, I need to make sure I understand and can make robust the installation process.

The gnuplot trick I found here:
https://github.com/has2k1/gnuplot_kernel/issues/5
together with the expressions of puzzlement of why it was needed, so I am not the only one confused.


Edward Sternin

unread,
Oct 18, 2017, 6:13:56 PM10/18/17
to Project Jupyter

I found another option, but is seems to be broken: https://github.com/ebellm/ipython-idlmagic

Now, after pip install pidly (v 0.2.7) I had to download https://raw.github.com/ebellm/ipython-idlmagic/master/idlmagic.py into the directory where I start "jupyter notebook". After that, %%idl is available, but crashes.
Auto Generated Inline Image 1

Matthias Bussonnier

unread,
Oct 20, 2017, 1:44:31 PM10/20/17
to jup...@googlegroups.com
Hi Edward, 

Thanks for your patience, I am traveling and I am just slowly catching up with email. 
There are a couple of confusion I believe. 

Yes Jupyter is language agnostic, though there is still a limited amount of work that need to be done per language for it to be Jupyter Compatible. 
Usually, (and there are of course exception), that mean that for each specific language you need to write a kernel wrapper in the host language. 
That is to say the Julia kernel is written in Julia, the R kernel in R, the ruby kernel in Ruby.... you see the pattern; in these case you will not install these using pip. There are a couple of exceptions (IDL seem to be one of them, there is also a R kernel in java). Usually you install the kernels and you need a "registration step", for R that will be the step 2 or 2 of the install instructions https://irkernel.github.io/installation/

There is also the an enforcement 1 notebook == 1 kernel; that does not mean you have to have 1 notebook == 1 language; you can have a multilingulal notebook, but that require a different integration than kernels. In particular what you might have seen is integration between IPython-kernel and other languages, the %%language syntax is specific to te Python kernel; and you need to teach IPython about each of the language independently. 


In you case you are right that it looks like the IDL kernel seem to be using  a pipe and seem to be compatible with gdl:
So using the idl_kernel.py file appeared to have worked some time in the past. So someone will have to dig into the idl_kernel source code install GDL and se what's happening. The fixes are probably not too hard; but would take time. What I would suggest is try to contact the people that make PRs to the idl kernel on github, or have a fork with modification:
https://github.com/lstagner/idl_kernel/networkask them if they use GDl and are interested in collaborating on reviving a fork.

I may try to have a look, but having never used IDL/GDL I may not be of much help (currently installing GDL, but I would not have high hopes). 

Thanks, 
-- 
Matthias


--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscribe@googlegroups.com.

To post to this group, send email to jup...@googlegroups.com.

Edward Sternin

unread,
Oct 25, 2017, 1:24:11 PM10/25/17
to Project Jupyter
Matthias, thank you for your willingness to try.

I did contact the author, but he feels that script is out of date and is not interested in GDL, as he has access to IDL.

I have both practical and fundamental interest in it, however.  I am planning to write a very similar interface to another "engine" using a similar principle: text commands in to CLI, a mixture of text/png graphics in return. I thought I would start with something known to works in the same way.

You are right, I am confused by the relationships between kernels and extensions.  Your message is the first time I see a "1 notebook == 1 kernel" principle stated plainly. I do not mind; but the idea of one notebook, many languages must prevail, or else the notebook format is useless to me. I find it somewhat distressing that everyone continues to refer to Jupyter as IPython: while I appreciate the origin of the tool, the reason I am interested has nothing to do with python itself. I guess, my expectation was one cell = one kernel; the language in which such a tool (Jupyter) itself is written is of no consequence.

I guess, a broader question is: if a kernel "abc" is installed and known to the notebook, shouldn't %%abc enable the execution of its code in any cell?

I also have not been able to make (some) extensions work.  For example, this works fine:
  %load_ext oct2py.ipython
  %%octave -f svg
 ...octave commands...
but this (after pip install git+git://github.com/mkrphys/ipython-tikzmagic.git)
  %load_ext tikzmagic
  %tikz \draw (0,0) rectangle (1,1);
fails instantly with a LaTeX error "! LaTeX Error: Missing \begin{document}." Since this is the very basic part of functionality, I assume it's not a bug in the extension code but in my use of it.

GDL installation is rather simple (unlike endless variations of pythonic installations - I use pip), and it tests standalone in minutes:
  $ gdl
  GDL> x = findgen(5)
  GDL> y = x^2.
  GDL> print, mean(y)
  GDL> plot, x,y
would check both text and graphics output, and the same commands in the %%idl cell should do exactly the same. If I can make it work, all I need is to change the name of the external executable, and the syntax of the commands passed to it, to "write" a new notebook extension.

Do you see any fundamental faults with my understanding of the process?

Edward Sternin

unread,
Nov 7, 2017, 7:59:42 PM11/7/17
to Project Jupyter

I found a bug in my installation of a LaTeX standalone.cls, so this now also works:

Edward Sternin

unread,
Nov 23, 2017, 1:30:48 PM11/23/17
to Project Jupyter
Alas, that's pretty much the only thing that works. The likzmagic is not ready for production use. In fact, of about 25 (working) tikz examples I tried, NONE rendered without error, and most errors were catastrophic, as in NOTHING got rendered.

Given the results of my testing, on multiple extensions, jupyter is really python.  Stepping outside of that is inviting major headaches. 

And that, of course, is also true for GDL.

Except Octave kernel seems OK, but that means a single-language worksheet, again.

What a disappointment.

Thomas Kluyver

unread,
Nov 24, 2017, 9:46:10 AM11/24/17
to Project Jupyter
There are several other kernels that work well and have an active community of users. The Julia, Haskell and R kernels are among the most used, I think. There are also third party cell magics that work pretty well, like R and Cython. Inevitably not every project in the ecosystem works as well, though.

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscribe@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages