← Front page
Search

Ubuntu, docker and cryptography

If you need to pip3 install cryptography in your docker images, then you need to also install libffi-dev and libssl-dev. Like this

FROM ubuntu:16.04

RUN apt-get update && \
    apt-get install --quiet --assume-yes \
    libffi-dev \
    libssl-dev \
    python3-pip \
    && apt-get autoremove -y \
    && rm -rf /var/lib/apt/lists/*

RUN pip3 install --upgrade pip \
    cryptography

Otherwise you get errors likes

fatal error: ffi.h: No such file or directory

or

UserWarning: Unknown distribution option: 'python_requires'