cypari

raw JSON →
2.5.6 verified Fri May 01 auth: no python maintenance

A standalone Python interface to the PARI/GP computer algebra system, extracted from SageMath. Version 2.5.6 (2024?) provides basic number theory functions, elliptic curves, and polynomial arithmetic. Development appears slow; latest release is from 2020?.

pip install cypari
error ModuleNotFoundError: No module named 'cypari'
cause Trying to import 'cypari' but the actual module is 'cypari2'.
fix
Use import cypari2 instead of import cypari.
error ImportError: cannot import name 'Pari' from 'cypari'
cause After successful import of 'cypari' (if eventually loaded), the symbol is not there.
fix
Use from cypari2 import Pari.
gotcha The import module is `cypari2`, not `cypari`. Even though the PyPI package is `cypari`, all imports use the `cypari2` namespace.
fix Use `import cypari2` instead of `import cypari`.
deprecated Older versions (pre-2.0) used `from cypari import Pari` directly. This no longer works.
fix Update to `from cypari2 import Pari`.

Initialize a PARI session and compute factorization.

from cypari2 import Pari
pari = Pari()
print(pari('factor(123456789)'))