blob: 4ab518e4bd6205db812c1ffc26f4e329d972501d [file] [log] [blame]
Alex Stapletonc5fffd32014-03-18 15:29:00 +00001Frequently asked questions
Alex Gaynorde06b292014-02-18 16:40:09 -08002==========================
3
Paul Kehrerc38e5502017-06-19 00:54:12 -10004``cryptography`` failed to install!
5-----------------------------------
6
7If you are having issues installing ``cryptography`` the first troubleshooting
8step is to upgrade ``pip`` and then try to install again. For most users this will
9take the form of ``pip install -U pip``, but on Windows you should do
10``python -m pip install -U pip``. If you are still seeing errors after upgrading
11and trying ``pip install cryptography`` again, please see the :doc:`/installation`
12documentation.
13
Alex Gaynor59a6bc62014-02-18 18:13:48 -080014How does ``cryptography`` compare to NaCl (Networking and Cryptography Library)?
Alex Gaynorde06b292014-02-18 16:40:09 -080015--------------------------------------------------------------------------------
16
17While ``cryptography`` and `NaCl`_ both share the goal of making cryptography
18easier, and safer, to use for developers, ``cryptography`` is designed to be a
Alex Gaynorc37adab2014-02-18 16:46:58 -080019general purpose library, interoperable with existing systems, while NaCl
20features a collection of hand selected algorithms.
Alex Gaynorde06b292014-02-18 16:40:09 -080021
Alex Gaynor5809d482014-02-19 13:33:18 -080022``cryptography``'s :ref:`recipes <cryptography-layout>` layer has similar goals
23to NaCl.
Alex Gaynorde06b292014-02-18 16:40:09 -080024
25If you prefer NaCl's design, we highly recommend `PyNaCl`_.
26
Paul Kehrerf916dfc2017-05-27 14:24:28 -050027Why use ``cryptography``?
28-------------------------
29
30If you've done cryptographic work in Python before you have likely encountered
31other libraries in Python such as *M2Crypto*, *PyCrypto*, or *PyOpenSSL*. In
32building ``cryptography`` we wanted to address a few issues we observed in the
33legacy libraries:
34
35* Extremely error prone APIs and insecure defaults.
36* Use of poor implementations of algorithms (i.e. ones with known side-channel
37 attacks).
38* Lack of maintenance.
39* Lack of high level APIs.
40* Lack of PyPy and Python 3 support.
Paul Kehrerf916dfc2017-05-27 14:24:28 -050041* Absence of algorithms such as
42 :class:`AES-GCM <cryptography.hazmat.primitives.ciphers.modes.GCM>` and
43 :class:`~cryptography.hazmat.primitives.kdf.hkdf.HKDF`.
44
Alex Gaynor06049442017-03-15 12:21:45 -040045Compiling ``cryptography`` on macOS produces a ``fatal error: 'openssl/aes.h' file not found`` error
46----------------------------------------------------------------------------------------------------
Alex Gaynorc77db592016-03-09 07:12:06 -050047
Alex Gaynor06049442017-03-15 12:21:45 -040048This happens because macOS 10.11 no longer includes a copy of OpenSSL.
Alex Gaynorc77db592016-03-09 07:12:06 -050049``cryptography`` now provides wheels which include a statically linked copy of
50OpenSSL. You're seeing this error because your copy of pip is too old to find
51our wheel files. Upgrade your copy of pip with ``pip install -U pip`` and then
52try install ``cryptography`` again.
Alex Gaynor0fa997b2016-03-09 07:13:04 -050053
Alex Gaynore660ffe2017-04-09 09:19:02 -040054If you are using PyPy, we do not currently ship ``cryptography`` wheels for
55PyPy. You will need to install your own copy of OpenSSL -- we recommend using
56Homebrew.
57
Paul Kehrerfcf6fca2016-03-12 16:21:24 -040058Starting ``cryptography`` using ``mod_wsgi`` produces an ``InternalError`` during a call in ``_register_osrandom_engine``
59-------------------------------------------------------------------------------------------------------------------------
60
Paul Kehrer66a23722017-01-18 13:42:09 +080061Upgrade to the latest ``cryptography`` and this issue should be resolved.
Paul Kehrerfcf6fca2016-03-12 16:21:24 -040062
63``cryptography`` raised an ``InternalError`` and I'm not sure what to do?
64-------------------------------------------------------------------------
65
66Frequently ``InternalError`` is raised when there are errors on the OpenSSL
67error stack that were placed there by other libraries that are also using
68OpenSSL. Try removing the other libraries and see if the problem persists.
Paul Kehrer4e9bd8c2016-03-12 16:33:39 -040069If you have no other libraries using OpenSSL in your process, or they do not
70appear to be at fault, it's possible that this is a bug in ``cryptography``.
71Please file an `issue`_ with instructions on how to reproduce it.
Paul Kehrerfcf6fca2016-03-12 16:21:24 -040072
Paul Kehrerbd7cd2d2017-02-13 20:01:06 -060073Installing ``cryptography`` fails with ``ImportError: No module named setuptools_ext``
74--------------------------------------------------------------------------------------
75
76Your ``cffi`` package is out of date. ``pip install -U cffi`` to update it.
77
Paul Kehrerc7ecb452017-09-12 10:26:33 +080078error: ``-Werror=sign-conversion``: No option ``-Wsign-conversion`` during installation
79---------------------------------------------------------------------------------------
80
81The compiler you are using is too old and not supported by ``cryptography``.
82Please upgrade to a more recent version. If you are running OpenBSD 6.1 or
83earlier the default compiler is extremely old. Use ``pkg_add`` to install a
84newer ``gcc`` and then install ``cryptography`` using
85``CC=/path/to/newer/gcc pip install cryptography``.
86
Paul Kehrerd0db04c2017-10-12 12:38:06 +080087Installing ``cryptography`` fails with ``Invalid environment marker: python_version < '3'``
88-------------------------------------------------------------------------------------------
89
90Your ``pip`` and/or ``setuptools`` are outdated. Please upgrade to the latest
91versions with ``pip install -U pip setuptools`` (or on Windows
92``python -m pip install -U pip setuptools``).
93
Alex Gaynor0e8cdf12016-12-13 21:05:35 -050094Installing cryptography with OpenSSL 0.9.8 or 1.0.0 fails
95---------------------------------------------------------
Alex Gaynor29b2ebc2016-11-22 09:25:17 -050096
Alex Gaynor0e8cdf12016-12-13 21:05:35 -050097The OpenSSL project has dropped support for the 0.9.8 and 1.0.0 release series.
98Since they are no longer receiving security patches from upstream,
99``cryptography`` is also dropping support for them. To fix this issue you
100should upgrade to a newer version of OpenSSL (1.0.1 or later). This may require
101you to upgrade to a newer operating system.
Alex Gaynor5d382062016-03-19 12:02:14 -0400102
Alex Gaynor0fa997b2016-03-09 07:13:04 -0500103.. _`NaCl`: https://nacl.cr.yp.to/
Alex Gaynor988df9b2016-04-28 10:57:16 -0400104.. _`PyNaCl`: https://pynacl.readthedocs.io
105.. _`WSGIApplicationGroup`: https://modwsgi.readthedocs.io/en/develop/configuration-directives/WSGIApplicationGroup.html
Paul Kehrer4e9bd8c2016-03-12 16:33:39 -0400106.. _`issue`: https://github.com/pyca/cryptography/issues