PyCrypto for Python3 in Alpine?

Is there a package for Alpine that allows me to install PyCrypto for Python 3?

After having problems with pip3 install pycrypto I came across this post that explains how to install numpy in Alpine using apk add py-numpy@testing . PyCrypto can also be installed for Python2.7 using apk add py-crypto . However, I cannot figure out how to call pycrypto for Python3 or even if this package exists.

As an alternative solution, I tried installing the C gcc compiler using apk add gcc so that the configuration tools in pip3 install pycrypto could compile. But when I run this command with gcc already, it causes a fatal error:

 ... running build_ext running build_configure checking for gcc... gcc checking whether the C compiler works... no configure: error: in `/tmp/pip-build-2TivSm/pycrypto': configure: error: C compiler cannot create executables ... 

Is there a way to compile Python3 modules inside Alpine?

+7
python pycrypto alpine
source share
2 answers

This worked for me:

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

Then configure pip.

+12
source share

PyCrypto seems to have issues with python 3, I had a lot of struggle with this. 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'm not quite sure which select version but you can find information about it on the Internet)
  • Download the pycrypto source . Currently, the stable release is pycrypto-2.6.1. Use this rather than the experimental version below.
  • Extract 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 you get some errors as a result of the test, you can leave with it anyway.

Instructions taken from my github project (dev branch).

-2
source share

All Articles