# How do I know what passagemath packages to install?

**URL:** <https://passagemath.discourse.group/t/how-do-i-know-what-passagemath-packages-to-install/22>\
**Category:** General\
**Created:** [June 16, 2025, 3:43pm UTC](https://passagemath.discourse.group/t/how-do-i-know-what-passagemath-packages-to-install/22 "2025-06-16T15:43:39Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![rbrijder](https://avatars.discourse-cdn.com/v4/letter/r/c6cbf5/32.png) [@rbrijder](https://passagemath.discourse.group/u/rbrijder)\
**Post date:** [June 16, 2025, 3:43pm UTC](https://passagemath.discourse.group/t/how-do-i-know-what-passagemath-packages-to-install/22/1 "2025-06-16T15:43:39Z")

</div>

I did `pip install passagemath-graphs` and when I then run

```auto
from sage.all__sagemath_graphs import *

g = Graph({
    0: [1, 2],
    1: [0, 2],
    2: [0, 1, 3],
    3: [2]
})

aut = g.automorphism_group()
print(aut.order())

```

I get `ModuleNotFoundError: No module named 'sage.groups.perm_gps.permgroup'`

This code works when I do `pip install passsagemath-standard`.

Is this intended behavior? If yes, is there a way to automatically determine which additional `pip install`’s I have to do? I am trying to minimize the amount of installed packages (that is, avoid installing `passsagemath-standard`).

---

<div class="post-metadata">

**Author:** ![mkoeppe](https://yyz2.discourse-cdn.com/free1/user_avatar/passagemath.discourse.group/mkoeppe/32/3_2.png) [@mkoeppe](https://passagemath.discourse.group/u/mkoeppe)\
**Post date:** [June 16, 2025, 5:25pm UTC](https://passagemath.discourse.group/t/how-do-i-know-what-passagemath-packages-to-install/22/2 "2025-06-16T17:25:47Z")

</div>

Great question. Several complementary answers:

- The source code of the missing module is at [passagemath/src/sage/groups/perm\_gps/permgroup.py at main · passagemath/passagemath · GitHub](https://github.com/passagemath/passagemath/blob/main/src/sage/groups/perm_gps/permgroup.py#L1); the first line lists the distribution name (need to prepend “pas”), so **passagemath-gap**
- It is intended to give such installation advice automatically, but this mechanism is not complete yet, so currently you still get naked `ModuleNotFoundError`s.
- [passagemath-graphs·PyPI](https://pypi.org/project/passagemath-graphs/) on the left margin lists in **Provides-Extra:** various extras that can be installed with passagemath-graphs. It would probably be a good idea to add an extra `groups` (and to document it in the README, just like the extra `mip` is already documented). (Edit: I’ve opened [passagemath-graphs: Define extra "groups" by mkoeppe · Pull Request #1027 · passagemath/passagemath · GitHub](https://github.com/passagemath/passagemath/pull/1027) for this.)

---

<div class="post-metadata">

**Author:** ![mkoeppe](https://yyz2.discourse-cdn.com/free1/user_avatar/passagemath.discourse.group/mkoeppe/32/3_2.png) [@mkoeppe](https://passagemath.discourse.group/u/mkoeppe)\
**Post date:** [June 16, 2025, 6:57pm UTC](https://passagemath.discourse.group/t/how-do-i-know-what-passagemath-packages-to-install/22/3 "2025-06-16T18:57:14Z")

</div>

I’ve added a bit of documentation in [passagemath-graphs: Define extra "groups", document extras by mkoeppe · Pull Request #1027 · passagemath/passagemath · GitHub](https://github.com/passagemath/passagemath/pull/1027/files); comments very welcome

---

<div class="post-metadata">

**Author:** ![rbrijder](https://avatars.discourse-cdn.com/v4/letter/r/c6cbf5/32.png) [@rbrijder](https://passagemath.discourse.group/u/rbrijder)\
**Post date:** [June 16, 2025, 7:21pm UTC](https://passagemath.discourse.group/t/how-do-i-know-what-passagemath-packages-to-install/22/4 "2025-06-16T19:21:21Z")

</div>

Thanks a lot from this prompt answer, and great to see this getting more user friendly. Great!

So, if I understand correctly, `pip install passagemath-graphs[groups]` should work for this example. However, it doesn’t for me. I also tried `pip install passagemath-graphs[groups, test]`.

I get:

```auto
  File "sage/groups/perm_gps/permgroup_element.pyx", line 137, in init sage.groups.perm_gps.permgroup_element
ImportError: cannot import name libgap

```

This is the list of passagemath packages that are installed now:

```auto
passagemath-categories 10.5.42
passagemath-environment 10.5.42
passagemath-gap 10.5.42
passagemath-graphs 10.5.42
passagemath-groups 10.5.42
passagemath-modules 10.5.42
passagemath-nauty 10.5.42
passagemath-objects 10.5.42
passagemath-repl 10.5.42

```

---

<div class="post-metadata">

**Author:** ![mkoeppe](https://yyz2.discourse-cdn.com/free1/user_avatar/passagemath.discourse.group/mkoeppe/32/3_2.png) [@mkoeppe](https://passagemath.discourse.group/u/mkoeppe)\
**Post date:** [June 16, 2025, 7:28pm UTC](https://passagemath.discourse.group/t/how-do-i-know-what-passagemath-packages-to-install/22/5 "2025-06-16T19:28:29Z")

</div>

> [@rbrijder](#):
>
> if I understand correctly, `pip install passagemath-graphs[groups]` should work for this example.

It will in the _next_ release, after [passagemath-graphs: Define extra "groups" by mkoeppe · Pull Request #1027 · passagemath/passagemath · GitHub](https://github.com/passagemath/passagemath/pull/1027) is merged!

---

<div class="post-metadata">

**Author:** ![mkoeppe](https://yyz2.discourse-cdn.com/free1/user_avatar/passagemath.discourse.group/mkoeppe/32/3_2.png) [@mkoeppe](https://passagemath.discourse.group/u/mkoeppe)\
**Post date:** [June 16, 2025, 7:32pm UTC](https://passagemath.discourse.group/t/how-do-i-know-what-passagemath-packages-to-install/22/6 "2025-06-16T19:32:18Z")

</div>

> [@rbrijder](#):
>
> `ImportError: cannot import name libgap`

Confirmed; I’ll post a workaround.

---

<div class="post-metadata">

**Author:** ![mkoeppe](https://yyz2.discourse-cdn.com/free1/user_avatar/passagemath.discourse.group/mkoeppe/32/3_2.png) [@mkoeppe](https://passagemath.discourse.group/u/mkoeppe)\
**Post date:** [June 16, 2025, 7:33pm UTC](https://passagemath.discourse.group/t/how-do-i-know-what-passagemath-packages-to-install/22/7 "2025-06-16T19:33:41Z")

</div>

This works with the current release; note the extra import.

```auto
$ pipx run --pip-args="--prefer-binary" --spec "passagemath-graphs[gap,test]" python
Python 3.11.8 (main, Feb 6 2024, 21:21:21) [Clang 15.0.0 (clang-1500.1.0.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from sage.all__sagemath_graphs import *
>>> from sage.all__sagemath_gap import *
>>> g = Graph({
... 0: [1, 2],
... 1: [0, 2],
... 2: [0, 1, 3],
... 3: [2]
... })
>>> aut = g.automorphism_group()
>>> print(aut.order())
2

```

---

<div class="post-metadata">

**Author:** ![rbrijder](https://avatars.discourse-cdn.com/v4/letter/r/c6cbf5/32.png) [@rbrijder](https://passagemath.discourse.group/u/rbrijder)\
**Post date:** [June 16, 2025, 7:48pm UTC](https://passagemath.discourse.group/t/how-do-i-know-what-passagemath-packages-to-install/22/8 "2025-06-16T19:48:10Z")

</div>

Thanks a lot!

Strange (to me) that the extra import is not needed if I install ‘passagemath-standard’.

---

<div class="post-metadata">

**Author:** ![mkoeppe](https://yyz2.discourse-cdn.com/free1/user_avatar/passagemath.discourse.group/mkoeppe/32/3_2.png) [@mkoeppe](https://passagemath.discourse.group/u/mkoeppe)\
**Post date:** [June 16, 2025, 7:50pm UTC](https://passagemath.discourse.group/t/how-do-i-know-what-passagemath-packages-to-install/22/9 "2025-06-16T19:50:45Z")

</div>

Thanks for the report. Well, these effects of import cycles in the Sage library are quite complex.

---

<div class="post-metadata">

**Author:** ![mkoeppe](https://yyz2.discourse-cdn.com/free1/user_avatar/passagemath.discourse.group/mkoeppe/32/3_2.png) [@mkoeppe](https://passagemath.discourse.group/u/mkoeppe)\
**Post date:** [June 16, 2025, 9:35pm UTC](https://passagemath.discourse.group/t/how-do-i-know-what-passagemath-packages-to-install/22/10 "2025-06-16T21:35:27Z")

</div>

More specifically, the main purpose of modules such as `sage.all __sagemath_graphs` is to set up the global namespace for the purpose of doctesting; these modules use try…except to load `sage.all__...` packages of various relevant extras. When **passagemath-standard** is installed, this can lead to the preloading of `sage.all__sagemath_gap`.

---

<div class="post-metadata">

**Author:** ![rbrijder](https://avatars.discourse-cdn.com/v4/letter/r/c6cbf5/32.png) [@rbrijder](https://passagemath.discourse.group/u/rbrijder)\
**Post date:** [June 17, 2025, 8:55am UTC](https://passagemath.discourse.group/t/how-do-i-know-what-passagemath-packages-to-install/22/11 "2025-06-17T08:55:46Z")

</div>

Thanks for clarifying. So `sage.all __sagemath_graphs` finds some package X installed by `passagemath-standard`, which gets imported, which in turn imports `sage.all__ sagemath_gap`.

I am grateful you are embarking on the huge task of disentangling Sage. I guess this issue of required imports depending on what is installed just means this disentangling is not yet fully complete.

EDIT: Ah, I see that this is exactly what PR 1027 resolves for this case.

---

<div class="post-metadata">

**Author:** ![mkoeppe](https://yyz2.discourse-cdn.com/free1/user_avatar/passagemath.discourse.group/mkoeppe/32/3_2.png) [@mkoeppe](https://passagemath.discourse.group/u/mkoeppe)\
**Post date:** [June 17, 2025, 4:35pm UTC](https://passagemath.discourse.group/t/how-do-i-know-what-passagemath-packages-to-install/22/12 "2025-06-17T16:35:19Z")

</div>

> [@rbrijder](#):
>
> I guess this issue of required imports depending on what is installed just means this disentangling is not yet fully complete.

Yes, there’s some remaining technical debt from 20 years of monolithic development, even after 5 years of modularization work.

---

<div class="post-metadata">

**Author:** ![mkoeppe](https://yyz2.discourse-cdn.com/free1/user_avatar/passagemath.discourse.group/mkoeppe/32/3_2.png) [@mkoeppe](https://passagemath.discourse.group/u/mkoeppe)\
**Post date:** [June 19, 2025, 4:38pm UTC](https://passagemath.discourse.group/t/how-do-i-know-what-passagemath-packages-to-install/22/13 "2025-06-19T16:38:02Z")

</div>

[Release passagemath-10.5.43 · passagemath/passagemath · GitHub](https://github.com/passagemath/passagemath/releases/tag/passagemath-10.5.43) is out, and `pip install passagemath-graphs[groups]` now works

---

<div class="post-metadata">

**Author:** ![rbrijder](https://avatars.discourse-cdn.com/v4/letter/r/c6cbf5/32.png) [@rbrijder](https://passagemath.discourse.group/u/rbrijder)\
**Post date:** [June 19, 2025, 5:51pm UTC](https://passagemath.discourse.group/t/how-do-i-know-what-passagemath-packages-to-install/22/14 "2025-06-19T17:51:01Z")

</div>

> `pip install passagemath-graphs[groups]` now works

The original example doesn’t yet work for me. I get  
`ModuleNotFoundError: No module named 'sage.misc.sage_eval'`

This is the output of pip list

```auto
Package Version
----------------------- -------
cysignals 1.12.3
Cython 3.1.2
gmpy2 2.2.1
memory_allocator 0.1.4
mpmath 1.3.0
passagemath-categories 10.5.43
passagemath-environment 10.5.43
passagemath-gap 10.5.43
passagemath-graphs 10.5.43
passagemath-groups 10.5.43
passagemath-modules 10.5.43
passagemath-nauty 10.5.43
passagemath-objects 10.5.43
pip 23.0.1
setuptools 65.5.0

```

Only after manually installing `passagemath-repl` it works.

---

<div class="post-metadata">

**Author:** ![mkoeppe](https://yyz2.discourse-cdn.com/free1/user_avatar/passagemath.discourse.group/mkoeppe/32/3_2.png) [@mkoeppe](https://passagemath.discourse.group/u/mkoeppe)\
**Post date:** [June 19, 2025, 5:54pm UTC](https://passagemath.discourse.group/t/how-do-i-know-what-passagemath-packages-to-install/22/15 "2025-06-19T17:54:18Z")

</div>

Thanks for testing! I was just fighting against similar `sage_eval`-related issues, I’ll investigate.  
Edit: I’ve opened [Eliminate use of `sage_eval` · Issue #1041 · passagemath/passagemath · GitHub](https://github.com/passagemath/passagemath/issues/1041)
