Pip install awscli is failing

Hello,

My build is suddenly failing when installing the AWS CLI tool from pip. Here is the dependencies section in my circle.yml:

dependencies:
  override:
    - sudo pip install awscli
    - npm install -g db-migrate@0.10.0-beta.15
    - npm install
    - db-migrate up -e test

And the output I get:

sudo pip install awscli
Downloading/unpacking awscli
  Downloading awscli-1.11.19-py2.py3-none-any.whl (1.0MB):  32%  339kB  Downloading awscli-1.11.19-py2.py3-none-any.whl (1.0MB):  44%  454kB  Downloading awscli-1.11.19-py2.py3-none-any.whl (1.0MB):  44%  458kB  Downloading awscli-1.11.19-py2.py3-none-any.whl (1.0MB): 1.0MB downloaded
Downloading/unpacking PyYAML==3.12 (from awscli)
  Downloading PyYAML-3.12.tar.gz (253kB): 253kB downloaded
  Running setup.py (path:/tmp/pip_build_root/PyYAML/setup.py) egg_info for package PyYAML
    
Downloading/unpacking docutils>=0.10 (from awscli)
  Downloading docutils-0.12.tar.gz (1.6MB):  67%  1.1MB  Downloading docutils-0.12.tar.gz (1.6MB):  68%  1.1MB  Downloading docutils-0.12.tar.gz (1.6MB):  69%  1.1MB  Downloading docutils-0.12.tar.gz (1.6MB):  70%  1.1MB  Downloading docutils-0.12.tar.gz (1.6MB):  71%  1.2MB  Downloading docutils-0.12.tar.gz (1.6MB):  72%  1.2MB  Downloading docutils-0.12.tar.gz (1.6MB):  73%  1.2MB  Downloading docutils-0.12.tar.gz (1.6MB):  74%  1.2MB  Downloading docutils-0.12.tar.gz (1.6MB):  74%  1.2MB  Downloading docutils-0.12.tar.gz (1.6MB):  75%  1.2MB  Downloading docutils-0.12.tar.gz (1.6MB):  76%  1.2MB  Downloading docutils-0.12.tar.gz (1.6MB):  77%  1.3MB  Downloading docutils-0.12.tar.gz (1.6MB):  78%  1.3MB  Downloading docutils-0.12.tar.gz (1.6MB): 1.6MB downloaded
  Running setup.py (path:/tmp/pip_build_root/docutils/setup.py) egg_info for package docutils
    
    warning: no files found matching 'MANIFEST'
    warning: no files found matching '*' under directory 'extras'
    warning: no previously-included files matching '.cvsignore' found under directory '*'
    warning: no previously-included files matching '*.pyc' found under directory '*'
    warning: no previously-included files matching '*~' found under directory '*'
    warning: no previously-included files matching '.DS_Store' found under directory '*'
Downloading/unpacking botocore==1.4.76 (from awscli)
  Downloading botocore-1.4.76-py2.py3-none-any.whl (2.8MB): 2.8MB downloaded
Downloading/unpacking rsa>=3.1.2,<=3.5.0 (from awscli)
  Downloading rsa-3.4.2-py2.py3-none-any.whl (46kB): 46kB downloaded
Requirement already satisfied (use --upgrade to upgrade): colorama>=0.2.5,<=0.3.7 in /usr/lib/python2.7/dist-packages (from awscli)
Downloading/unpacking s3transfer>=0.1.9,<0.2.0 (from awscli)
  Downloading s3transfer-0.1.9-py2.py3-none-any.whl (53kB): 53kB downloaded
Downloading/unpacking jmespath>=0.7.1,<1.0.0 (from botocore==1.4.76->awscli)
  Downloading jmespath-0.9.0-py2.py3-none-any.whl
Downloading/unpacking python-dateutil>=2.1,<3.0.0 (from botocore==1.4.76->awscli)
  Downloading python_dateutil-2.6.0-py2.py3-none-any.whl (194kB): 194kB downloaded
Downloading/unpacking pyasn1>=0.1.3 (from rsa>=3.1.2,<=3.5.0->awscli)
  Downloading pyasn1-0.1.9-py2.py3-none-any.whl
Downloading/unpacking futures>=2.2.0,<4.0.0 (from s3transfer>=0.1.9,<0.2.0->awscli)
  Downloading futures-3.0.5-py2-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): six>=1.5 in /usr/lib/python2.7/dist-packages (from python-dateutil>=2.1,<3.0.0->botocore==1.4.76->awscli)
Installing collected packages: awscli, PyYAML, docutils, botocore, rsa, s3transfer, jmespath, python-dateutil, pyasn1, futures
  Found existing installation: PyYAML 3.10
    Not uninstalling PyYAML at /usr/lib/python2.7/dist-packages, owned by OS
  Running setup.py install for PyYAML
    checking if libyaml is compilable
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c build/temp.linux-x86_64-2.7/check_libyaml.c -o build/temp.linux-x86_64-2.7/check_libyaml.o
    checking if libyaml is linkable
    x86_64-linux-gnu-gcc -pthread build/temp.linux-x86_64-2.7/check_libyaml.o -lyaml -o build/temp.linux-x86_64-2.7/check_libyaml
    building '_yaml' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c ext/_yaml.c -o build/temp.linux-x86_64-2.7/ext/_yaml.o
    ext/_yaml.c:4:20: fatal error: Python.h: No such file or directory
     #include "Python.h"
                        ^
    compilation terminated.
    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/PyYAML/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-g8TXIK-record/install-record.txt --single-version-externally-managed --compile:
    running install

running build

running build_py

creating build

creating build/lib.linux-x86_64-2.7

creating build/lib.linux-x86_64-2.7/yaml

copying lib/yaml/error.py -> build/lib.linux-x86_64-2.7/yaml

copying lib/yaml/__init__.py -> build/lib.linux-x86_64-2.7/yaml

copying lib/yaml/dumper.py -> build/lib.linux-x86_64-2.7/yaml

copying lib/yaml/resolver.py -> build/lib.linux-x86_64-2.7/yaml

copying lib/yaml/scanner.py -> build/lib.linux-x86_64-2.7/yaml

copying lib/yaml/events.py -> build/lib.linux-x86_64-2.7/yaml

copying lib/yaml/emitter.py -> build/lib.linux-x86_64-2.7/yaml

copying lib/yaml/serializer.py -> build/lib.linux-x86_64-2.7/yaml

copying lib/yaml/representer.py -> build/lib.linux-x86_64-2.7/yaml

copying lib/yaml/constructor.py -> build/lib.linux-x86_64-2.7/yaml

copying lib/yaml/cyaml.py -> build/lib.linux-x86_64-2.7/yaml

copying lib/yaml/reader.py -> build/lib.linux-x86_64-2.7/yaml

copying lib/yaml/parser.py -> build/lib.linux-x86_64-2.7/yaml

copying lib/yaml/loader.py -> build/lib.linux-x86_64-2.7/yaml

copying lib/yaml/nodes.py -> build/lib.linux-x86_64-2.7/yaml

copying lib/yaml/composer.py -> build/lib.linux-x86_64-2.7/yaml

copying lib/yaml/tokens.py -> build/lib.linux-x86_64-2.7/yaml

running build_ext

creating build/temp.linux-x86_64-2.7

checking if libyaml is compilable

x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c build/temp.linux-x86_64-2.7/check_libyaml.c -o build/temp.linux-x86_64-2.7/check_libyaml.o

checking if libyaml is linkable

x86_64-linux-gnu-gcc -pthread build/temp.linux-x86_64-2.7/check_libyaml.o -lyaml -o build/temp.linux-x86_64-2.7/check_libyaml

building '_yaml' extension

creating build/temp.linux-x86_64-2.7/ext

x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c ext/_yaml.c -o build/temp.linux-x86_64-2.7/ext/_yaml.o

ext/_yaml.c:4:20: fatal error: Python.h: No such file or directory

 #include "Python.h"

                    ^

compilation terminated.

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------
  Can't roll back PyYAML; was not uninstalled
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/PyYAML/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-g8TXIK-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/PyYAML
Storing debug log for failure in /home/ubuntu/.pip/pip.log

sudo pip install awscli returned exit code 1

Action failed: sudo pip install awscli

Any help would be greatly appreciated :slight_smile:

David

Actually, removing the “sudo” fixed the issue.

I was seeing this as well, thanks for posting here.

Also noticed that according to the 14.04 image list, awscli is already installed.

1 Like

I fixed this by adding sudo apt-get install python-dev before the awscli bit (I need it anyways to install the awsebcli tools for Elastic Beanstalk access.

3 Likes

Thanks for reporting this. The issue is described here: https://github.com/aws/aws-cli/issues/2290

sudo apt-get install python-dev will fix it as described above.

This appears to still be an issue with circleci 2.0 using the - image: circleci/node:9.2.0-browsers.

I have tried all of the above yet I always get the error:
Installing collected packages: pip, setuptools, wheel
Successfully installed pip-9.0.1 setuptools-38.4.0 wheel-0.30.0
/bin/bash: line 4: pip: command not found
Exited with code 127

Might be a path issue?

I updated to this and it worked:
- run:
name: install aws-cli
command: |
sudo apt-get update
sudo apt-get install -y python-pip python-dev
sudo pip install awscli
aws --version

When I typed pip install awscli in cygwin64 terminal it showed the following error Could not find a version that satisfies the requirement awscli (from versions: )
No matching distribution found for awscli
can anyone please tell me what should I do?

I should think that Cygwin is not supported by the awscli utility, and so there is no build for it. If you are running Windows, consider running a virtual machine with a real Linux distro installed. You could try Bash for Windows too, but unless you are well-versed in troubleshooting Windows-specific issues, I’d stick with Ubuntu for now. CI is hard enough without these additional woes.

(@surfjedi: When supplying YAML code here, please use a formatted block to show it, so that the indentation is clear. Readers can get the gist of what you’ve written above, but it’s trivial to make it more readable. Would you edit?)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.