Skip to main content

gmpy2 interface to GMP/MPIR, MPFR, and MPC for Python 2.7 and 3.5+

Project description


gmpy2 is an optimized, C-coded Python extension module that supports fast multiple-precision arithmetic. gmpy2 is based on the original gmpy module. gmpy2 adds support for correctly rounded multiple-precision real arithmetic (using the MPFR library) and complex arithmetic (using the MPC library).

Version 2.1.x Status

gmpy2 2.1 was extensively refactored. Some of the significant changes are:

  • Support for thread-safe contexts and context methods

  • Interoperability with Cython extensions

  • mpz and mpq operation can release the GIL * The current implementation is experimental

  • Improved argument processing

The gmpy2 2.1 series will be the last to offer compatibility with Python 2.7. Release 2.1.3 is the last planned release of the 2.1 series.

Note: Versions 2.1.4 and 2.1.5 were released to address Apple Silicon wheel build issues. There are no code changes.

Release 2.1.5 is the last planned release of the 2.1 series.

Version 2.2 Plans

Version 2.2 will drop support for Python 2.7 and older Python 3.x versions.

The primary development focus will be on functions that operate on lists and release the GIL. See powmod_base_list and powmod_exp_list as examples.


gmpy2 is available at

Documentation is available at

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gmpy2-2.1.5.tar.gz (261.7 kB view hashes)

Uploaded source

Built Distributions

gmpy2-2.1.5-cp311-cp311-win_amd64.whl (1.1 MB view hashes)

Uploaded cp311

gmpy2-2.1.5-cp311-cp311-macosx_11_0_arm64.whl (664.1 kB view hashes)

Uploaded cp311

gmpy2-2.1.5-cp311-cp311-macosx_10_9_x86_64.whl (806.2 kB view hashes)

Uploaded cp311

gmpy2-2.1.5-cp310-cp310-win_amd64.whl (1.1 MB view hashes)

Uploaded cp310

gmpy2-2.1.5-cp310-cp310-macosx_11_0_arm64.whl (664.1 kB view hashes)

Uploaded cp310

gmpy2-2.1.5-cp310-cp310-macosx_10_9_x86_64.whl (806.2 kB view hashes)

Uploaded cp310

gmpy2-2.1.5-cp39-cp39-win_amd64.whl (1.1 MB view hashes)

Uploaded cp39

gmpy2-2.1.5-cp39-cp39-macosx_11_0_arm64.whl (664.1 kB view hashes)

Uploaded cp39

gmpy2-2.1.5-cp39-cp39-macosx_10_9_x86_64.whl (806.1 kB view hashes)

Uploaded cp39

gmpy2-2.1.5-cp38-cp38-win_amd64.whl (1.1 MB view hashes)

Uploaded cp38

gmpy2-2.1.5-cp38-cp38-macosx_11_0_arm64.whl (665.3 kB view hashes)

Uploaded cp38

gmpy2-2.1.5-cp38-cp38-macosx_10_9_x86_64.whl (807.8 kB view hashes)

Uploaded cp38

gmpy2-2.1.5-cp37-cp37m-win_amd64.whl (1.1 MB view hashes)

Uploaded cp37

gmpy2-2.1.5-cp37-cp37m-macosx_10_9_x86_64.whl (813.2 kB view hashes)

Uploaded cp37

gmpy2-2.1.5-cp36-cp36m-win_amd64.whl (1.1 MB view hashes)

Uploaded cp36

gmpy2-2.1.5-cp36-cp36m-macosx_10_9_x86_64.whl (813.1 kB view hashes)

Uploaded cp36

gmpy2-2.1.5-cp35-cp35m-win_amd64.whl (1.1 MB view hashes)

Uploaded cp35

gmpy2-2.1.5-cp35-cp35m-macosx_10_9_x86_64.whl (775.5 kB view hashes)

Uploaded cp35

gmpy2-2.1.5-cp27-cp27m-win_amd64.whl (1.1 MB view hashes)

Uploaded cp27

gmpy2-2.1.5-cp27-cp27m-macosx_10_9_x86_64.whl (775.1 kB view hashes)

Uploaded cp27

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page