Openwhisk: error installing ansible via pip

Created on 3 May 2016  路  3Comments  路  Source: apache/openwhisk

Follow instructions in README to setup using Vagrant
Run (cd openwhisk/tools/ubuntu-setup && source all.sh)

++ echo '*** installing ansible'
*** installing ansible
++ source ./ansible.sh
+++ sudo pip install ansible==2.0.2.0
Downloading/unpacking ansible==2.0.2.0
  Downloading ansible-2.0.2.0.tar.gz (1.5MB): 1.5MB downloaded
  Running setup.py (path:/tmp/pip_build_root/ansible/setup.py) egg_info for package ansible

    no previously-included directories found matching 'v2'
    no previously-included directories found matching 'docsite'
    no previously-included directories found matching 'ticket_stubs'
    no previously-included directories found matching 'packaging'
    no previously-included directories found matching 'test'
    no previously-included directories found matching 'hacking'
    warning: no previously-included files found matching 'lib/ansible/modules/core/.git*'
    warning: no previously-included files found matching 'lib/ansible/modules/extras/.git*'
    no previously-included directories found matching 'lib/ansible/modules/core/.git'
    no previously-included directories found matching 'lib/ansible/modules/extras/.git'
Downloading/unpacking paramiko (from ansible==2.0.2.0)
  Downloading paramiko-2.0.0-py2.py3-none-any.whl (170kB): 170kB downloaded
Downloading/unpacking jinja2 (from ansible==2.0.2.0)
  Downloading Jinja2-2.8-py2.py3-none-any.whl (263kB): 263kB downloaded
Requirement already satisfied (use --upgrade to upgrade): PyYAML in /usr/lib/python2.7/dist-packages (from ansible==2.0.2.0)
Requirement already satisfied (use --upgrade to upgrade): setuptools in /usr/lib/python2.7/dist-packages (from ansible==2.0.2.0)
Requirement already satisfied (use --upgrade to upgrade): pycrypto>=2.6 in /usr/lib/python2.7/dist-packages (from ansible==2.0.2.0)
Downloading/unpacking pyasn1>=0.1.7 (from paramiko->ansible==2.0.2.0)
  Downloading pyasn1-0.1.9-py2.py3-none-any.whl
Downloading/unpacking cryptography>=1.1 (from paramiko->ansible==2.0.2.0)
  Downloading cryptography-1.3.1.tar.gz (383kB): 383kB downloaded
  Running setup.py (path:/tmp/pip_build_root/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 MarkupSafe (from jinja2->ansible==2.0.2.0)
  Downloading MarkupSafe-0.23.tar.gz
  Running setup.py (path:/tmp/pip_build_root/MarkupSafe/setup.py) egg_info for package MarkupSafe

Downloading/unpacking idna>=2.0 (from cryptography>=1.1->paramiko->ansible==2.0.2.0)
  Downloading idna-2.1-py2.py3-none-any.whl (54kB): 54kB downloaded
Requirement already satisfied (use --upgrade to upgrade): six>=1.4.1 in /usr/lib/python2.7/dist-packages (from cryptography>=1.1->paramiko->ansible==2.0.2.0)
Downloading/unpacking enum34 (from cryptography>=1.1->paramiko->ansible==2.0.2.0)
  Downloading enum34-1.1.4-py2.py3-none-any.whl (61kB): 61kB downloaded
Downloading/unpacking ipaddress (from cryptography>=1.1->paramiko->ansible==2.0.2.0)
  Downloading ipaddress-1.0.16-py27-none-any.whl
Downloading/unpacking cffi>=1.4.1 (from cryptography>=1.1->paramiko->ansible==2.0.2.0)
  Downloading cffi-1.6.0.tar.gz (397kB): 397kB downloaded
  Running setup.py (path:/tmp/pip_build_root/cffi/setup.py) egg_info for package cffi

Downloading/unpacking pycparser (from cffi>=1.4.1->cryptography>=1.1->paramiko->ansible==2.0.2.0)
  Downloading pycparser-2.14.tar.gz (223kB): 223kB downloaded
  Running setup.py (path:/tmp/pip_build_root/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: ansible, paramiko, jinja2, pyasn1, cryptography, MarkupSafe, idna, enum34, ipaddress, cffi, pycparser
  Running setup.py install for ansible
    changing mode of build/scripts-2.7/ansible from 644 to 755
    changing mode of build/scripts-2.7/ansible-playbook from 644 to 755
    changing mode of build/scripts-2.7/ansible-pull from 644 to 755
    changing mode of build/scripts-2.7/ansible-doc from 644 to 755
    changing mode of build/scripts-2.7/ansible-galaxy from 644 to 755
    changing mode of build/scripts-2.7/ansible-vault from 644 to 755

    no previously-included directories found matching 'v2'
    no previously-included directories found matching 'docsite'
    no previously-included directories found matching 'ticket_stubs'
    no previously-included directories found matching 'test'
    no previously-included directories found matching 'hacking'
    warning: no previously-included files found matching 'lib/ansible/modules/core/.git*'
    warning: no previously-included files found matching 'lib/ansible/modules/extras/.git*'
    no previously-included directories found matching 'lib/ansible/modules/core/.git'
    no previously-included directories found matching 'lib/ansible/modules/extras/.git'
    changing mode of /usr/local/bin/ansible-pull to 755
    changing mode of /usr/local/bin/ansible-doc to 755
    changing mode of /usr/local/bin/ansible-vault to 755
    changing mode of /usr/local/bin/ansible-galaxy to 755
    changing mode of /usr/local/bin/ansible to 755
    changing mode of /usr/local/bin/ansible-playbook to 755
  Running setup.py install for cryptography
    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_root/cryptography/setup.py", line 335, in <module>
        **keywords_with_side_effects(sys.argv)
      File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
        _setup_distribution = dist = klass(attrs)
      File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 239, in __init__
        self.fetch_build_eggs(attrs.pop('setup_requires'))
      File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 264, in fetch_build_eggs
        replace_conflicting=True
      File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 620, in resolve
        dist = best[req.key] = env.best_match(req, ws, installer)
      File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 858, in best_match
        return self.obtain(req, installer) # try and download/install
      File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 870, in obtain
        return installer(requirement)
      File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 314, in fetch_build_egg
        return cmd.easy_install(req)
      File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 616, in easy_install
        return self.install_item(spec, dist.location, tmpdir, deps)
      File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 646, in install_item
        dists = self.install_eggs(spec, download, tmpdir)
      File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 834, in install_eggs
        return self.build_and_install(setup_script, setup_base)
      File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1040, in build_and_install
        self.run_setup(setup_script, setup_base, args)
      File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1028, in run_setup
        raise DistutilsError("Setup script exited with %s" % (v.args[0],))
    distutils.errors.DistutilsError: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-RiRGML-record/install-record.txt --single-version-externally-managed --compile:
    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_root/cryptography/setup.py", line 335, in <module>

    **keywords_with_side_effects(sys.argv)

  File "/usr/lib/python2.7/distutils/core.py", line 111, in setup

    _setup_distribution = dist = klass(attrs)

  File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 239, in __init__

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

  File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 264, in fetch_build_eggs

    replace_conflicting=True

  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 620, in resolve

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

  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 858, in best_match

    return self.obtain(req, installer) # try and download/install

  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 870, in obtain

    return installer(requirement)

  File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 314, in fetch_build_egg

    return cmd.easy_install(req)

  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 616, in easy_install

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

  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 646, in install_item

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

  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 834, in install_eggs

    return self.build_and_install(setup_script, setup_base)

  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1040, in build_and_install

    self.run_setup(setup_script, setup_base, args)

  File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1028, in run_setup

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

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

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

Most helpful comment

I have tried the following getting closer

sudo apt-get -y install python-dev 
sudo apt-get -y install libffi-dev
sudo apt-get -y install libssl-dev
sudo pip install paramiko 
sudo pip install PyYAML 
sudo pip install Jinja2 
sudo pip install httplib2 
sudo pip install six 
sudo pip install markupsafe  
sudo pip install docker-py
sudo pip install ansible==2.0.2.0

All 3 comments

I have tried the following getting closer

sudo apt-get -y install python-dev 
sudo apt-get -y install libffi-dev
sudo apt-get -y install libssl-dev
sudo pip install paramiko 
sudo pip install PyYAML 
sudo pip install Jinja2 
sudo pip install httplib2 
sudo pip install six 
sudo pip install markupsafe  
sudo pip install docker-py
sudo pip install ansible==2.0.2.0

for MAc users based on this

http://stackoverflow.com/questions/33234665/upgrading-setuptools-on-osx-el-capitan

you just add --user ptyhon to the pip command

sudo pip install paramiko PyYAML Jinja2 httplib2 six --user python

@aliolci thanks for the pointer, ansible problems where related to ubunutu and got foxed by switching to use apt-get on ubuntu

Was this page helpful?
0 / 5 - 0 ratings

Related issues

markusthoemmes picture markusthoemmes  路  3Comments

j4zzcat picture j4zzcat  路  3Comments

jthomas picture jthomas  路  5Comments

antengj picture antengj  路  4Comments

YangZhou1997 picture YangZhou1997  路  5Comments