Git Product home page Git Product logo

macaulay2-jupyter-kernel's Introduction

M2JK — Jupyter kernel for Macaulay2

Beta Testing!

You can now use Jupyter (Notebook or Lab) as a front-end for Macaulay2.

See the demo for sample use and an outline of the kernel-specific features. For bugs or requests, open an issue. For recent changes, see the changelog.

Requirements

You need a recent version of Python and pip. Python 3 is recommended for build installs and necessary for source installs. You can install Jupyter directly from PyPI by

pip3 install --upgrade pip
pip3 install jupyter

Macaulay2 needs to be installed and on your path. If you are using Emacs as your front-end, it already is, but you can test it by which M2. Otherwise, you can achieve that by running setup() from within an M2 session. Alternatively, you can configure M2JK to use a specific binary.

Installation

You can install the latest release version directly from PyPI by

$ pip3 install macaulay2-jupyter-kernel
$ python3 -m m2_kernel.install

Alternatively, you can install the latest development version from source by

$ git clone https://github.com/radoslavraynov/macaulay2-jupyter-kernel.git
$ cd macaulay2-jupyter-kernel
$ pip3 install .
$ python3 -m m2_kernel.install

Docker

A docker image packing v0.6.7-beta and Macaulay2 version 1.13 is available as rzlatev/m2jk. To run locally, you need to map port 8890.

$ docker run -p 8890:8890 rzlatev/m2jk &

Running the notebook

Once the installation is complete, you need to start (or restart) Jupyter by

$ jupyter notebook &

This shoud fire up a browser for you. If not, copy the output URL into one. Then select File ⇨ New Notebook ⇨ M2 from the main menu.

License

This software is not part of Macaulay2 and is released under the MIT License.

macaulay2-jupyter-kernel's People

Contributors

rz-c avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

macaulay2-jupyter-kernel's Issues

texmacs mode output

The output didn't save as tex or pdf when we changed mode as texmacs with --%mode=texmacs.

Fix reoccurring issue when reading a long input line

The code below works fine but outputs garbage due to M2 breaking the input line (when outputting it back). Don't just break the line by printWidth... Instead, use better sentinels.

--%mode=original
bar = (op1,op2) -> ({op1,op2,op1|op2} / (op->print(degree op, isHomogeneous(op), degrees op)); null)
i1 : mode(false); << "[magic succeeded] mode = original";
[magic succeeded] mode = original
(op), degrees op)); null){op1,op2,op1|op2} / (op->print(degree op, isHomogeneous 

o2 = bar

o2 : FunctionClosure

Use subprocess instead of pexpect

There's no need for pexepect aside from the timeout guard. In fact, we can send shorter sentinel messages using subprocess and escape characters.

M2 + WSL + Jupyter Notebook = kernel timeout

Hello!

I installed Ubuntu 18.04 on Windows 10 using the Windows Subsystem for Linux, then I installed M2 1.15 in Ubuntu. Next I installed Jupyter Notebook and the M2 Jupyter kernel (via pip3). I can run M2 within a Jupyter notebook from a browser (Chrome and Edge). I ran the following:

A=QQ[x_(1,1)..x_(4,6)]
G=genericMatrix(A,6,4)
I=minors(3,G);
betti res I

The first three lines ran okay, but the last one produced the following message:

[KERNEL ENFORCED TIMEOUT]

after about 5 seconds. If I run the same commands in a terminal, the last line returns a Betti table after about 8 seconds.

Any idea how I might try to fix this?

Thank you,
Fred.

install script's --prefix option isn't used by install_nbextension

Currently, python3 -m m2_kernel.install --prefix /foo will only install the kernel spec under /foo and not the nbextension.

I'm getting around this by using the following patch, but it would only work if it's known that notebook is installed under /usr.

--- a/m2_kernel/install.py
+++ b/m2_kernel/install.py
@@ -35,7 +35,8 @@
 
     print("Installing nbextension for syntax highlighting ...")
     install_nbextension('{}/m2-mode'.format(assets_dir),
-            nbextensions_dir='{}/static/components/codemirror/mode/'.format(notebook_dir[0]),
+            nbextensions_dir='{}/static/components/codemirror/mode/'.format(
+                notebook_dir[0].replace('/usr', prefix)),
             destination='macaulay2', overwrite=True, symlink=False)

"KERNEL ENFORCED TIMEOUT" message

Do you know how to resolve the following message?

o8 = [KERNEL ENFORCED TIMEOUT]

It only happens in the JupyterLab/Notebook, but not in the terminal.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.