PyCrypto for Python3 in Alpine? PyCrypto for Python3 in Alpine? python python

PyCrypto for Python3 in Alpine?


This worked for me:

apk add gcc g++ make libffi-dev openssl-dev

Then do your pip install.


configure: error: C compiler cannot create executables

In alpine Install their SDK.

For any compiling stuff in Alpine, make sure you have these packages.

alpine-sdk autoconf automake libtool

Install it apk add --no-cache alpine-sdk autoconf automake libtool


PyCrypto seems to have problems with python 3, i had a lot of struggle with that. If you are using Windows, this is the solution that worked for me:

  • Install Visual Studio 2015 with Visual C++ (VS Version 2015 only works if you are using python 3.5+. If you are using 3.4, i think the correct version was VS2010. For earlier versions i am not really sure which version to choose but you can find information about that on the internet)
  • Download the pycrypto source. Currently the stable release is pycrypto-2.6.1. Use this one and not the experimental version below.
  • Extract the archive
  • Edit the file lib/Crypto/Random/OSRNG/nt.py and replace import winrandom with from Crypto.Random.OSRNG import winrandom.
  • Run the following from cmd python setup.py build -c msvc python setup.py install python setup.py test
  • If the test gets you some errors, you might get away with it anyways.

Instructions taken from my github project (dev branch).