Cryptography: pip install fails on dependencies

Created on 19 May 2015  路  7Comments  路  Source: pyca/cryptography

Tested with _python 2.7.8_ (brew) on _OSX 10.10.4_ and pip==1.5.6.

pip install cryptography on a fresh virtualenv fails if all the dependencies have not been manually installed in beforehand:

$ pip install cryptography
Downloading/unpacking cryptography
  Using download cache from /Users/stefanfoulis/Caches/pip-downloads/https%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2Fc%2Fcryptography%2Fcryptography-0.9.tar.gz
  Running setup.py (path:/Users/stefanfoulis/.virtualenvs/tmp-cryptography/build/cryptography/setup.py) egg_info for package cryptography

    no previously-included directories found matching 'docs/_build'
    warning: no previously-included files matching '*' found under directory 'vectors'
Downloading/unpacking idna (from cryptography)
  Using download cache from /Users/stefanfoulis/Caches/pip-downloads/https%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2Fi%2Fidna%2Fidna-2.0.tar.gz
  Running setup.py (path:/Users/stefanfoulis/.virtualenvs/tmp-cryptography/build/idna/setup.py) egg_info for package idna

    warning: no previously-included files matching '*.pyc' found under directory 'tools'
    warning: no previously-included files matching '*.pyc' found under directory 'tests'
Downloading/unpacking pyasn1 (from cryptography)
  Using download cache from /Users/stefanfoulis/Caches/pip-downloads/https%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2Fp%2Fpyasn1%2Fpyasn1-0.1.7.tar.gz
  Running setup.py (path:/Users/stefanfoulis/.virtualenvs/tmp-cryptography/build/pyasn1/setup.py) egg_info for package pyasn1

Downloading/unpacking six>=1.4.1 (from cryptography)
  Using download cache from /Users/stefanfoulis/Caches/pip-downloads/https%3A%2F%2Fpypi.python.org%2Fpackages%2F3.3%2Fs%2Fsix%2Fsix-1.9.0-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): setuptools in /Users/stefanfoulis/.virtualenvs/tmp-cryptography/lib/python2.7/site-packages (from cryptography)
Downloading/unpacking enum34 (from cryptography)
  Using download cache from /Users/stefanfoulis/Caches/pip-downloads/https%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2Fe%2Fenum34%2Fenum34-1.0.4.tar.gz
  Running setup.py (path:/Users/stefanfoulis/.virtualenvs/tmp-cryptography/build/enum34/setup.py) egg_info for package enum34

Downloading/unpacking ipaddress (from cryptography)
  Using download cache from /Users/stefanfoulis/Caches/pip-downloads/https%3A%2F%2Fpypi.python.org%2Fpackages%2F2.7%2Fi%2Fipaddress%2Fipaddress-1.0.7-py27-none-any.whl
Downloading/unpacking cffi>=0.8 (from cryptography)
  Using download cache from /Users/stefanfoulis/Caches/pip-downloads/https%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2Fc%2Fcffi%2Fcffi-0.9.2.tar.gz
  Running setup.py (path:/Users/stefanfoulis/.virtualenvs/tmp-cryptography/build/cffi/setup.py) egg_info for package cffi

Downloading/unpacking pycparser (from cffi>=0.8->cryptography)
  Using download cache from /Users/stefanfoulis/Caches/pip-downloads/https%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2Fp%2Fpycparser%2Fpycparser-2.13.tar.gz
  Running setup.py (path:/Users/stefanfoulis/.virtualenvs/tmp-cryptography/build/pycparser/setup.py) egg_info for package pycparser

    warning: no previously-included files matching 'yacctab.*' found under directory 'tests'
    warning: no previously-included files matching 'lextab.*' found under directory 'tests'
    warning: no previously-included files matching 'yacctab.*' found under directory 'examples'
    warning: no previously-included files matching 'lextab.*' found under directory 'examples'
Installing collected packages: cryptography, idna, pyasn1, six, enum34, ipaddress, cffi, pycparser
  Running setup.py install for cryptography
    No local packages or download links found for cffi>=0.8
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/Users/stefanfoulis/.virtualenvs/tmp-cryptography/build/cryptography/setup.py", line 342, in <module>
        **keywords_with_side_effects(sys.argv)
      File "/usr/local/Cellar/python/2.7.8_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 111, in setup
        _setup_distribution = dist = klass(attrs)
      File "/Users/stefanfoulis/.virtualenvs/tmp-cryptography/lib/python2.7/site-packages/setuptools/dist.py", line 260, in __init__
        self.fetch_build_eggs(attrs.pop('setup_requires'))
      File "/Users/stefanfoulis/.virtualenvs/tmp-cryptography/lib/python2.7/site-packages/setuptools/dist.py", line 285, in fetch_build_eggs
        replace_conflicting=True
      File "/Users/stefanfoulis/.virtualenvs/tmp-cryptography/lib/python2.7/site-packages/pkg_resources.py", line 631, in resolve
        dist = best[req.key] = env.best_match(req, ws, installer)
      File "/Users/stefanfoulis/.virtualenvs/tmp-cryptography/lib/python2.7/site-packages/pkg_resources.py", line 871, in best_match
        return self.obtain(req, installer)
      File "/Users/stefanfoulis/.virtualenvs/tmp-cryptography/lib/python2.7/site-packages/pkg_resources.py", line 883, in obtain
        return installer(requirement)
      File "/Users/stefanfoulis/.virtualenvs/tmp-cryptography/lib/python2.7/site-packages/setuptools/dist.py", line 335, in fetch_build_egg
        return cmd.easy_install(req)
      File "/Users/stefanfoulis/.virtualenvs/tmp-cryptography/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 589, in easy_install
        raise DistutilsError(msg)
    distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('cffi>=0.8')
    Complete output from command /Users/stefanfoulis/.virtualenvs/tmp-cryptography/bin/python2.7 -c "import setuptools, tokenize;__file__='/Users/stefanfoulis/.virtualenvs/tmp-cryptography/build/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/b2/8g_t1yw91z5d5nq46xj11sn80000gn/T/pip-NvGsOk-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/stefanfoulis/.virtualenvs/tmp-cryptography/bin/../include/site/python2.7:
    No local packages or download links found for cffi>=0.8

Traceback (most recent call last):

  File "<string>", line 1, in <module>

  File "/Users/stefanfoulis/.virtualenvs/tmp-cryptography/build/cryptography/setup.py", line 342, in <module>

    **keywords_with_side_effects(sys.argv)

  File "/usr/local/Cellar/python/2.7.8_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 111, in setup

    _setup_distribution = dist = klass(attrs)

  File "/Users/stefanfoulis/.virtualenvs/tmp-cryptography/lib/python2.7/site-packages/setuptools/dist.py", line 260, in __init__

    self.fetch_build_eggs(attrs.pop('setup_requires'))

  File "/Users/stefanfoulis/.virtualenvs/tmp-cryptography/lib/python2.7/site-packages/setuptools/dist.py", line 285, in fetch_build_eggs

    replace_conflicting=True

  File "/Users/stefanfoulis/.virtualenvs/tmp-cryptography/lib/python2.7/site-packages/pkg_resources.py", line 631, in resolve

    dist = best[req.key] = env.best_match(req, ws, installer)

  File "/Users/stefanfoulis/.virtualenvs/tmp-cryptography/lib/python2.7/site-packages/pkg_resources.py", line 871, in best_match

    return self.obtain(req, installer)

  File "/Users/stefanfoulis/.virtualenvs/tmp-cryptography/lib/python2.7/site-packages/pkg_resources.py", line 883, in obtain

    return installer(requirement)

  File "/Users/stefanfoulis/.virtualenvs/tmp-cryptography/lib/python2.7/site-packages/setuptools/dist.py", line 335, in fetch_build_egg

    return cmd.easy_install(req)

  File "/Users/stefanfoulis/.virtualenvs/tmp-cryptography/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 589, in easy_install

    raise DistutilsError(msg)

distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('cffi>=0.8')

----------------------------------------
Cleaning up...
Command /Users/stefanfoulis/.virtualenvs/tmp-cryptography/bin/python2.7 -c "import setuptools, tokenize;__file__='/Users/stefanfoulis/.virtualenvs/tmp-cryptography/build/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/b2/8g_t1yw91z5d5nq46xj11sn80000gn/T/pip-NvGsOk-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/stefanfoulis/.virtualenvs/tmp-cryptography/bin/../include/site/python2.7 failed with error code 1 in /Users/stefanfoulis/.virtualenvs/tmp-cryptography/build/cryptography
Storing debug log for failure in /Users/stefanfoulis/.pip/pip.log

Manually running pip install cffi will allow cryptography to go a step further, but will also fail on ipaddress, enum34, six, idna and pycparser.

It seems to work on ubuntu 14.04 with pip==1.5.6 and pip==6.1.1 though. So I'm not entirely sure this is a cryptography issue.

Most helpful comment

I solved this problem after I installed cffi.
pip install cffi
Successfully installed cffi-1.11.4 pycparser-2.18
Successfully installed ansible-2.4.2.0 cryptography-2.1.4

All 7 comments

What version of setuptools is in your venv? (Paging @dstufft)

No feedback here, closing for now. Will reopen if there's more info.

The same issue, virtualenv version is 1.11.6.

@alex @reaperhulk Same issue on my Raspberry Pi running Debian Wheezy (linux kernel v4.1.19), python 2.7, setuptools version 28.2.0. If I install the packages mentioned above manually, cryptography finally installs like a charm.

the same error.....
I tried to install libffi-devel once again, then it successed.
$yum install libffi-devel

Wow - I updated virtualenv (1.11.6 -> 15.0.3) and this problem went away. 馃檶

I solved this problem after I installed cffi.
pip install cffi
Successfully installed cffi-1.11.4 pycparser-2.18
Successfully installed ansible-2.4.2.0 cryptography-2.1.4

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MortenEriksen picture MortenEriksen  路  5Comments

NikolaiT picture NikolaiT  路  4Comments

darkn3rd picture darkn3rd  路  6Comments

BobbyGR picture BobbyGR  路  5Comments

webknjaz picture webknjaz  路  7Comments