Install GAP 4.10.0 in a CoCalc project
Author: Samuel Lelièvre
Date: 2019-01-15
License: CC0
Goal
Instructions on how to build GAP in a CoCalc project.
(Should go roughly the same in any Linux or macOS system.)
Install GAP 4.10.0 following instructions on the GAP website
See instructions at
Note in particular that the path to the GAP directory should not contain spaces.
For a system-wide install, note the extra step in the INSTALL.md
file:
System-wide installation of GAP in CoCalc is discussed at
Download the tarball
This corresponds to "section 2: getting the archive" of the INSTALL.md file.
Done here using curl; one could alternatively use wget.
In a CoCalc project without internet access, one could
download the tarball to a computer, then upload it to the CoCalc project
or copy the tarball shared here to the project (and check the sha256 against the one on the GAP website)
We first set our working directory to our home (change if needed).
The tarball is at https://www.gap-system.org/pub/gap/gap-4.10/tar.bz2/gap-4.10.0.tar.bz2
so we set:
and we download using curl
(we could also use wget
):
Check the sha256 hash
This step is omitted in section 2 of the INSTALL.md file, but it is good practice.
We compute the sha256 of the tarball, and check that it matches the one on the download page; for GAP 4.10.0, it should match 2dc71364b7418d16f8b99ca914971996fa4416294fa3ae8fb336c873c946abb6
.
Unpack the tarball
This corresponds to "section 3: unpacking" of the INSTALL.md file.
Warning: this will erase the $GAPDIR directory if already present.
Configure and make
This corresponds to "section 4: compilation" of the INSTALL.md file.
Check if the MAKE environment variable is set:
Optionally, set the MAKE environment variable
Configure and make
Install packages
This corresponds to "section 7: packages" of the INSTALL.md file.
We do this before testing the installation.
Check the content of the pkg
directory.
Test the installation
This corresponds to "section 2: testing the installation" of the INSTALL.md file.
Optional: symbolic link to this version of GAP
This is so that typing gap
in a terminal will launch this GAP rather than the system-wide installed GAP.
Install the GAP Jupyter kernel
Following the installation guide in the manual for the GAP package "JupyterKernel".
All system prerequisites are there; all prerequisite GAP packages are there and those that need compiling have been compiled.
The JupyterKernel GAP package itself is also present.
So it is just a matter of making it known to Jupyter, by doing:
Then the list of available kernels contains GAP-4:
and we can check the content of the kernel.json
for that:
The kernel does not seem to work.
Tried modifying /home/user/.local/share/jupyter/kernels/gap-4/kernel.json
so it reads
or
or
Tried modifying the PATH
in .bashrc
.
Tried adding this line in .bashrc
:
or
or
Tried installing JupyterKernel 1.1:
No luck getting it to work.
At some point I had managed to reach a state like the one illustrated by the screenshot at https://github.com/sagemathinc/cocalc/issues/1706#issuecomment-446273108 but then kept tinkering and could never reproduce that.
In that state, you could execute a cell, and would have to interrupt with ctrl-C, which would cause the output to be displayed, followed by a similar error message to that in the screenshot, involving ZeroMQ communications.
Then after all that, tried in Plain Jupyter and JupyterLab, and it works fine there!
It's just not working in CoCalc-Jupyter.
Note that contrary to the previous GAP Jupyter kernel based on pexpect and Python, and now deprecated (see https://github.com/markuspf/jupyter-kernel-gap), this new kernel is implemented in the GAP language.
Maybe that gives CoCalc-Jupyter trouble...