aleaxit / gmpy

General Multi-Precision arithmetic for Python 2.6+/3+ (GMP, MPIR, MPFR, MPC)
https://gmpy2.readthedocs.io/en/latest/
GNU Lesser General Public License v3.0
521 stars 86 forks source link

installing gmpy2.0.7 on Windows 10 pc #102

Open ChVanDijken opened 8 years ago

ChVanDijken commented 8 years ago

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.

casevh commented 8 years ago

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>cd Scripts

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

C:\64\Python34\Scripts>

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/~gohlke/pythonlibs/

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.

Case

ChVanDijken commented 8 years ago

Hi Case,

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.

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!

Christiaan.

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>cd Scripts

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

C:\64\Python34\Scripts>

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/~gohlke/pythonlibs/

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.

Case


Reply to this email directly or view it on GitHub: https://github.com/aleaxit/gmpy/issues/102#issuecomment-163488758

ChVanDijken commented 8 years ago

Hi Case,

I have just tried out Python 3.5.1; it comes in a 32-bit version only. Recently, it has been discovered that running 32-bit software on 64-bit machines can also create a security problem, because of an attack on the compatibility system. In addition to not being able to use your gmpy2, I discovered that with Python 3.5.3 I had to type the ".py" extension in order for the program to run, even though I had set the ".py"-default for python, which was located in a very unusual, deep down, directory this time. Even worse, the running time was increased by a factor of almost 2.39. So I have gone back to Python 3.4.3. Thought you might want to know. I do wish you success with your work on gmpy2, but do wonder why those guys developing Python 3.5 are coming out with 32-bit software, whereas, to my knowledge, most computers sold today have 64-bit processors.

Best regards, Christiaan.

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>cd Scripts

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

C:\64\Python34\Scripts>

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/~gohlke/pythonlibs/

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.

Case


Reply to this email directly or view it on GitHub: https://github.com/aleaxit/gmpy/issues/102#issuecomment-163488758

ChVanDijken commented 8 years ago

Hi Case,

Apparently, you haven't been able yet to come up with a version of your gmpy that is compatible with python 3.5.2. Here follows an observation of mine followed by what may be a stupid question in your eyes.

Last night I discovered that programs I had written using urllib3 no longer could execute. These programs had been written using python 3.4. I now have python 3.5.2 installed. A big difference with python 3.4 is that it is installed in a totally different location than python 3.4, and on down. The original installation of urllib3 took place from c:\python34\scripts. So today I installed urllib3 once again, this time from c:\users\christiaan\appdata\local\programs\python\python35\scripts. This installation ran as hoped, and above-mentioned programs are functioning once again. Because you appear to be not using a windows environment, this radical change of default installation directories may have escaped your attention? Because python 3.4.4 is said to contain a vulnerability, I am no longer using it, which at present implies I can no longer use gmpy, which in turn means some programs of mine run 6 times slower than need be.

Sincerely,

Christiaan van Dijken.

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>cd Scripts

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

C:\64\Python34\Scripts>

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/~gohlke/pythonlibs/

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.

Case


Reply to this email directly or view it on GitHub: https://github.com/aleaxit/gmpy/issues/102#issuecomment-163488758