PyCrypto for Python3 in Alpine?

R J picture R J · Feb 14, 2016 · Viewed 7.4k times · Source

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

After encountering problems with pip3 install pycrypto, I stumbled upon this post which 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 seem to figure out how to call pycrypto for Python3 or even if this package exists.

As an alternative solution, I tried to install the C compiler gcc using apk add gcc so that the setup tools in pip3 install pycrypto can compile. But, when I run that command with gcc already, it throws 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 no way to compile Python3 modules inside Alpine?

Answer

zbyte picture zbyte · Mar 1, 2016

This worked for me:

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

Then do your pip install.