Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ansible lint fails to install using pip on 16.04 #565

Closed
martinkennelly opened this issue Aug 8, 2019 · 9 comments
Closed

Ansible lint fails to install using pip on 16.04 #565

martinkennelly opened this issue Aug 8, 2019 · 9 comments
Labels
invalid Not a bug

Comments

@martinkennelly
Copy link

Issue Type

  • Bug report

Ansible and Ansible Lint details

ansible --version NA
ansible-lint --version 4.1.0
pip version: pip 8.1.1 (python 2.7)
  • ansible installation method: NA
  • ansible-lint installation method: pip

Desired Behaviour

Ansible-lint installs via pip

Actual Behaviour (Bug report only)

Attempted to install ansible-lint via pip on Ubuntu 16.04 LTS but failed with error:

  Using cached https://files.pythonhosted.org/packages/fd/f4/0a9044336f9ae455749a9e1ce6a7c8d6a47551f7eeddb8e9ea574d25b75c/ruamel.yaml-0.16.1.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-h_bkjlq3/ruamel.yaml/setup.py", line 23, in <module>
        from setuptools.namespaces import Installer as NameSpaceInstaller # NOQA
    ImportError: No module named 'setuptools.namespaces'

I corrected this issue by first installing setuptools and then install ansible-lint.

@webknjaz
Copy link
Member

webknjaz commented Aug 8, 2019

It's a problem of Ubuntu packaging things like this. There's nothing we can do. You should have pip and setuptools installed in order to install Python dists. It's a pre-requisite.

@g1ps
Copy link

g1ps commented Aug 9, 2019

I do. I was using pip. I 'installed' setuptools again but it's installed by default on our VMs. Something may have been wrong there but nothing's changed.

-sh-4.2$ sudo pip install setuptools
Requirement already satisfied: setuptools in /usr/lib/python2.7/site-packages (0.9.8)
-sh-4.2$ sudo pip install "ansible-lint==4.1.0" --upgrade
Collecting ansible-lint==4.1.0
  Using cached https://files.pythonhosted.org/packages/7d/ac/908e2bb33564640a321fd7d88c465073e643de24c0f941c90be7a05ec68c/ansible_lint-4.1.0-py2.py3-none-any.whl
Requirement already satisfied, skipping upgrade: pyyaml in /usr/lib64/python2.7/site-packages (from ansible-lint==4.1.0) (5.1.2)
Requirement already satisfied, skipping upgrade: ansible in /usr/lib/python2.7/site-packages (from ansible-lint==4.1.0) (2.8.2)
Requirement already satisfied, skipping upgrade: six in /usr/lib/python2.7/site-packages (from ansible-lint==4.1.0) (1.9.0)
Collecting ruamel.yaml (from ansible-lint==4.1.0)
  Using cached https://files.pythonhosted.org/packages/fd/f4/0a9044336f9ae455749a9e1ce6a7c8d6a47551f7eeddb8e9ea574d25b75c/ruamel.yaml-0.16.1.tar.gz
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python2 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ddTXZf/ruamel.yaml/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ddTXZf/ruamel.yaml/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
         cwd: /tmp/pip-install-ddTXZf/ruamel.yaml/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-ddTXZf/ruamel.yaml/setup.py", line 23, in <module>
        from setuptools.namespaces import Installer as NameSpaceInstaller # NOQA
    ImportError: No module named namespaces
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

@webknjaz
Copy link
Member

webknjaz commented Aug 9, 2019

-sh-4.2$ sudo pip install setuptools
Requirement already satisfied: setuptools in /usr/lib/python2.7/site-packages (0.9.8)

Is this a 10-year old VM? The current setuptools version goes over 40.

P.S. Workaround: #562 (comment)

@martinkennelly
Copy link
Author

May I ask why setuptools > X isnt a requirement when installing ansible lint ? This would then be pulled in when we are installing it.

@webknjaz
Copy link
Member

webknjaz commented Aug 9, 2019

@martinkennelly no. It's forbidden to set setuptools as a dist dependency. It's a pre-requisite (build dependency) and will not work.

@webknjaz
Copy link
Member

webknjaz commented Aug 9, 2019

We could use PEP 517 (pyproject.toml) to specify build deps but:

  1. It's a build dependency of ruamel.yaml, not ansible-lint (they should do it, not us).
  2. Current Pip implementations aren't perfect and cause other limitations when it's used.
  3. Only recent Pip versions support this standard.

@g1ps
Copy link

g1ps commented Aug 9, 2019

Is this a 10-year old VM? The current setuptools version goes over 40.

No but the actions of IT are a mystery to many of us. Updating setuptools seems to have helped. Let me try and sort out what actually works and helped and I'll get back to you. I understand that ruamel isn't your problem, I just couldn't understand why we were having issues all of a sudden.

@AvdN
Copy link

AvdN commented Aug 9, 2019

Updating setuptools would have helped because the setup.py of ruamel.yaml relies on being able to import setuptools.namespace ( file added back in 2016).
It is only the setup.py that needs it, and the .whl install of ruamel.yaml doesn't include that.
Unfortunately the wheel did not get uploaded automatically as part of the release process.

Adding setuptools as a dependency would serve no purpose as that would have to be communicated by the setup.py in its call to setup() and by then you already have an error thrown.

I'll try to figure out why the wheel was not created, before any next release, so the non-upload should not happen again.

@webknjaz
Copy link
Member

webknjaz commented Aug 9, 2019

Thanks, @AvdN!

@g1ps it's likely not your IT's problem. The thing is that deb/ubuntu used to ship outdated setuptools. So I usually recommend using a virtualenv that you can control and update pip/setuptools/wheel before installing anything else there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid Not a bug
Projects
None yet
Development

No branches or pull requests

4 participants