2

I've been trying to install the package "flask-ask" on my Raspberry Pi Zero. However, there's a problem when trying to install the dependency "cryptography":

Downloading/unpacking cryptography
  Downloading cryptography-2.2.2.tar.gz (443kB): 443kB downloaded
  Running setup.py (path:/tmp/pip-build-wg353po4/cryptography/setup.py) egg_info for package cryptography
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/tmp/pip-build-wg353po4/cryptography/setup.py", line 28, in <module>
        "cryptography requires setuptools 18.5 or newer, please upgrade to a "
    RuntimeError: cryptography requires setuptools 18.5 or newer, please upgrade to a newer version of setuptools
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

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

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

    "cryptography requires setuptools 18.5 or newer, please upgrade to a "

RuntimeError: cryptography requires setuptools 18.5 or newer, please upgrade to a newer version of setuptools

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip-build-wg353po4/cryptography
Storing debug log for failure in /home/pi/.pip/pip.log

(these logs gotten from trying to install cryptography on its own, but the same error is gotten when installing flask-ask)

I've tried pip3 install -U setuptools to upgrade it, but that doesn't work:

pi@raspberrypi:~ $ pip3 install -U setuptools
Downloading/unpacking setuptools from https://files.pythonhosted.org/packages/7f/e1/820d941153923aac1d49d7fc37e17b6e73bfbd2904959fffbad77900cf92/setuptools-39.2.0-py2.py3-none-any.whl#sha256=8fca9275c89964f13da985c3656cb00ba029d7f3916b37990927ffdf264e7926
  Downloading setuptools-39.2.0-py2.py3-none-any.whl (567kB): 567kB downloaded
Installing collected packages: setuptools
  Found existing installation: setuptools 5.5.1
    Not uninstalling setuptools at /usr/lib/python3/dist-packages, owned by OS
  Can't roll back setuptools; was not uninstalled
Cleaning up...
Exception:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 295, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "/usr/lib/python3/dist-packages/pip/req.py", line 1436, in install
    requirement.install(install_options, global_options, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/pip/req.py", line 672, in install
    self.move_wheel_files(self.source_dir, root=root)
  File "/usr/lib/python3/dist-packages/pip/req.py", line 902, in move_wheel_files
    pycompile=self.pycompile,
  File "/usr/lib/python3/dist-packages/pip/wheel.py", line 214, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/usr/lib/python3/dist-packages/pip/wheel.py", line 208, in clobber
    shutil.copy2(srcfile, destfile)
  File "/usr/lib/python3.4/shutil.py", line 244, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/usr/lib/python3.4/shutil.py", line 108, in copyfile
    with open(dst, 'wb') as fdst:
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.4/dist-packages/easy_install.py'

Storing debug log for failure in /home/pi/.pip/pip.log

So what should I do? I've done a lot of googling of various different things, and I've seen other people have problems with cryptography on the Pi, but not this specific problem.

EDIT: Ok, so I've done pip install --user -U setuptools now, and that works fine. Now I'm getting a totally different error:

    running install_egg_info
    running egg_info
    creating lib/PyYAML.egg-info
    writing lib/PyYAML.egg-info/PKG-INFO
    writing top-level names to lib/PyYAML.egg-info/top_level.txt
    writing dependency_links to lib/PyYAML.egg-info/dependency_links.txt
    writing manifest file 'lib/PyYAML.egg-info/SOURCES.txt'
    reading manifest file 'lib/PyYAML.egg-info/SOURCES.txt'
    writing manifest file 'lib/PyYAML.egg-info/SOURCES.txt'
    Copying lib/PyYAML.egg-info to /home/pi/.local/lib/python2.7/site-packages/PyYAML-3.12$
    running install_scripts
    writing list of installed files to '/tmp/pip-XYXo6X-record/install-record.txt'
  Could not find .egg-info directory in install record for PyYAML==3.12 (from flask-ask)
  Running setup.py install for cryptography
    Running command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-bui$
    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:2:20: fatal error: Python.h: No such file or directory
     #include <Python.h>
                        ^
    compilation terminated.
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-2gl72v/cryptography/setup.py", line 319, in <module>
        **keywords_with_side_effects(sys.argv)
      File "/home/pi/.local/lib/python2.7/site-packages/setuptools/__init__.py", line 128,$
        _install_setup_requires(attrs)
      File "/home/pi/.local/lib/python2.7/site-packages/setuptools/__init__.py", line 123,$
        dist.fetch_build_eggs(dist.setup_requires)
      File "/home/pi/.local/lib/python2.7/site-packages/setuptools/dist.py", line 514, in $
        replace_conflicting=True,
      File "/home/pi/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 7$
        replace_conflicting=replace_conflicting
      File "/home/pi/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1$
        return self.obtain(req, installer)
      File "/home/pi/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1$
        return installer(requirement)
      File "/home/pi/.local/lib/python2.7/site-packages/setuptools/dist.py", line 581, in $
        return cmd.easy_install(req)
      File "/home/pi/.local/lib/python2.7/site-packages/setuptools/command/easy_install.py$
        return self.install_item(spec, dist.location, tmpdir, deps)
      File "/home/pi/.local/lib/python2.7/site-packages/setuptools/command/easy_install.py$
        dists = self.install_eggs(spec, download, tmpdir)
      File "/home/pi/.local/lib/python2.7/site-packages/setuptools/command/easy_install.py$
        return self.build_and_install(setup_script, setup_base)
      File "/home/pi/.local/lib/python2.7/site-packages/setuptools/command/easy_install.py$
        self.run_setup(setup_script, setup_base, args)
      File "/home/pi/.local/lib/python2.7/site-packages/setuptools/command/easy_install.py$
        raise DistutilsError("Setup script exited with %s" % (v.args[0],))
    distutils.errors.DistutilsError: Setup script exited with error: command 'arm-linux-gn$

    Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__=$
    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:2:20: fatal error: Python.h: No such file or directory

 #include <Python.h>

                    ^

compilation terminated.

Traceback (most recent call last):

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

  File "/tmp/pip-build-2gl72v/cryptography/setup.py", line 319, in <module>

    **keywords_with_side_effects(sys.argv)

  File "/home/pi/.local/lib/python2.7/site-packages/setuptools/__init__.py", line 128, in $

    _install_setup_requires(attrs)

  File "/home/pi/.local/lib/python2.7/site-packages/setuptools/__init__.py", line 123, in $

    dist.fetch_build_eggs(dist.setup_requires)

  File "/home/pi/.local/lib/python2.7/site-packages/setuptools/dist.py", line 514, in fetc$

    replace_conflicting=True,

  File "/home/pi/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 770, $

    replace_conflicting=replace_conflicting

  File "/home/pi/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1053,$

    return self.obtain(req, installer)

  File "/home/pi/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1065,$

    return installer(requirement)

  File "/home/pi/.local/lib/python2.7/site-packages/setuptools/dist.py", line 581, in fetc$

    return cmd.easy_install(req)

  File "/home/pi/.local/lib/python2.7/site-packages/setuptools/command/easy_install.py", l$

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

  File "/home/pi/.local/lib/python2.7/site-packages/setuptools/command/easy_install.py", l$

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

  File "/home/pi/.local/lib/python2.7/site-packages/setuptools/command/easy_install.py", l$

    return self.build_and_install(setup_script, setup_base)

  File "/home/pi/.local/lib/python2.7/site-packages/setuptools/command/easy_install.py", l$

    self.run_setup(setup_script, setup_base, args)

  File "/home/pi/.local/lib/python2.7/site-packages/setuptools/command/easy_install.py", l$

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

distutils.errors.DistutilsError: Setup script exited with error: command 'arm-linux-gnueab$

----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-2gl72v/cr$
Exception information:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 295, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1436, in install
    requirement.install(install_options, global_options, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 707, in install
    cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
  File "/usr/lib/python2.7/dist-packages/pip/util.py", line 716, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/$

I have no clue why this is happening at this point.

ATMunn
  • 129
  • 1
  • 9

1 Answers1

0

I've had luck in a similar situation recently by first updating pip.

sudo apt-get install -y python3-pip
sudo pip3 -H pip3 install --upgrade pip
Dave W. Smith
  • 24,318
  • 4
  • 40
  • 46