How to load optional gap packages

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 http://www.sagemath.org/packages
***********************************
***  optional Packages   ***
***********************************

INSTALLED:
gap_packages-4.5.7

NOT INSTALLED:
4ti2-1.3.2.p1
autotools-20121217
beautifulsoup-3.2.1
biopython-1.61
...


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

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

'fail'
'fail'
'fail'
'fail'


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 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 :\

( 2013-07-17 17:03:58 +0200 )edit

See also http://trac.sagemath.org/13540 to automatically run the optional doctests if the optional package has been installed.

( 2013-07-17 20:27:41 +0200 )edit

Sort by » oldest newest most voted

Looks like we also need to package polycyclic:

gap> LoadPackage("hap");
fail
[...]
#I  HAP: PackageAvailabilityInfo for version 1.10.10.2
#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 http://trac.sagemath.org/14909 (needs review)

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.

( 2013-07-18 17:28:21 +0200 )edit

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

PKGDIR=/home/graham/pkg;


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

Nathann

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

( 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.

( 2013-07-18 13:09:31 +0200 )edit

Fixed, now the correct version is on the server.

( 2013-07-18 16:36:01 +0200 )edit