Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyCrypto for Python3 in Alpine?

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?

like image 611
R J Avatar asked Feb 14 '16 19:02

R J


People also ask

How do I run PyCrypto?

PyCrypto is written and tested using Python version 2.1 through 3.3. Python 1.5. 2 is not supported. The modules are packaged using the Distutils, so you can simply run “python setup.py build” to build the package, and “python setup.py install” to install it.

What is Cryptodome in Python?

PyCryptodome is a self-contained Python package of low-level cryptographic primitives. It supports Python 2.7, Python 3.5 and newer, and PyPy. You can install it with: pip install pycryptodome. All modules are installed under the Crypto package.


2 Answers

This worked for me:

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

Then do your pip install.

like image 81
zbyte Avatar answered Oct 26 '22 21:10

zbyte


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

like image 24
Leo Prince Avatar answered Oct 26 '22 21:10

Leo Prince