Since GAP 4.10 release, in Sage 8.6 (Jan 2019), you should not use the following instructions!
Installing Gap Packages
The GAP version included in the Sage distribution comes with no extra packages installed. There is an optional spkg called gap_packages that installs some gap packages, but still you might want to install some package that is not included there.
The procedure to do so is basically the same as it would be in a standard GAP installation, but making sure that you set the appropiate environment variables. This is done automatically if you type
This will start an interactive shell with the apropiate environment variables. The GAP version included in sage is in the directory $SAGE_ROOT/local/gap/latest/ . There you should perform the same operations that you would do to install the package in a regular gap installation.
After that, you should force sage to reload the gap workspace. This is done by running the command
in a sage session.
Example 1: FGA
Most of the gap packages just require to download the package and uncompress it in the $SAGE_ROOT/local/gap/gap-4.4.12/pkg/ directory. Here we will show an example of how to do it with the FGA package.
First start a shell session with sage:
It will show some messages and show a shell prompt. Once there, go to the pkg directory of the gap installation, download the package, and uncompress it:
cd $SAGE_ROOT/local/gap/latest/pkg wget ftp://ftp.gap-system.org/pub/lib/gap4/tar.gz/packages/FGA-18.104.22.168.tar.gz tar -xzf FGA-22.214.171.124.tar.gz
Now exit the shell
and reload the gap workspace:
And you are done.
Example 2: kbmag
To install packages that require to compile some external libraries (read the package documentation to check this), we basically have to follow the installation instructions of the package in the sage shell. Otherwise, the procedure is the same as before. For example, the package kbmag states that we need to run a ./configure script and make after uncompressing, so the procedure would be:
sage -sh cd $SAGE_ROOT/local/gap/latest/pkg wget ftp://ftp.gap-system.org/pub/gap/gap4/tar.gz/packages/kbmag-1.5.tar.gz tar -xzf kbmag-1.5.tar.gz
up to now, it is the same as before. Here comes the specific part:
cd kbmag ./configure ../.. make
wait until the compilation is finished, and then, continue as before
exit sage gap_reset_workspace()
And that's it.
Using the packages
In order to make use of the functionality in the gap packages, you need to load them. If you want to work in a regular gap session, they are loaded in the usual way:
sage -gap LoadPackage("kbmag");
If the package is correctly installed, you should see a "true" answer.
If you want to use the packages from sage through the sage-gap interface, the command to load them is
you should also see a "true" answer. Notice the double quotes in the command gap.LoadPackage(): it is not a typo, you really need to pass a string whose content is string valid for gap.