Ask Your Question

How to load optional gap packages

asked 2013-07-17 17:01:53 +0200

niles gravatar image

updated 2023-01-09 23:59:33 +0200

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 17:03:58 +0200 )edit

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

Volker Braun gravatar imageVolker Braun ( 2013-07-17 20:27:41 +0200 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2013-07-18 16:35:13 +0200

Volker Braun gravatar image

updated 2013-07-19 14:55:34 +0200

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 17:28:21 +0200 )edit

answered 2013-07-17 18:21:10 +0200

Nathann gravatar image

updated 2013-07-17 18:22:07 +0200

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 12:07:05 +0200 )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 13:09:31 +0200 )edit

Fixed, now the correct version is on the server.

Volker Braun gravatar imageVolker Braun ( 2013-07-18 16:36:01 +0200 )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 17:01:53 +0200

Seen: 2,139 times

Last updated: Jul 19 '13