Cryptography: Can't install cryptography on alpine:3.8

Created on 30 Jan 2019  路  3Comments  路  Source: pyca/cryptography

Hi.

I'm following instructions from the installation page, and get an error with alpine:3.8 and python2

FROM alpine:3.8

RUN apk update && apk upgrade
RUN apk add gcc musl-dev python-dev libffi-dev openssl-dev py2-pip
RUN pip install cryptography

And the installation process fails with

/ # pip install cryptography
Collecting cryptography
  Downloading https://files.pythonhosted.org/packages/69/ed/5e97b7f54237a9e4e6291b6e52173372b7fa45ca730d36ea90b790c0059a/cryptography-2.5.tar.gz (487kB)
    100% |鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅| 491kB 1.7MB/s
  Could not find a version that satisfies the requirement cffi!=1.11.3,>=1.8 (from versions: )
No matching distribution found for cffi!=1.11.3,>=1.8

Manual installation of cffi doesn't help.

It fails for versions 2.5, 2.4 and works well for 2.3:

pip install cryptography==2.3
...
Successfully installed asn1crypto-0.24.0 cffi-1.11.5 cryptography-2.3 enum34-1.1.6 idna-2.8 ipaddress-1.0.22 pycparser-2.19 six-1.12.0

Most helpful comment

I use the default pip that is available on the newest alpine:3.8.

/ # pip --version
pip 10.0.1 from /usr/lib/python2.7/site-packages/pip (python 2.7)

Heh, I forgot that I can upgrade the pip with the help of the pip itself:

pip install --upgrade pip

And after that the cryptography is installed without problems.
Sorry for the disturbance! :)

I hope the ticket will help if anybody else will search for the solution.

All 3 comments

What version of pip are you using?

I use the default pip that is available on the newest alpine:3.8.

/ # pip --version
pip 10.0.1 from /usr/lib/python2.7/site-packages/pip (python 2.7)

Heh, I forgot that I can upgrade the pip with the help of the pip itself:

pip install --upgrade pip

And after that the cryptography is installed without problems.
Sorry for the disturbance! :)

I hope the ticket will help if anybody else will search for the solution.

Hi I'm getting the same error

    FROM alpine:3.8
    RUN apk update && apk upgrade
    RUN apk add gcc musl-dev python-dev libffi-dev openssl-dev py2-pip
    RUN pip install --upgrade pip
    RUN pip install cryptography==2.3

`error: command 'gcc' failed with exit status 4

ERROR: Command errored out with exit status 1: /usr/bin/python2 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-EgqQlO/cryptography/setup.py'"'"'; __file__='"'"'/tmp/pip-install-EgqQlO/cryptography/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-42ztgE/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.`

Even if I don't mention the cryptography version, I get the same error.

Was this page helpful?
0 / 5 - 0 ratings