Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IOCaml doesn't work with latest Jupyter? #37

Open
dsblank opened this issue Mar 4, 2016 · 20 comments
Open

IOCaml doesn't work with latest Jupyter? #37

dsblank opened this issue Mar 4, 2016 · 20 comments

Comments

@dsblank
Copy link

dsblank commented Mar 4, 2016

I finally got IOCaml started with Jupyter, but then it fails with a variety of issues, as if it doesn't really work with the latest Jupyter. Is this correct?

@andrewray
Copy link
Owner

A patch was provided by @signalpillar a couple of months ago that got it working with the latest Jupyter at that time.

Not sure how things have changed since then though.

@dsblank
Copy link
Author

dsblank commented Mar 4, 2016

Ok, thanks for the info. Do you know where I can find this patch?

@andrewray
Copy link
Owner

The patch was in #36, and is included in this repo and was released with opam.

@dsblank
Copy link
Author

dsblank commented Mar 4, 2016

Oh, ok. Then things aren't good. The first error I had was that the notebook didn't pass the test for the signed signature. I commented out that check, but it was in a bad state afterwards.

@Phyronnaz
Copy link

Try jupyter notebook --Session.key=''
Works for me on Jupyter 4.0.6

@signalpillar
Copy link

I also created this docker image https://hub.docker.com/r/signalpillar/ocaml-playground/
It contains the fixes.

@DhashS
Copy link

DhashS commented Mar 13, 2016

@signalpillar That Dockerfile no longer builds, this is the closest I got to one that does, but it still hits a zmq error.
https://gist.github.com/Aeolus0/9621119c62f48373bc2d

@andrewray
Copy link
Owner

I had a bit of a hack around with docker/jupyter and this Dockerfile works

https://gist.github.com/andrewray/a6e44c0ab497e8737dc2

@c-cube
Copy link

c-cube commented Nov 30, 2016

In a project of mine, I took some code from IOCaml to get a jupyter interface (for something that is not OCaml). I replaced the local bindings to zmq by libraries available on opam, used lwt, and nocrypto+hex to implement the support for signatures. If @andrewray is interested, it could be a good idea to move what I have into a separate repo/opam package ("jupyter-kernel", say) and use it in both our projects.

@andrewray
Copy link
Owner

Hey this is cool. I like the signature stuff very much.

Regarding zmq I deliberatly moved from the standard library in order to support v3 and v4 simultaneously, but if things have changed then perhaps its now the better solution.

Sharing code would be great, but the iocaml-server component (which to be fair I have not updated for a long while now) should be considered. It does not work with the newer jupyter specs.

@Naereen
Copy link

Naereen commented Dec 8, 2016

For Jupyter on Python3, the hack jupyter notebook --Session.key='' does not work any more, as '' is seen as an empty string and not an empty bytes, one should use jupyter notebook --Session.key='b""' instead (empty bytes b"").

@c-cube
Copy link

c-cube commented Dec 8, 2016

Indeed, I faced the same minor issue, and it's cleaner to implement hmac anyway.
@andrewray there are incompatible versions of zmq? or is v3/v4 referring to jupyter spec? I'm mostly interested in recent versions since that my distribution moves fast.

About iocaml-server, isn't it specific to having OCaml as a language? At least I think the generic kernel component ought to live in its own repository. I haven't updated everything yet (need to check mime data in particular). Lwt helps a lot though.

@c-cube
Copy link

c-cube commented Dec 8, 2016

Can't resist posting it: https://pbs.twimg.com/media/CzMC1PhW8AAHne9.jpg:large ^^
@andrewray the code is now isolated relatively cleanly in https://github.com/c-cube/stimsym/tree/master/src/ipython if you want to take a look.

@c-cube
Copy link

c-cube commented Dec 29, 2016

update: as of d7e4620e65d890f90c878449e06eb75033dafa3b , stimsym now supports version 5 of the protocol (mostly), including completion and the signature handling. It seems that jupyter-notebook can backward translate from protocol v5 to v4 if needed, so it should cover many use cases.

I propose that we create a jupyter-kernel library that would be standalone, relying on external libraries (lwt-zmq, lwt, nocrypto, hex, uuidm, etc.) for interacting with jupyter frontends. It should be useful both for iocaml and for other projects (including mine). If you (@andrewray) want, I can create it myself.

@andrewray
Copy link
Owner

My apologies, I have been extremely unhelpful here.

there are incompatible versions of zmq? or is v3/v4 referring to jupyter spec?

I was referring to the zmq protocol version. In the early days ocaml-zmq was broken quite a lot, and I was also fighting different distros with either v3 or v4 installed, so I knocked up a simple zmq interface which has worked well for me so far.

I can well believe the ocaml-zmq package is in better shape now, and zmq a bit more stable on distros, so moving to it shouldn't be a problem.

About iocaml-server, isn't it specific to having OCaml as a language?

Not really. It lacks the complete ipython server feature set (HMAC being one example), so was not really a good replacement for all other kernels out there, but for projects built in OCaml, and potentially using a library form of the iocaml-kernel, as you are doing, it should work.

Or at least it should work with the ancient protocol I implemented.

I propose that we create a jupyter-kernel library that would be standalone, relying on external libraries (lwt-zmq, lwt, nocrypto, hex, uuidm, etc.)

This is certainly looking like a good idea now.

If you (@andrewray) want, I can create it myself.

You've certainly put a good bit more effort into this than I have recently...so you are welcome to do it yourself if you prefer. I am willing to set this up myself though, and if you prefer this option, I will open a separate issue so we can discuss the best way to structure it (looking towards moving iocaml+kernel+js+server to ijupyter+kernel+lib+js+server+external projects).

@c-cube
Copy link

c-cube commented Dec 29, 2016

Ok, I think I will create a repo for the kernel library (relying on 3rd party libs and my own work, + what I copied and modified from yours). Then, on this repo, we can discuss things in more details. Do you want to create an organization as well, or create the repo under your own name, since most of the code (especially the json specs) is yours?

@andrewray
Copy link
Owner

Ok cool. Doing it under a new organisation where we could keep related projects (ie an ocaml kernel and, hopefully, a new server) seems a good idea.

@c-cube
Copy link

c-cube commented Dec 29, 2016

ok. How about ocaml-jupyter for the org name?

@andrewray
Copy link
Owner

sounds good.

@c-cube
Copy link

c-cube commented Dec 30, 2016

Here we go: https://github.com/ocaml-jupyter/jupyter-kernel . We can stop hijacking this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants