Installation

You can install cryptography with pip :

$ pip install cryptography
										

If this does not work please upgrade your pip first, as that is the single most common cause of installation problems.

Supported platforms

Currently we test cryptography on Python 3.7+ and PyPy3 7.3.11+ on these operating systems.

  • x86-64 RHEL 8.x

  • x86-64 CentOS 9 Stream

  • x86-64 Fedora (latest)

  • x86-64 macOS 13 Ventura and ARM64 macOS 14 Sonoma

  • x86-64 Ubuntu 20.04, 22.04, rolling

  • ARM64 Ubuntu 22.04

  • x86-64 Debian Buster (10.x), Bullseye (11.x), Bookworm (12.x), Trixie (13.x), and Sid (unstable)

  • x86-64 and ARM64 Alpine (latest)

  • 32-bit and 64-bit Python on 64-bit Windows Server 2022

We test compiling with clang as well as gcc and use the following OpenSSL releases in addition to distribution provided releases from the above supported platforms:

  • OpenSSL 1.1.1-latest

  • OpenSSL 3.0-latest

  • OpenSSL 3.1-latest

We also test against the latest commit of BoringSSL as well as versions of LibreSSL that are receiving security support at the time of a given cryptography release.

Building cryptography on Windows

The wheel package on Windows is a statically linked build (as of 0.5) so all dependencies are included. To install cryptography , you will typically just run

$ pip install cryptography
												

If you prefer to compile it yourself you’ll need to have OpenSSL installed. You can compile OpenSSL yourself as well or use a binary distribution . Be sure to download the proper version for your architecture and Python (VC2015 is required for 3.7 and above). Wherever you place your copy of OpenSSL you’ll need to set the OPENSSL_DIR environment variable to include the proper location. For example:

C:\> \path\to\vcvarsall.bat x86_amd64
C:\> set OPENSSL_DIR=C:\OpenSSL-win64
C:\> pip install cryptography
													

You will also need to have Rust installed and available .

If you need to rebuild cryptography for any reason be sure to clear the local wheel cache .

Building cryptography on Linux

Note

You should upgrade pip and attempt to install cryptography again before following the instructions to compile it below. Most Linux platforms will receive a binary wheel and require no compiler if you have an updated pip !

cryptography ships manylinux wheels (as of 2.0) so all dependencies are included. For users on pip 19.3 or above running on a manylinux2014 (or greater) compatible distribution (or pip 21.2.4 for musllinux ) all you should need to do is:

$ pip install cryptography
														

If you want to compile cryptography yourself you’ll need a C compiler, a Rust compiler, headers for Python (if you’re not using pypy ), and headers for the OpenSSL and libffi libraries available on your system.

On all Linux distributions you will need to have Rust installed and available .

Alpine

Warning

The Rust available by default in Alpine < 3.17 is older than the minimum supported version. See the Rust installation instructions for information about installing a newer Rust.

$ sudo apk add gcc musl-dev python3-dev libffi-dev openssl-dev cargo pkgconfig
																

If you get an error with openssl-dev you may have to use libressl-dev .

Debian/Ubuntu

Warning

The Rust available in Debian versions prior to Bookworm are older than the minimum supported version. See the Rust installation instructions for information about installing a newer Rust.

$ sudo apt-get install build-essential libssl-dev libffi-dev \
    python3-dev cargo pkg-config
																	

Fedora/RHEL/CentOS

Warning

For RHEL and CentOS you must be on version 8.8 or newer for the command below to install a sufficiently new Rust. If your Rust is less than 1.63.0 please see the Rust installation instructions for information about installing a newer Rust.

$ sudo dnf install redhat-rpm-config gcc libffi-devel python3-devel \
    openssl-devel cargo pkg-config
																

Building

You should now be able to build and install cryptography. To avoid getting the pre-built wheel on manylinux compatible distributions you’ll need to use --no-binary .

$ pip install cryptography --no-binary cryptography