Ask Your Question

How to load optional gap packages

asked 2013-07-17 10:01:53 -0500

niles gravatar image

updated 2013-07-18 11:35:35 -0500

tmonteil gravatar image

I would like to use the GAP package HAP in Sage. This is used, for example, to calculate cohomology of permutation groups as in (from the sage reference manual):

sage: G = SymmetricGroup(4)
sage: G.cohomology(1,2)                            # optional - gap_packages

In Sage 5.10, this raises

RuntimeError: Error loading Gap package hap. You may want to install the gap_packages SPKG.

Note that this is the error after installing gap_packages with sage -i gap_packages. I verified this with sage -optional, which gives:

Using SAGE Server
    ***  optional Packages   ***



Now I can track this error a little bit, to find the following bugs:

sage: from sage.groups.perm_gps.permgroup import load_hap
sage: load_hap()
RuntimeError: Error loading Gap package hap. You may want to install the gap_packages SPKG.

sage: gap.eval('LoadPackage("hap")')
sage: gap.eval('LoadPackage("HAP")')
sage: gap.eval('LoadPackage("Hap")')
sage: gap.eval('LoadPackage("Hap1.10")')

That last guess comes from listing the contents of SAGEROOT//local/gap/gap-4.5.7/pkg/, but seems to not work. Moreover, when I run gap directly with sage -gap, loading HAP fails there too. When I run LoadAllPackages(); in gap, HAP is not on the list of those that load.

edit retag flag offensive close merge delete


p.s. Yes, I know this is a bug and should be reported on Trac, but since we're right in the middle of migrating Trac to a new (virtual) machine, I'd rather wait a bit. Also, I don't have a solution for this, and I think the bigger problem is that `#optional` doctests are skipped too often. That's a different complaint :\

niles gravatar imageniles ( 2013-07-17 10:03:58 -0500 )edit

See also to automatically run the optional doctests if the optional package has been installed.

Volker Braun gravatar imageVolker Braun ( 2013-07-17 13:27:41 -0500 )edit

2 answers

Sort by » oldest newest most voted

answered 2013-07-18 09:35:13 -0500

Volker Braun gravatar image

updated 2013-07-19 07:55:34 -0500

Looks like we also need to package polycyclic:

gap> LoadPackage("hap");
gap> DisplayPackageLoadingLog(PACKAGE_DEBUG);
#I  HAP: PackageAvailabilityInfo for version
#I  HAP: PackageAvailabilityInfo: the AvailabilityTest function returned 'true'
#I  HAP: PackageAvailabilityInfo: check needed packages
#I       polycyclic (>=1.1)
#I  polycyclic: PackageAvailabilityInfo: no installed version fits
#I  HAP: PackageAvailabilityInfo: dependency 'polycyclic' is not satisfied
#I  HAP: PackageAvailabilityInfo: check of needed packages done
#I  HAP: PackageAvailabilityInfo: no installed version fits
#I  HAP: return from LoadPackage, package is not available

This is now (needs review)

edit flag offensive delete link more


Ah -- thanks!! At some stage I tried `DisplayPackageLoadingLog` but got no output -- I think I didn't know to put `PACKAGE_DEBUG` as an argument.

niles gravatar imageniles ( 2013-07-18 10:28:21 -0500 )edit

answered 2013-07-17 11:21:10 -0500

Nathann gravatar image

updated 2013-07-17 11:22:07 -0500

I've got no idea, but there is something strange, though. In the Hap directory there is a file which contains stuff like that :


It also looks like some GAP pkg need to be compiled (they appear in the spkg-install file of the gap_packages spkg)

Don't get it O_o

This being said, there is something weird :

~/.Sage/spkg/installed$ ls *gap*
gap-4.6.4.p0  gap_packages-4.5.7  libgap-4.6.4.p0

Not the same version... O_O


edit flag offensive delete link more


interesting! I tried explicitly installing gap_packages-4.6.4, but unfortunately this did not help. I've noticed some grumbling about gap_packages on the sage-devel list, so I guess I'll take my complaints there

niles gravatar imageniles ( 2013-07-18 05:07:05 -0500 )edit

In the Hap readme, I see that compiling Hap is not necessary, and that changing the hard-coded paths is only necessary if one compiles Hap. Sage doesn't seem to do this, so I guess that's not the problem.

niles gravatar imageniles ( 2013-07-18 06:09:31 -0500 )edit

Fixed, now the correct version is on the server.

Volker Braun gravatar imageVolker Braun ( 2013-07-18 09:36:01 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2013-07-17 10:01:53 -0500

Seen: 709 times

Last updated: Jul 19 '13