Skip to content

default_backend() fails on OS X El Capitan and Ubuntu (others?) #2907

@emonti

Description

@emonti

I'm following the installation guide and my expectation is that a simple 'pip install cryptography' should work, however it does not appear to give me a working build since no backends are available?.

I have openssl installed via homebrew:

    ~/cryptotest brew install openssl
    Warning: openssl-1.0.2h already installed

Using a virtualenv:

    ~/cryptotest virtualenv venv
    New python executable in /Users/em/cryptotest/venv/bin/python2.7
    Also creating executable in /Users/em/cryptotest/venv/bin/python
    Installing setuptools, pip, wheel...done.
    ~/cryptotest . venv/bin/activate
    (venv) ~/cryptotest python --version
    Python 2.7.10

Install with pip

    (venv) ~/cryptotest pip install --no-cache-dir cryptography
    Collecting cryptography
      Downloading cryptography-1.3.2-cp27-none-macosx_10_6_intel.whl (1.4MB)
        100% |████████████████████████████████| 1.4MB 89.5MB/s
    Requirement already satisfied (use --upgrade to upgrade): setuptools>=11.3 in ./venv/lib/python2.7/site-packages (from cryptography)
    Collecting enum34 (from cryptography)
      Downloading enum34-1.1.5-py2.py3-none-any.whl (61kB)
        100% |████████████████████████████████| 71kB 67.4MB/s
    Collecting ipaddress (from cryptography)
      Downloading ipaddress-1.0.16-py27-none-any.whl
    Collecting pyasn1>=0.1.8 (from cryptography)
      Downloading pyasn1-0.1.9-py2.py3-none-any.whl
    Collecting six>=1.4.1 (from cryptography)
      Downloading six-1.10.0-py2.py3-none-any.whl
    Collecting idna>=2.0 (from cryptography)
      Downloading idna-2.1-py2.py3-none-any.whl (54kB)
        100% |████████████████████████████████| 61kB 95.1MB/s
    Collecting cffi>=1.4.1 (from cryptography)
      Downloading cffi-1.6.0-cp27-cp27m-macosx_10_10_intel.whl (211kB)
        100% |████████████████████████████████| 215kB 103.4MB/s
    Collecting pycparser (from cffi>=1.4.1->cryptography)
      Downloading pycparser-2.14.tar.gz (223kB)
        100% |████████████████████████████████| 225kB 102.1MB/s
    Installing collected packages: enum34, ipaddress, pyasn1, six, idna, pycparser, cffi, cryptography
      Running setup.py install for pycparser ... done
    Successfully installed cffi-1.6.0 cryptography-1.3.2 enum34-1.1.5 idna-2.1 ipaddress-1.0.16 pyasn1-0.1.9 pycparser-2.14 six-1.10.0
    (venv) ~/cryptotest ipython
    WARNING: Attempting to work in a virtualenv. If you encounter problems, please install IPython inside the virtualenv.
    Python 2.7.10 (default, Oct 23 2015, 19:19:21)
    Type "copyright", "credits" or "license" for more information.

    IPython 3.1.0 -- An enhanced Interactive Python.
    ?         -> Introduction and overview of IPython's features.
    %quickref -> Quick reference.
    help      -> Python's own help system.
    object?   -> Details about 'object', use 'object??' for extra details.

    In [1]: from cryptography.hazmat.backends import default_backend

    In [2]: default_backend()
    ---------------------------------------------------------------------------
    ValueError                                Traceback (most recent call last)
    <ipython-input-2-fcfa6195e3cc> in <module>()
    ----> 1 default_backend()

    /Users/em/cryptotest/venv/lib/python2.7/site-packages/cryptography/hazmat/backends/__init__.pyc in default_backend()
         33
         34     if _default_backend is None:
    ---> 35         _default_backend = MultiBackend(_available_backends())
         36
         37     return _default_backend

    /Users/em/cryptotest/venv/lib/python2.7/site-packages/cryptography/hazmat/backends/multibackend.pyc in __init__(self, backends)
         31         if len(backends) == 0:
         32             raise ValueError(
    ---> 33                 "Multibackend cannot be initialized with no backends. If you "
         34                 "are seeing this error when trying to use default_backend() "
         35                 "please try uninstalling and reinstalling cryptography."

    ValueError: Multibackend cannot be initialized with no backends. If you are seeing this error when trying to use default_backend() please try uninstalling and reinstalling cryptography.

    In [3]: import cryptography.hazmat.backends

    In [4]: cryptography.hazmat.backends._available_backends()
    Out[4]: []

I am on OS X El Capitan 10.11.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions