This is an attempt to standardize and streamline computational work
that combines SnapPy, SageMath, and friends via a custom Docker image that is based around Ubuntu 22.04 LTS
and the latest and greatest SageMath. It is
directly derived from the official sagemath/sagemath
Docker
image, but includes SnapPy, and
the Python interfaces to Regina,
and PHCPack.
A container instance of this image starts a shell as the user sage
with all the environment variables set as if you had executed sage
-sh
.
This image takes a long time to build, even on a fast computer, since it compiles SageMath from source, and weighs in at 5.2 GB (1.6 GB compressed). We recommend you use the posted image on DockerHub via:
docker pull computop/sage docker run -it computop/sage
Here, the first command downloads the image from DockerHub and the
second starts a container that is running said image. Moving files
between the container and the rest of the world can be done using
scp
or having the container mount a local directory as in this example:
docker run -it --mount type=bind,source="$HOME/Dropbox/linux_share",target=/home/sage/linux_share computop/sage
where the directory linux_share
inside the user's Dropbox
folder is
shared.
If you want to use Sage's Jupyter notebook interface, start the container via:
docker run -it -p 127.0.0.1:8888:8888 computop/sage
and in said container type:
sage --notebook
and then point your computer's web browser to
http://localhost:8888
. As of computop/sage:10.5
, this uses
Notebook 7.
If you want interactive plots with MatplotLib, the command is now
%matplotlib widget
rather than %matplotlib notebook
.
If you want to use JupyterLab, you can instead do:
sage --notebook jupyterlab
In JupyterLab, you have access not just to notebooks but also Python consoles and shell terminal windows.
The images for SageMath 8.9 and older use Python 2 (and Ubuntu 16.04) and those for SageMath 9.0 and newer use Python 3 (and Ubuntu 18.04, 20.04, or 22.04). You can always request Docker run a particular version of the image, for example if you want SageMath 8.9 do:
docker run -it computop/sage:8.9
A partial list of included software:
- SageMath
- SnapPy
- Regina
- Two Python interfaces to PHCPack
- pandas
- pe
- gridlink
- flipper and curver
- heegaard
- pygraphviz
- snap
We no longer include HIKMOT as it is not compatible with Python 3.
To build from scratch, which takes 1.3 hours using all 8 cores on a Mac Pro:
docker build --tag=computop/sage sage
If compiling Sage fails, make sure the Docker application is configured so that it can use at least 4GB of memory.
Put out on DockerHub:
docker push computop/sage