How to install cryptography on ubuntu?
Solution 1:
The answer is on the docs of cryptography
's installation section which pretty much reflects Angelos' answer:
Quoting it:
For Debian and Ubuntu, the following command will ensure that the required dependencies are installed:
$ sudo apt-get install build-essential libssl-dev libffi-dev python-dev
For Fedora and RHEL-derivatives, the following command will ensure that the required dependencies are installed:
$ sudo yum install gcc libffi-devel python-devel openssl-devel
You should now be able to build and install cryptography with the usual
$ pip install cryptography
If you're using Python 3, please use python3-dev
instead of python-dev
in the first command. (thanks to @chasmani)
If you're installing this on Ubuntu 18.04
, please use libssl1.0
instead of libssl-dev
in the first command. (thanks to @pobe)
Solution 2:
I had the same problem when pip installing the cryptography module on Ubuntu 14.04. I solved it by installing libffi-dev:
apt-get install -y libffi-dev
Then I got the following error:
build/temp.linux-x86_64-3.4/_openssl.c:431:25: fatal error: openssl/aes.h: No such file or directory
#include <openssl/aes.h>
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Which I resolved by installing libssl-dev:
apt-get install -y libssl-dev
Solution 3:
Installing libssl-dev and python-dev was enough for me on ubuntu 16.04.