Cryptography: Installation fail on Raspberry Pi

Created on 23 Aug 2016  路  5Comments  路  Source: pyca/cryptography

pi@raspberrypi:~ $ sudo pip3 install cryptography
Downloading/unpacking cryptography
  Downloading cryptography-1.4.tar.gz (399kB): 399kB downloaded
  Running setup.py (path:/tmp/pip-build-k8ycnehz/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>=2.0 (from cryptography)
  Downloading idna-2.1-py2.py3-none-any.whl (54kB): 54kB downloaded
Downloading/unpacking pyasn1>=0.1.8 (from cryptography)
  Downloading pyasn1-0.1.9-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): six>=1.4.1 in /usr/lib/python3/dist-packages (from cryptography)
Downloading/unpacking setuptools>=11.3 (from cryptography)
  Downloading setuptools-26.0.0-py2.py3-none-any.whl (459kB): 459kB downloaded
Downloading/unpacking cffi>=1.4.1 (from cryptography)
  Downloading cffi-1.7.0.tar.gz (400kB): 400kB downloaded
  Running setup.py (path:/tmp/pip-build-k8ycnehz/cffi/setup.py) egg_info for package cffi
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found

Downloading/unpacking pycparser (from cffi>=1.4.1->cryptography)
  Downloading pycparser-2.14.tar.gz (223kB): 223kB downloaded
  Running setup.py (path:/tmp/pip-build-k8ycnehz/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, setuptools, cffi, pycparser
  Running setup.py install for cryptography
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory
     #include <ffi.h>
                     ^
    compilation terminated.
    Traceback (most recent call last):
      File "/usr/lib/python3.4/distutils/unixccompiler.py", line 116, in _compile
        extra_postargs)
      File "/usr/lib/python3.4/distutils/ccompiler.py", line 909, in spawn
        spawn(cmd, dry_run=self.dry_run)
      File "/usr/lib/python3.4/distutils/spawn.py", line 36, in spawn
        _spawn_posix(cmd, search_path, dry_run=dry_run)
      File "/usr/lib/python3.4/distutils/spawn.py", line 162, in _spawn_posix
        % (cmd, exit_status))
    distutils.errors.DistutilsExecError: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/usr/lib/python3.4/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/lib/python3.4/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python3.4/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/usr/lib/python3/dist-packages/setuptools/command/bdist_egg.py", line 161, in run
        cmd = self.call_command('install_lib', warn_dir=0)
      File "/usr/lib/python3/dist-packages/setuptools/command/bdist_egg.py", line 147, in call_command
        self.run_command(cmdname)
      File "/usr/lib/python3.4/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python3.4/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/usr/lib/python3/dist-packages/setuptools/command/install_lib.py", line 22, in run
        self.build()
      File "/usr/lib/python3.4/distutils/command/install_lib.py", line 109, in build
        self.run_command('build_ext')
      File "/usr/lib/python3.4/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python3.4/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/usr/lib/python3/dist-packages/setuptools/command/build_ext.py", line 54, in run
        _build_ext.run(self)
      File "/usr/lib/python3.4/distutils/command/build_ext.py", line 339, in run
        self.build_extensions()
      File "/usr/lib/python3.4/distutils/command/build_ext.py", line 448, in build_extensions
        self.build_extension(ext)
      File "/usr/lib/python3/dist-packages/setuptools/command/build_ext.py", line 187, in build_extension
        _build_ext.build_extension(self, ext)
      File "/usr/lib/python3.4/distutils/command/build_ext.py", line 503, in build_extension
        depends=ext.depends)
      File "/usr/lib/python3.4/distutils/ccompiler.py", line 574, in compile
        self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
      File "/usr/lib/python3.4/distutils/unixccompiler.py", line 118, in _compile
        raise CompileError(msg)
    distutils.errors.CompileError: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1063, in run_setup
        run_setup(setup_script, args)
      File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 68, in run_setup
        DirectorySandbox(setup_dir).run(runner)
      File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 114, in run
        return func()
      File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 67, in runner
        _execfile(setup_script, ns)
      File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 43, in _execfile
        exec(code, globals, locals)
      File "/tmp/easy_install-i6q1jxb_/cffi-1.7.0/setup.py", line 192, in <module>
        return True
      File "/usr/lib/python3.4/distutils/core.py", line 163, in setup
        raise SystemExit("error: " + str(msg))
    SystemExit: error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-k8ycnehz/cryptography/setup.py", line 333, in <module>
        **keywords_with_side_effects(sys.argv)
      File "/usr/lib/python3.4/distutils/core.py", line 108, in setup
        _setup_distribution = dist = klass(attrs)
      File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 262, in __init__
        self.fetch_build_eggs(attrs['setup_requires'])
      File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 287, in fetch_build_eggs
        replace_conflicting=True,
      File "/usr/lib/python3/dist-packages/pkg_resources.py", line 631, in resolve
        dist = best[req.key] = env.best_match(req, ws, installer)
      File "/usr/lib/python3/dist-packages/pkg_resources.py", line 874, in best_match
        return self.obtain(req, installer)
      File "/usr/lib/python3/dist-packages/pkg_resources.py", line 886, in obtain
        return installer(requirement)
      File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 338, in fetch_build_egg
        return cmd.easy_install(req)
      File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 636, in easy_install
        return self.install_item(spec, dist.location, tmpdir, deps)
      File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 666, in install_item
        dists = self.install_eggs(spec, download, tmpdir)
      File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 856, in install_eggs
        return self.build_and_install(setup_script, setup_base)
      File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1078, in build_and_install
        self.run_setup(setup_script, setup_base, args)
      File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1066, in run_setup
        raise DistutilsError("Setup script exited with %s" % (v.args[0],))
    distutils.errors.DistutilsError: Setup script exited with error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
    Complete output from command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-k8ycnehz/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-1dleu5sj-record/install-record.txt --single-version-externally-managed --compile:
    Package libffi was not found in the pkg-config search path.

Perhaps you should add the directory containing `libffi.pc'

to the PKG_CONFIG_PATH environment variable

No package 'libffi' found

Package libffi was not found in the pkg-config search path.

Perhaps you should add the directory containing `libffi.pc'

to the PKG_CONFIG_PATH environment variable

No package 'libffi' found

Package libffi was not found in the pkg-config search path.

Perhaps you should add the directory containing `libffi.pc'

to the PKG_CONFIG_PATH environment variable

No package 'libffi' found

Package libffi was not found in the pkg-config search path.

Perhaps you should add the directory containing `libffi.pc'

to the PKG_CONFIG_PATH environment variable

No package 'libffi' found

Package libffi was not found in the pkg-config search path.

Perhaps you should add the directory containing `libffi.pc'

to the PKG_CONFIG_PATH environment variable

No package 'libffi' found

c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory

 #include <ffi.h>

                 ^

compilation terminated.

Traceback (most recent call last):

  File "/usr/lib/python3.4/distutils/unixccompiler.py", line 116, in _compile

    extra_postargs)

  File "/usr/lib/python3.4/distutils/ccompiler.py", line 909, in spawn

    spawn(cmd, dry_run=self.dry_run)

  File "/usr/lib/python3.4/distutils/spawn.py", line 36, in spawn

    _spawn_posix(cmd, search_path, dry_run=dry_run)

  File "/usr/lib/python3.4/distutils/spawn.py", line 162, in _spawn_posix

    % (cmd, exit_status))

distutils.errors.DistutilsExecError: command 'arm-linux-gnueabihf-gcc' failed with exit status 1



During handling of the above exception, another exception occurred:



Traceback (most recent call last):

  File "/usr/lib/python3.4/distutils/core.py", line 148, in setup

    dist.run_commands()

  File "/usr/lib/python3.4/distutils/dist.py", line 955, in run_commands

    self.run_command(cmd)

  File "/usr/lib/python3.4/distutils/dist.py", line 974, in run_command

    cmd_obj.run()

  File "/usr/lib/python3/dist-packages/setuptools/command/bdist_egg.py", line 161, in run

    cmd = self.call_command('install_lib', warn_dir=0)

  File "/usr/lib/python3/dist-packages/setuptools/command/bdist_egg.py", line 147, in call_command

    self.run_command(cmdname)

  File "/usr/lib/python3.4/distutils/cmd.py", line 313, in run_command

    self.distribution.run_command(command)

  File "/usr/lib/python3.4/distutils/dist.py", line 974, in run_command

    cmd_obj.run()

  File "/usr/lib/python3/dist-packages/setuptools/command/install_lib.py", line 22, in run

    self.build()

  File "/usr/lib/python3.4/distutils/command/install_lib.py", line 109, in build

    self.run_command('build_ext')

  File "/usr/lib/python3.4/distutils/cmd.py", line 313, in run_command

    self.distribution.run_command(command)

  File "/usr/lib/python3.4/distutils/dist.py", line 974, in run_command

    cmd_obj.run()

  File "/usr/lib/python3/dist-packages/setuptools/command/build_ext.py", line 54, in run

    _build_ext.run(self)

  File "/usr/lib/python3.4/distutils/command/build_ext.py", line 339, in run

    self.build_extensions()

  File "/usr/lib/python3.4/distutils/command/build_ext.py", line 448, in build_extensions

    self.build_extension(ext)

  File "/usr/lib/python3/dist-packages/setuptools/command/build_ext.py", line 187, in build_extension

    _build_ext.build_extension(self, ext)

  File "/usr/lib/python3.4/distutils/command/build_ext.py", line 503, in build_extension

    depends=ext.depends)

  File "/usr/lib/python3.4/distutils/ccompiler.py", line 574, in compile

    self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)

  File "/usr/lib/python3.4/distutils/unixccompiler.py", line 118, in _compile

    raise CompileError(msg)

distutils.errors.CompileError: command 'arm-linux-gnueabihf-gcc' failed with exit status 1



During handling of the above exception, another exception occurred:



Traceback (most recent call last):

  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1063, in run_setup

    run_setup(setup_script, args)

  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 68, in run_setup

    DirectorySandbox(setup_dir).run(runner)

  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 114, in run

    return func()

  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 67, in runner

    _execfile(setup_script, ns)

  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 43, in _execfile

    exec(code, globals, locals)

  File "/tmp/easy_install-i6q1jxb_/cffi-1.7.0/setup.py", line 192, in <module>

    return True

  File "/usr/lib/python3.4/distutils/core.py", line 163, in setup

    raise SystemExit("error: " + str(msg))

SystemExit: error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1



During handling of the above exception, another exception occurred:



Traceback (most recent call last):

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

  File "/tmp/pip-build-k8ycnehz/cryptography/setup.py", line 333, in <module>

    **keywords_with_side_effects(sys.argv)

  File "/usr/lib/python3.4/distutils/core.py", line 108, in setup

    _setup_distribution = dist = klass(attrs)

  File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 262, in __init__

    self.fetch_build_eggs(attrs['setup_requires'])

  File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 287, in fetch_build_eggs

    replace_conflicting=True,

  File "/usr/lib/python3/dist-packages/pkg_resources.py", line 631, in resolve

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

  File "/usr/lib/python3/dist-packages/pkg_resources.py", line 874, in best_match

    return self.obtain(req, installer)

  File "/usr/lib/python3/dist-packages/pkg_resources.py", line 886, in obtain

    return installer(requirement)

  File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 338, in fetch_build_egg

    return cmd.easy_install(req)

  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 636, in easy_install

    return self.install_item(spec, dist.location, tmpdir, deps)

  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 666, in install_item

    dists = self.install_eggs(spec, download, tmpdir)

  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 856, in install_eggs

    return self.build_and_install(setup_script, setup_base)

  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1078, in build_and_install

    self.run_setup(setup_script, setup_base, args)

  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1066, in run_setup

    raise DistutilsError("Setup script exited with %s" % (v.args[0],))

distutils.errors.DistutilsError: Setup script exited with error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-k8ycnehz/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-1dleu5sj-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip-build-k8ycnehz/cryptography
Storing debug log for failure in /root/.pip/pip.log

Most helpful comment

All 5 comments

You need to install all requirements. At least ffi.h is missing on your system. The header file is typically provided by libffi-dev or libffi-devel.

What @tiran said :-)

My bad... didn鈥檛 found any pages about dependencies

Check step 3 on this blog post: https://medium.com/@melzoghbi/deploy-iot-edge-on-raspberry-pi-e9cc9004ea3a

Was this page helpful?
0 / 5 - 0 ratings

Related issues

webknjaz picture webknjaz  路  5Comments

gliush picture gliush  路  3Comments

leesunkeuy picture leesunkeuy  路  8Comments

Harmon758 picture Harmon758  路  3Comments

darkn3rd picture darkn3rd  路  6Comments