Gmpy2 python install windows

installing gmpy2.0.7 on Windows 10 pc #102

Comments

ChVanDijken commented Dec 9, 2015

At the moment I have installed gmpy2.0.3, which is outdated, on my pc because I have spent hours looking in vain for a method that works for me to install gmpy2.0.7, which is distributed in the wheel format. The person who is maintaining the gmpy2 distributions replied on Stack Exchange to contact him on GitHub for installation assistance. Both aforementioned distributions work for Python 3.4, and in order to install gmpy2.0.3, I have had to revert from Python 3.5.0 to Python 3.4.3, precisely at the moment Python 3.5.1 has been released. Could Case shed some light on how much time is involved in readying gmpy2 for the latest Python edition? In order to minimize security vulnerabilities, I hear repeatedly that one should use the latest versions of software, but that, apparently, is not always possible.

The text was updated successfully, but these errors were encountered:

casevh commented Dec 10, 2015

The wheel format is a new method for distributing Python extensions, especially for pre-compiled Windows binaries. To install a wheel file, you need to use an external application called «pip» (without the quotes). pip is automatically installed with Python 2.7, 3.4, and 3.5. pip is located in the Scripts sub-directory in the Python installation folder. Here is an example from my computer. I am using a non-standard location so it may differ for you.

C:\64\Python34>dir Scripts
Volume in drive C has no label.
Volume Serial Number is D8F1-7B41

Directory of C:\64\Python34\Scripts

08/26/2015 09:24 PM 95,595 easy_install-3.4.exe
08/26/2015 09:24 PM 95,595 easy_install.exe
08/26/2015 09:24 PM 95,567 pip.exe
08/26/2015 09:24 PM 95,567 pip3.4.exe
08/26/2015 09:24 PM 95,567 pip3.exe
5 File(s) 477,891 bytes
2 Dir(s) 151,274,381,312 bytes free

C:\64\Python34\Scripts>pip install gmpy2
You are using pip version 6.0.8, however version 7.1.2 is available.
You should consider upgrading via the ‘pip install —upgrade pip’ command.
Collecting gmpy2
Using cached gmpy2-2.0.7-cp34-none-win_amd64.whl
Installing collected packages: gmpy2

Successfully installed gmpy2-2.0.7

Support for Python 3.5 on Windows is complicated. The gmpy2 2.0.x binaries are built using older versions of MPIR (a Windows friendly fork of GMP), MPFR, and MPC and old versions of the Visual Studio compilers. Python 3.5 uses a new compiler and I can’t install that version on the VM I use for Windows compilation.

There are unofficial versions of gmpy2 2.0.7 for Python 3.5 available at http://www.lfd.uci.edu/

I have not tested them so I do not know how they have been compiled.

For the currently gmpy2 2.1.x development branch, I elected to use the msys2/mingw-w64 environment and current versions of GMP, MPFR, and MPC. The two main advantages are easier access to the compilers (msys2/mingw-w64) and faster code (GMP can automatically detect the correct processor type). Unfortunately, msys2/mingw-w64 does not support Python 3.5.

I’ll try building the development branch for Python 3.5 and see if the resulting binary will run. It may take me a couple of days but I’ll post an update.

ChVanDijken commented Dec 10, 2015

Thank you very much for your detailed reply. I had found pip.exe in
c:\Python34\Scripts, then added this location to the Path system
variable, then went to the directory where I had unpacked gmpy2.pyd from
the download. Issuing pip install gmpy2 caused something to happen
within my computer, but nothing became visible on the «Programs and
Features» list. Using the .exe file to install gmpy2-2.0.3 did cause
that installation to become visible. I first issued pip install
—upgrade pip, and got a screen full of red error messages; apparently I
already had pip version 6.0.8 installed. I first removed gmpy2-2.0.3,
then issued pip install gmpy2. This time I received feedback that
gmpy2-2.0.7 had been correctly installed. But going back to the Programs
and Features list, nothing was visible, unlike with the prior version.
However, 2 programs using gmpy2 did run correctly.

Читайте также:  Windows cmd text editor

Last January I experienced a bit of a problem with PyCrypto, receiving
error messages complaining about the absence of vcvarsall.bat. I solved
that by temporarily installing Visual Studio 2010. Later on I discovered
that I could no longer download VS 2010, so I decided the write my own
AES-128 program in pure Python 3.x, ECB-mode only. But trying to do
something similar with gmpy2 isn’t something I want to try right now, if
only because Professor Boneh’s Crypto 2 course is still scheduled to
start next January 11th. And I would not be surprised if we will be
required to intall yet another library that uses the wheel distribution
format, so your help has removed a big mental burden from me; thanks again!

Op 2015-12-10 om 06:09 schreef casevh:

The wheel format is a new method for distributing Python extensions, especially for pre-compiled Windows binaries. To install a wheel file, you need to use an external application called «pip» (without the quotes). pip is automatically installed with Python 2.7, 3.4, and 3.5. pip is located in the Scripts sub-directory in the Python installation folder. Here is an example from my computer. I am using a non-standard location so it may differ for you.

C:\64\Python34>dir Scripts
Volume in drive C has no label.
Volume Serial Number is D8F1-7B41

Directory of C:\64\Python34\Scripts

08/26/2015 09:24 PM 95,595 easy_install-3.4.exe
08/26/2015 09:24 PM 95,595 easy_install.exe
08/26/2015 09:24 PM 95,567 pip.exe
08/26/2015 09:24 PM 95,567 pip3.4.exe
08/26/2015 09:24 PM 95,567 pip3.exe
5 File(s) 477,891 bytes
2 Dir(s) 151,274,381,312 bytes free

C:\64\Python34\Scripts>pip install gmpy2
You are using pip version 6.0.8, however version 7.1.2 is available.
You should consider upgrading via the ‘pip install —upgrade pip’ command.
Collecting gmpy2
Using cached gmpy2-2.0.7-cp34-none-win_amd64.whl
Installing collected packages: gmpy2

Successfully installed gmpy2-2.0.7

Support for Python 3.5 on Windows is complicated. The gmpy2 2.0.x binaries are built using older versions of MPIR (a Windows friendly fork of GMP), MPFR, and MPC and old versions of the Visual Studio compilers. Python 3.5 uses a new compiler and I can’t install that version on the VM I use for Windows compilation.

There are unofficial versions of gmpy2 2.0.7 for Python 3.5 available athttp://www.lfd.uci.edu/

I have not tested them so I do not know how they have been compiled.

For the currently gmpy2 2.1.x development branch, I elected to use the msys2/mingw-w64 environment and current versions of GMP, MPFR, and MPC. The two main advantages are easier access to the compilers (msys2/mingw-w64) and faster code (GMP can automatically detect the correct processor type). Unfortunately, msys2/mingw-w64 does not support Python 3.5.

I’ll try building the development branch for Python 3.5 and see if the resulting binary will run. It may take me a couple of days but I’ll post an update.

Читайте также:  Virtual keyboard russian windows 10

Reply to this email directly or view it on GitHub:
#102 (comment)

gmpy2 2.0.8

pip install gmpy2 Copy PIP instructions

Released: Jun 26, 2016

GMP/MPIR, MPFR, and MPC interface to Python 2.6+ and 3.x

Statistics

View statistics for this project via Libraries.io, or by using our public dataset on Google BigQuery

Maintainer: Case Van Horsen

Tags GMP, MPIR, MPFR, MPC, multiple-precision

Maintainers

Classifiers

  • Development Status
    • 5 — Production/Stable

Project description

gmpy2 is a C-coded Python extension module that supports multiple-precision arithmetic. In addition to supporting GMP or MPIR for multiple-precision integer and rational arithmetic, gmpy2 adds support for the MPFR (correctly rounded real floating-point arithmetic) and MPC (correctly rounded complex floating-point arithmetic) libraries.

Release 2.0.8 has the following fixes:

  1. Fix reference counting bug in left shift and right shift.
  2. Fix crash when converting string to mpfr and subnormalization is active.
  3. Fix int(mpfr) for negative values.
  4. Fix data corruption bug when using pack() on a list that contains instances of the mpz type.

Release 2.0.7 has the following fixes:

  1. math.floor(gmpy2.mpfr(‘inf’)) no longer segfaults.
  2. The “wheel” format is used for the Windows binaries.

Release 2.0.6 has the following fixes:

  1. setup.py no longer changes the meaning of –prefix.
  2. Using the ‘X’ format code now works properly (convert to hex using upper-case letters).

Project details

Statistics

View statistics for this project via Libraries.io, or by using our public dataset on Google BigQuery

Maintainer: Case Van Horsen

Tags GMP, MPIR, MPFR, MPC, multiple-precision

Maintainers

Classifiers

  • Development Status
    • 5 — Production/Stable

Release history Release notifications | RSS feed

Download files

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

Introduction to gmpy2¶

gmpy2 is a C-coded Python extension module that supports multiple-precision arithmetic. gmpy2 is the successor to the original gmpy module. The gmpy module only supported the GMP multiple-precision library. gmpy2 adds support for the MPFR (correctly rounded real floating-point arithmetic) and MPC (correctly rounded complex floating-point arithmetic) libraries. gmpy2 also updates the API and naming conventions to be more consistent and support the additional functionality.

The following libraries are supported:

GMP for integer and rational arithmetic

MPIR is based on the GMP library but adds support for Microsoft’s Visual Studio compiler. It is used to create the Windows binaries.

MPFR for correctly rounded real floating-point arithmetic

MPC for correctly rounded complex floating-point arithmetic

Generalized Lucas sequences and primality tests are based on the following code:

gmpy2 Versions¶

This manual documents the two major versions of gmpy2. Sections that are specific to a particular version will be identified as such.

There are two versions of gmpy2. The 2.0 version is the stable release that only receives bug fixes and very minor updates. Version 2.1 is currently under active development and includes several new capabilities. Most gmpy2 2.0 code should run unchanged with gmpy2 2.1

Enhancements in gmpy2 2.1¶

The most significant changes in gmpy2 2.1 are:

Changes in gmpy2 2.1.0a1¶

  • Thread-safe contexts are now supported. Properly integrating thread-safe contexts required an extensive rewrite of almost all internal functions. Changing the active context in one thread will no longer change the behavior in other threads.
  • MPFR and MPC are now required. It is no longer possible to build a version of gmpy2 that only supports the GMP library.
  • The function inverse() now raises an exception if the inverse does not exist.
  • Context methods have been added for MPFR/MPC related functions.
  • A new context option (rational_division) has been added that changes the behavior of integer division involving mpz instances to return a rational result instead of a floating point result.
  • gmpy2 types are now registered in the numeric tower.
  • In previous versions of gmpy2, gmpy2.mpz was a factory function that returned an mpz instance. gmpy2.mpz is now an actual type. The same is true for the other gmpy2 types.
  • If a Python object has an __mpz__ method, it will be called by mpz() to allow an unrecognized type to be converted to an mpz instance. The same is true for the other gmpy2 types.
  • Support for Cython via the addition of a C-API and a gmpy2.pxd file.
Читайте также:  Редактор формул windows word

Installation¶

This section will be updated soon to reflect improved support of pip and the wheel format.

Installing gmpy2 on Windows¶

Pre-compiled versions of gmpy2 are available at https://pypi.python.org/pypi/gmpy2 . Please select the installer that corresponds to the version of Python installed on your computer. Note that either a 32 or 64-bit version of Python can be installed on a 64-bit version of Windows. If you get an error message stating that Python could not be found in the registry, you have the wrong version of the gmpy2 installer.

Installing gmpy2 on Unix/Linux¶

Requirements¶

gmpy2 has only been tested with the most recent versions of GMP, MPFR and MPC. Specifically, for integer and rational support, gmpy2 requires GMP 5.0.x or later. To support multiple-precision floating point arithmetic, MPFR 3.1.x or later is required. MPC 1.0.1 or later is required for complex arithmetic.

Short Instructions¶

If your system includes sufficiently recent versions of GMP, MPFR and MPC, and you have the development libraries installed, compiling should be as simple as:

If this fails, read on.

Detailed Instructions¶

If your Linux distribution does not support recent versions of GMP, MPFR and MPC, you will need to compile your own versions. To avoid any possible conflict with existing libraries on your system, it is recommended to use a directory not normally used by your distribution. setup.py will automatically search the following directories for the required libraries:

  1. /opt/local
  2. /opt
  3. /usr/local
  4. /usr
  5. /sw

If you can’t use one of these directories, you can use a directory located in your home directory. The examples will use /home/case/local. If you use one of standard directories (say /opt/local), then you won’t need to specify –prefix=/home/case/local to setup.py but you will need to specify the prefix when compiling GMP, MPFR, and MPC.

Create the desired destination directory for GMP, MPFR, and MPC.

Download and un-tar the GMP source code. Change to the GMP source directory and compile GMP.

Download and un-tar the MPFR source code. Change to the MPFR source directory and compile MPFR.

Download and un-tar the MPC source code. Change to the MPC source directory and compile MPC.

Compile gmpy2 and specify the location of GMP, MPFR and MPC. The location of the GMP, MPFR, and MPC libraries is embedded into the gmpy2 library so the new versions of GMP, MPFR, and MPC do not need to be installed the system library directories. The prefix directory is added to the beginning of the directories that are checked so it will be found first.

If you get a “permission denied” error message, you may need to use:

Options for setup.py¶

© Copyright 2012, 2013, 2014, 2017 Case Van Horsen. Revision 5e8933f5 .

Оцените статью