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

cadabra jupyter kernel #4185

Open
haraldschilly opened this issue Oct 22, 2019 · 29 comments
Open

cadabra jupyter kernel #4185

haraldschilly opened this issue Oct 22, 2019 · 29 comments
Assignees

Comments

@haraldschilly
Copy link
Contributor

see kpeeters/cadabra2#125 (comment)

how to setup cadabra jupyter?

@kpeeters
Copy link

Jupyter kernel build instructions for Cadabra are at https://github.com/kpeeters/cadabra2/blob/master/JUPYTER.rst . Please ask if you get stuck (this hasn't had a lot of real world exposure).

@haraldschilly
Copy link
Contributor Author

Helloo @kpeeters ... I've finally had time to look into this. I understand this depends on the anaconda setup and well, I didn't take the time to follow this in detail. It's also bad to have manual work for something like that (hard to fix later, etc.)

However, did you ever look into creating a feedstock for conda-forge? I think this shouldn't be too hard, and then I (and many others) could just install all this as a package and just have to take care of the jupyter kernel file.

Ref: conda forge doc

@kpeeters
Copy link

Eventually that's probably going to happen, but at the moment I simply don't have enough time to get that sorted. Will ping you if we ever get there.

@kpeeters
Copy link

kpeeters commented Apr 1, 2020

@haraldschilly There is now an experimental conda package for the cadabra jupyter kernel, which you can install with conda install cadabra2-jupyter-kernel -c kpeeters. Are you able to test whether this works as intended? (after installation, the Jupyter should offer the option of creating a notebook with the Cadabra kernel as backend).

I had quite a battle with conda dependencies so I may well have done something silly, but it installs fine on a clean miniconda installation, as far as I can see.

If you'd rather wait until this is in conda-forge I understand, but that will probably still take a while.

@isuruf
Copy link

isuruf commented Apr 5, 2020

@kpeeters, is there a way to install both the regular cadabra2 package and cadabra2-jupyter-kernel. It seems like enabling the jupyter kernel disables some features.

@kpeeters
Copy link

kpeeters commented Apr 5, 2020

@isuruf do you mean the cadabra2 command line client? I could probably distribute that with the cadabra2-jupyter-kernel package. There is no separate cadabra2 package for conda (and given the pain that packaging on conda causes, I'm not sure I want to go that route either). If you are looking to run cadabra2-gtk (that is, Cadabra's own notebook interface), then you are much better off just installing a .deb or .rpm from the Cadabra downloads page.

@isuruf
Copy link

isuruf commented Apr 5, 2020

@kpeeters
Copy link

kpeeters commented Apr 5, 2020

Try packing sepately first. Last time I tried, the gtkmm in conda was in a very sorry state, essentially useless. Hence I def'd out things which are not needed for the kernel, just to get it to build.

Again, you don't gain much (or anything at all) by using conda for cadabra2-gtk over standard system packages. The conda recipe will certainly not work on windows (if that was your goal).

@isuruf
Copy link

isuruf commented Apr 5, 2020

I've got an experimental package.

conda create -n cadabra2 cadabra2 -c isuruf/label/cadabra2 -c conda-forge

@kpeeters
Copy link

kpeeters commented Apr 5, 2020

You should be able to just rip those ifdef things out of the CMakeLists.txt to enable building everything (we can do it properly once it works).

Can you show me your meta.yaml? I have been ripping my hair out over some of the build requirement specifications; I still haven't been able to make it pick up glibmm properly using pkg-config.

@isuruf
Copy link

isuruf commented Apr 5, 2020

@kpeeters
Copy link

kpeeters commented Apr 5, 2020

And that finds glibmm at the stage where the CMakeLists.txt runs pkgconfig --clfags glibmm-2.4? Bizarre.

By the way, does it really make sense to build the jupyter kernel into the same package? Usually you want one of the two: either you work with the jupyter interface, or you work with the native interface. Making jupyter a requirement of the native interface pulls in a lot of extra unused packages.

@isuruf
Copy link

isuruf commented Apr 5, 2020

And that finds glibmm at the stage where the CMakeLists.txt runs pkgconfig --clfags glibmm-2.4?

Yes. Your recipe didn't have glibmm in host. pkg-config in build only looks at dependencies in host as it should.

By the way, does it really make sense to build the jupyter kernel into the same package? Usually you want one of the two: either you work with the jupyter interface, or you work with the native interface. Making jupyter a requirement of the native interface pulls in a lot of extra unused packages.

Yes, ideally I would like to see 3 packages.

  1. cadabra2 (core stuff, python)
  2. cadabra2-gtk (depends on cadabra2)
  3. cadabra2-jupyter-kernel (depends on cadabra2)

But the cmake file doesn't allow anything like that. Next best thing is to have it all together instead of 2 packages that conflict with each other.

@kpeeters
Copy link

kpeeters commented Apr 5, 2020

You can do it like that if you decide which elements to pick from the installation, depending on which sub-package you are building. I think conda allows you to build different packages by simply picking stuff from the installation directories, but I may be wrong there.

I think that it is possible to remove the if(NOT ENABLE JUPYTER) for the cadabra2cadabra, cadabra2html, cadabra2latex parts (I simply left these out originally because I wanted to build only the minimal material necessary for a kernel).

@kpeeters
Copy link

kpeeters commented Apr 6, 2020

If it makes your life easier to make me merge those changes into master, and/or do a proper tagged release, let me know. Would be nice to have a proper conda package in conda-forge. Thanks for your help!

@isuruf
Copy link

isuruf commented Apr 7, 2020

Yes, please. That'd make it easier for me.

Two tests fail on the conda package. Those are tracked at https://github.com/conda-forge/cadabra2-feedstock/issues

You can now do conda install cadabra2 -c conda-forge to get the core and gtk based notebook. I might remove the gtk parts to a separate package.

I have a question. Does cadabra2-jupyter-kernel need any of the other executables? Or is it just the python module?

@kpeeters
Copy link

kpeeters commented Apr 7, 2020

cadabra2-jupyter-kernel only needs the bin/cadabra-jupyter-kernel binary and the stuff which is installed in ${PREFIX}/share/cadabra2/python (which includes the cadabra2.so python module in python). And the kernel config files of course. The other binaries are not needed

@kpeeters
Copy link

kpeeters commented Apr 7, 2020

I have pushed some changes to master which make the build process produce all binaries even when ENABLE_JUPYTER is set. It also includes that patch for linking to system jsoncpp.

Can you try this one, and let me know if you want any other changes to make the conda-forge files as clean as possible? I will then do a 2.3.0 release and upload it as an asset so you can rely on the sha256 too.

Leave those two self-tests for now, I will need to look into that but am a bit short on time at the moment. It won't make a difference for the vast majority of users.

@kpeeters
Copy link

kpeeters commented Jun 3, 2020

@isuruf, is there any update on this? If you want me to make any further changes, please do let me know.

@isuruf
Copy link

isuruf commented Jun 3, 2020

@kpeeters, if I build both the gtk notebook and the jupyter kernel in the same build, then the gtk notebook crashes. Not entirely sure what the reason is. If I build just the gtk notebook, it works fine.

@kpeeters
Copy link

kpeeters commented Jun 3, 2020

@isuruf, ah, yes, you mentioned that. I'll have a look tomorrow, I think I know what is happening.

@kpeeters
Copy link

kpeeters commented Jun 4, 2020

I have pushed a fix for this to github master. If it does the trick for you too, then I'll release 2.4.0 so you can refer to something stable. Let me know.

@kpeeters
Copy link

kpeeters commented Jun 4, 2020

For some reason, when I build on my machine with a clean miniconda install, doing jupyter notebook and then creating a new notebook with a Cadabra kernel makes the kernel complain about

cadabra-jupyter-kernel: error while loading shared libraries: libxeus.so.1: cannot open shared object file: No such file or directory

Can you check this? I built the thing package using a build.sh and meta.yaml which are based on yours; you can see them in the conda subdirectory. May have overlooked some libxeus dependency or similar.

@kpeeters
Copy link

kpeeters commented Jun 4, 2020

Found it: you need xeus as run-time dependence, not just build-time, as it comes with a that shared library. After that all works fine (command line cadabra2, native ui cadabra2-gtk and jupyter notebook with cadabra kernel) from the same package.

@kpeeters
Copy link

kpeeters commented Jun 4, 2020

One more: are you able to extend this so it builds on macOS too? Getting windows support would be even better (in principle it all builds and works, but I can well imagine that not all those dependencies are available in conda for windows yet).

@isuruf
Copy link

isuruf commented Jun 4, 2020

Yes, we already have a cadabra2 macos package on conda-forge. (just the gtk2 notebook though)
I don't know what the windows status is though.

@kpeeters
Copy link

kpeeters commented Jun 5, 2020

I have given it a shot on windows but there is a long list of packages which are not available in conda for windows (mostly gtkmm and friends, but also a few others which need work/transitioning, like gmp and libuuid). So Linux and macOS for now.

@isuruf
Copy link

isuruf commented Jun 6, 2020

Yes, latest master works for me. Here's my recipe now, conda-forge/cadabra2-feedstock#7. Comments and suggestions welcome.

@kpeeters
Copy link

Given that the conda-forge package is now live, is there any chance of getting the cadabra kernel installed on cocalc? Thanks!

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

No branches or pull requests

3 participants