Calling GAP's StructureDescription from SAGE Given a sage group object $G$, I want to obtain its structure description using GAP, as follows:
sage:  gap.StructureDescription(G)

The command works fine in sagenb.org, but on my local installation I get an error message like this:
RuntimeError                              Traceback (most recent call last)

/opt/sage-5.3-linux-64bit-ubuntu_12.04.1_lts-x86_64-Linux/local/lib/python2.7/site-packages/sage/interfaces/interface.pyc in __call__(self, *args, **kwds)
...
RuntimeError: Gap produced error output
Error, the Small Groups identification is required but not installed

   executing StructureDescription($sage1);

I was thinking that perhaps I need to install the small groups library.  I'm using ubuntu, and in the /usr/local/bin directory I typed:
> sudo sage  -i database_gap-4.4.9

But I still get the error for the gap.StructureDescription(G) command.  How do I get this command to work?
 A: This is an example of installing additional GAP components in just installed Sage 5.13 (version numbers may differ in your particular installation, if you have an older version of Sage):
1) Call optional_packages and find names or relevant things (which will hopefully have version numbers matching the core GAP system):
sage: optional_packages()
   ...
  'database_gap-4.6.4',
  ...
  'gap_packages-4.6.4.p1',
  ...

2) Call install_package for those components in which you are interested:
sage: install_package('database_gap-4.6.4')

... lots of output ...

sage: install_package('gap_packages-4.6.4.p1')

... lots of output ...

3) Check how the GAP welcome screen looks like:
sage: gap_console();
 ┌───────┐   GAP, Version 4.6.4 of 04-May-2013 (free software, GPL)
 │  GAP  │   http://www.gap-system.org
 └───────┘   Architecture: x86_64-apple-darwin10.8.0-gcc-default64
 Libs used:  gmp, readline
 Loading the library and packages ...
 Components: trans 1.0, prim 2.1, small* 1.0, id* 1.0
 Packages:   Alnuth 3.0.0, AutPGrp 1.5, CTblLib 1.2.2, FactInt 1.5.3, 
             GAPDoc 1.5.1, LAGUNA 3.6.3, Polycyclic 2.11, TomLib 1.2.2
 Try '?help' for help. See also  '?copyright' and  '?authors'
gap> 

In particular, you may be interested in lines
 Components: trans 1.0, prim 2.1, small* 1.0, id* 1.0

where small* 1.0, id* 1.0 stands for the Small Groups Library, and  
 Packages:   Alnuth 3.0.0, AutPGrp 1.5, CTblLib 1.2.2, FactInt 1.5.3, 
             GAPDoc 1.5.1, LAGUNA 3.6.3, Polycyclic 2.11, TomLib 1.2.2

which list some packages that are loaded by default.
4) Now gap.StructureDescription works:
sage: G = PermutationGroup(['(1,2,3)(4,5)', '(3,4)'])
sage: gap.StructureDescription(G)
S5

In addition, it may be useful to check "Can non-isomorphic groups have equal structure descriptions?" from the GAP F.A.Q.
Disclaimers


*

*The latest version of GAP available for standalone installation may be newer than the one available with Sage

*Not all packages that are redistributed with GAP are available in gap-packages-... component installed as above (there are 114 packages redistributed with GAP 4.7.2), but there is a way to install additional packages manually. On the other hand, Sage includes the braid package, which has been superseded by MapClass which is now an accepted package redistributed with GAP. 
A: I tried the above, also on ubuntu, and got the same error. I believe it is for exactly the reason stated, that the SmallGroups library is needed. From this link http://www.gap-system.org/Manuals//doc/ref/chap76.html#X7B6CD527825945CD it appears that not only do you need to install the package, you most likely need to load it with gap.LoadPackage(name) before you can use it. 
