diff -up src/sage/groups/perm_gps/permgroup.py.orig src/sage/groups/perm_gps/permgroup.py --- src/sage/groups/perm_gps/permgroup.py.orig 2015-07-26 07:34:43.000000000 -0600 +++ src/sage/groups/perm_gps/permgroup.py 2016-08-11 21:51:51.490143121 -0600 @@ -136,7 +136,6 @@ from sage.groups.perm_gps.permgroup_elem from sage.groups.abelian_gps.abelian_group import AbelianGroup from sage.misc.cachefunc import cached_method from sage.groups.class_function import ClassFunction -from sage.misc.package import is_package_installed from sage.sets.finite_enumerated_set import FiniteEnumeratedSet from sage.categories.all import FiniteEnumeratedSets from sage.groups.conjugacy_classes import ConjugacyClassGAP @@ -155,7 +154,10 @@ def load_hap(): try: gap.load_package("hap") except Exception: - gap.load_package("hap") + try: + gap.load_package("hap") + except Exception: + raise RuntimeError("gap-hap package failed to load.") def hap_decorator(f): """ @@ -181,8 +183,6 @@ def hap_decorator(f): """ @wraps(f) def wrapped(self, n, p=0): - if not is_package_installed('gap_packages'): - raise RuntimeError("You must install the optional gap_packages package.") load_hap() from sage.rings.arith import is_prime if not (p == 0 or is_prime(p)): @@ -1617,9 +1617,7 @@ class PermutationGroup_generic(group.Fin try: return [Integer(n) for n in self._gap_().IdGroup()] except RuntimeError: - if not is_package_installed('database_gap'): - raise RuntimeError("You must install the optional database_gap package first.") - raise + raise RuntimeError("gap-hap package error.") def id(self): """ @@ -1670,9 +1668,7 @@ class PermutationGroup_generic(group.Fin try: return Integer(self._gap_().PrimitiveIdentification()) except RuntimeError: - if not is_package_installed('database_gap'): - raise RuntimeError("You must install the optional database_gap package first.") - raise + raise RuntimeError("gap-hap package error.") def center(self): """ @@ -3959,8 +3955,6 @@ class PermutationGroup_generic(group.Fin - David Joyner and Graham Ellis """ - if not is_package_installed('gap_packages'): - raise RuntimeError("You must install the optional gap_packages package.") load_hap() from sage.rings.arith import is_prime if not (p == 0 or is_prime(p)):