Jump to content
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble

MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, register and become a site sponsor/subscriber and ads will be disabled automatically. 


FranceBB

Python 3.5 Runtime Redistributable backported to XP

Recommended Posts

Posted (edited)

Trying to build it now. Despite the fact that I'm building on WinXP, I still had to explicitly tell it to build for WinXP:

perl Configure VC-WIN32 -D_WIN32_WINNT=0x0501

Without the -D just about every test failed; apparently the stupid Configure script just assumes Win 7+ rather than grabbing the version it's actually running on :rolleyes:. That may explain why so many of the "compatible with XP" builds aren't actually compatible with XP.

Edit: Final (apparently XP-compatible) build of OpenSSL v1.1.1b is about 3 MB when written to a .7z archive file. You can download it from my company's Web site.

Edited by Mathwiz
  • Like 2
  • Upvote 4

Share this post


Link to post
Share on other sites

6 hours ago, Mathwiz said:

Final (apparently XP-compatible) build of OpenSSL v1.1.1b is about 3 MB when written to a .7z archive file. You can download it from my company's Web site.

I was able to create a working Cryptography (2.6.1) module for Python 3.4.4 , but the two binaries libcrypto-1_1.dll and libssl-1_1.dll are required. Had to improvise something (is not in the sense of Cryptography module creator), it works and that's the main thing. Now I will do several tests (when the tests are completed, I will make this module available). Thanks a lot! :thumbup

:)

  • Like 1

Share this post


Link to post
Share on other sites
Posted (edited)

The cryptography 2.6.1 module with OpenSSL -1.1.1b (thanks to @Mathwiz) for Python 3.4.4 I have tested so far with the following modules:

altgraph==0.16.1
appdirs==1.4.3
asn1crypto==0.24.0
cffi==1.12.2
colorama==0.4.1
cryptography==2.6.1
future==0.17.1
idna==2.8
macholib==1.11
packaging==19.0
pefile==2018.8.8
pyasn1==0.4.5
pycparser==2.19
PyInstaller==3.4
pyOpenSSL==19.0.0
pyparsing==2.3.1
PySocks==1.6.8
pywin32==221
pywin32-ctypes==0.2.0
six==1.12.0
urllib3==1.24.1
 

For Installing:

Uninstall the older cryptography module beforehand (pip uninstall cryptography), then simply unpack the two directories in the python directory
python34\lib\site-packages.

Download

(The latest cryptography module 2.7.dev1 from March, 11 2019 for testing is also included)

Note:
The manually installed cryptography module can be uninstalled the usual way (pip uninstall cryptography)!

:)

Edited by heinoganda
  • Like 2
  • Upvote 3

Share this post


Link to post
Share on other sites
14 hours ago, heinoganda said:

I was able to create a working Cryptography (2.6.1) module for Python 3.4.4 , but the two binaries libcrypto-1_1.dll and libssl-1_1.dll are required. Had to improvise something (is not in the sense of Cryptography module creator), it works and that's the main thing.

:)

I think this is even better than the original! With the original Cryptography, we had to wait for the Python developers to release a new Cryptography version, incorporating the latest OpenSSL. With your version, we only need to replace the .dll's in C:\Python34\Lib\site-packages\cryptography\hazmat\bindings.

Unfortunately, the copy of MS Visual Studio Express 2010 I used to build OpenSSL is set to expire in 25 days, and M$ no longer provides free registration for VSE 2010 or 2012. :realmad: For VSE 2008, there was a simple workaround involving deleting a registry key, but it doesn't seem to work for VSE 2010. So I'll probably have to install VSE 2015 (along with Perl and NASM) on the Win 7 side in order to build OpenSSL when 1.1.1c comes out.

  • Like 1

Share this post


Link to post
Share on other sites
Posted (edited)
8 hours ago, Mathwiz said:

I think this is even better than the original! With the original Cryptography, we had to wait for the Python developers to release a new Cryptography version, incorporating the latest OpenSSL. With your version, we only need to replace the .dll's in C:\Python34\Lib\site-packages\cryptography\hazmat\bindings.

That does not work. The size of the lib files in your package seemed very small, but I leave no stone unturned. For the missing parts in the lib files (have landed at the files libcrypto-1_1.dll, libssl-1_1.dll and possibly also at capi.dll, padlock.dll) there must be a reference in the lib files to the dll files Especially since without these files an error message from HTTPSProxy is issued because of missing dll files. Part of VS2010 is needed to build the cryptography module in Python 3.4.4 (Microsoft Windows SDK (for Windows 7) DVD (GRMSDK_EN_DVD.iso), maybe the VS2010 on this DVD is enough to create OpenSSL?). Therefore, the files from the Include folder are also needed. If you look at the size of the generated _openssl.pyd file in the newly created Cryptography modules, that is noticeable. I'm glad it works that way because it keeps the puzzle for TLS1.3 moving forward.

The users who use Python version 3.5 or higher need a build with VS2015! The Cryptography module would therefore have to be created under Windows 7 (parts of VS2015 are needed) with your customized OpenSSL variant and hope that this module now works under Windows XP.

 

The procedure in the case of Python 3.7 is identical to that of Python 3.4.4, which means installing Python 3.7 on the Windows 7 machine where a VS2015 is also installed, loading the desired cryptography module from the cryptography project website and before running your OpenSSL package (created with VS2015) copy the lib files from the lib folder to the python37\libs folder and copy the openssl folder to python37\include from the include folder (these files are no longer needed after the module is created). After the module has been created (pip install cryptography-2.6.1.zip), the dll files to python37\lib\site-packages\cryptography\hazmat\bindings have to be manually copied from the bin (from your OpenSSL package) folder, as well as the dll files from the folder lib\engines-1_1. Now make an adjustment to the file installed-files.txt in the python37\lib\site-packages\cryptography%version%-py3.7.egg-info folder where the following lines are added:


..\cryptography\hazmat\bindings\capi.dll
..\cryptography\hazmat\bindings\libcrypto-1_1.dll
..\cryptography\hazmat\bindings\libssl-1_1.dll
..\cryptography\hazmat\bindings\padlock.dll

All __pycache__ folders in python37\lib\site-packages\cryptography and subfolders can be deleted and finally pack the two cryptography folders with 7z or WinRAR.

:)

Edited by heinoganda
  • Upvote 1

Share this post


Link to post
Share on other sites
Posted (edited)
On 3/12/2019 at 3:26 PM, heinoganda said:

maybe the VS2010 on this DVD is enough to create OpenSSL?

Almost. (I assume that unlike me, you have a full version that will not expire!) You also need Perl and NASM. I used Strawberry Perl, available from http://strawberryperl.com. NASM is available from https://www.nasm.us. Both are free. After installing them, make sure both are in your PATH.

Edit: I forgot to mention; once you install Perl you need to install the "Text::Template" module. To do this, enter the command

cpan Text::Template

I created OpenSSL with all default options, except for forcing XP compatibility. VSE 2010 puts a "Visual Studio Command Prompt" on the Start menu. It runs a batch file that sets up the necessary environment variables. I selected that, then ran these commands:

    $ perl Configure VC-WIN32 -D_WIN32_WINNT=0x0501
    $ nmake
    $ nmake test
    $ nmake install

nmake is part of VS2010. The '$' above stands for the C:\> command prompt. The final build was placed in C:\Program Files\OpenSSL.

Unix and OpenVMS support a "no-shared" config option. I didn't try that for this Windows build, but if it works, I assume everything would be built into the .lib files and no .dll files would be built, which I believe is how the Cryptography developers intended it.

Edited by Mathwiz
  • Like 1

Share this post


Link to post
Share on other sites
Posted (edited)
19 minutes ago, Mathwiz said:

Almost. (I assume that unlike me, you have a full version that will not expire!)

A part of VS2010 can be installed from the DVD (GRMSDK_EN_DVD.iso), no licenses needed. Whether that's enough to create OpenSSL unfortunately I do not know.

19 minutes ago, Mathwiz said:

I didn't try that for this Windows build, but if it works, I assume everything would be built into the .lib files and no .dll files would be built, which I believe is how the Cryptography developers intended it.

I do not know. We could test it, but it does not necessarily have to be, especially as it takes time. I'm busy with today's updates.

Again a big thank you for your efforts!:thumbup

:)

Edited by heinoganda

Share this post


Link to post
Share on other sites
Posted (edited)
20 hours ago, heinoganda said:

The users who use Python version 3.5 or higher need a build with VS2015! 

Yesterday I built a (working?) version of the _openssl.pyd extension for Python 3.7.1 using MinGW 4.9.2 (I will be very grateful for any feedback) :

https://www13.zippyshare.com/v/olH5qzDq/file.html

I was forced to use pre-built binaries, LIBS and INCLUDES from the official Python distribution and the previously mentioned project Curl for Windows by Viktor Szakats.

Now you just need to install cryptography 2.6.1, and then replace the files libcrypto-1_1.dll and libssl-1_1.dll in the directory with Python.exe and the _openssl.cp37-win32.pyd file in Lib\site-packages\cryptography\hazmat\bindings

Your version of Cryptography 2.6.1 and the version of OpenSSL 1.1.1b from @Mathwiz also work great for Python 3.4, but I don’t have the opportunity to use Win7+ and VS2015+ to build a version compatible with Python 3.7.1. Thank you all and good luck! :)

version.jpg.b029f47a111f830605d71d59ad9e7d77.jpg

_openssl.jpg.6978f207e8bb87dcd27805c56b661dcb.jpg

Edited by -SnooPY-
Screenshots added

Share this post


Link to post
Share on other sites
On 3/12/2019 at 8:59 AM, Mathwiz said:

Unfortunately, the copy of MS Visual Studio Express 2010 I used to build OpenSSL is set to expire in 25 days, and M$ no longer provides free registration for VSE 2010 or 2012. :realmad: For VSE 2008, there was a simple workaround involving deleting a registry key, but it doesn't seem to work for VSE 2010. So I'll probably have to install VSE 2015 (along with Perl and NASM) on the Win 7 side in order to build OpenSSL when 1.1.1c comes out.

Well, the Sword of Damocles has been removed from my VSE 2010 installation - I found a valid registration key - but I do have Win 7, so I'll give VSE 2015 a try. If it works, I'll still target XP but the build should work with later Python versions.

I'll also add the libcrypto-static and libssl-static .libs to the build archives, so you can build Cryptography either with or without the .dlls.

  • Like 1

Share this post


Link to post
Share on other sites

Well, I installed VSE 2015 on my home PC last night. Didn't yet get a chance to do anything else, though, because the installation took the whole evening! Man, that is a huge piece of bloatware - even including a Windows 10 SDK (which didn't even install for some reason - just as well - but nevertheless wasted about an hour trying, and I think the install file is still wasting space on my HDD)!

Also, with VSE 2015 M$ now makes you create a M$ account in order to get a permanent license key :rolleyes:. I'll do that if I have to, but I may give VSE 2013 a try on my work PC, just to see if it's a bit more reasonably sized and/or licensed and still up to the task.

  • Like 1

Share this post


Link to post
Share on other sites

Hello, i just ran the .exe file, acessed through the above mentioned link. However, Python 3.5 is not listed in the Windows programms list, as ordinary .msi packages do.  Have i done any mistake during the Installation? How can i fix this issue?

Thank you,

Share this post


Link to post
Share on other sites

Unfortunately Python 3.5 isn't a full package, so it's not as user-friendly as the official Python 3.4.4 package is. I think you'll have to create your own Python 3.5 folder in the Start menu. Put two shortcuts in the folder you create: one to <Python 3.5 installation path>\python.exe, named Python 3.5 command line, and one to <Python 3.5 installation path>\doc\python350.chm, named Python 3.5 Manuals. Hopefully that will at least get you started.

  • Like 1

Share this post


Link to post
Share on other sites
Posted (edited)

Thank you Mathwiz.

However, i would like to use python 3.5 through the Windows Command line, in order to easily upgrade pip, install jupyter, tensorflow, keras, e.t.c.  The problem with Python command prompt, in all python versions, is that it routinely pops Syntax Error: Invalid Syntax. This makes Python Command Prompt almost unusable.

P.S. I already tried to change system variables > Path, but then the command Python is not recognised at all. Previously, i tried to use Anaconda, but to no avail· it only recognises python 3.4

pythonproblem.jpg

Edited by Python Lvl.1
P.S.

Share this post


Link to post
Share on other sites

IIRC it didn't even come with PIP installed. So you'll need to install it if you haven't done so already. (If you need to install it, there's a Python script get-pip.py that will do the job at https://bootstrap.pypa.io/get-pip.py. Download it and type py get-pip.py to run it.)

Once installed, I'm pretty sure you run commands like 'pip help' from the Windows command line, not the Python command line:

untitled.PNG.07df1200331cad0afa73f03190a0f5b0.PNG

  • Like 1

Share this post


Link to post
Share on other sites
Posted (edited)

This mostly worked (albeit with pip install -U instead of pip install). However, a new problem arised with the jupyter notebook. Whenever i attempt to run the notebook, it pops up this: ImportError: cannot import name 'Type' This seems to originate from the tornado package. Also, when i attempt to install packages like Theano, Keras, or Cntk, nothing happens. Does anyone in the community have any idea about what's going on?

Thank you,

P.S. A similar problem arises with cetain installation packages, stating "No matching distributions found"

jupyter.jpg

theano.jpg

Edited by Python Lvl.1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...