Skip to content

Salt 2015.8.5 incompatible with Pip v8.1.2 #33163

Closed

Description

@jaybocc2

Description of Issue/Question

Pip 8.1.2 was just released and the poorly timed upgrade to it broke all of our salt states that rely on pip.
Force downgrading and locking pip to version 8.1.1 resolves the issue for now.

Setup

admin@jay-dev-001:~$ pip --version
pip 8.1.2 from /usr/local/lib/python2.7/dist-packages (python 2.7)
    config['upgrade-pip'] = {
        'pip.installed': [
            {'name': 'pip'},
            {'reload_modules': True},
            {'upgrade': True},
            {'require': [{'pkg': 'core_packages'}]}
        ]
    }

    config['upgrade-requests'] = {
        'pip.installed': [
            {'name': 'requests'},
            {'reload_modules': True},
            {'upgrade': True},
            {'require': [
                {'pkg': 'core_packages'},
                {'pip': 'pip'}
            ]}
        ]
    }

    config['docker-py'] = {
        'pip.installed': [
            {'name': 'docker-py == 1.4.0'},
            {'reload_modules': True},
            {'require': [
                {'pip': 'requests'},
                {'pip': 'pip'}
            ]}
        ]
    }

Steps to Reproduce Issue

salt * state.apply

----------
          ID: upgrade-pip
    Function: pip.installed
        Name: pip
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1624, in call
                  **cdata['kwargs'])
                File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 1491, in wrapper
                  return f(*args, **kwargs)
                File "/usr/lib/python2.7/dist-packages/salt/states/pip_state.py", line 592, in installed
                  out = _check_pkg_version_format(pkg)
                File "/usr/lib/python2.7/dist-packages/salt/states/pip_state.py", line 176, in _check_pkg_version_format
                  ret['prefix'] = install_req.req.project_name
              AttributeError: 'Requirement' object has no attribute 'project_name'
     Started: 02:02:36.041407
    Duration: 55.199 ms
     Changes:
----------
          ID: upgrade-requests
    Function: pip.installed
        Name: requests
      Result: False
     Comment: One or more requisite failed: core.docker_setup.upgrade-pip
     Started:
    Duration:
     Changes:
----------
          ID: install-python-requests
    Function: pip.installed
        Name: requests
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1624, in call
                  **cdata['kwargs'])
                File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 1491, in wrapper
                  return f(*args, **kwargs)
                File "/usr/lib/python2.7/dist-packages/salt/states/pip_state.py", line 592, in installed
                  out = _check_pkg_version_format(pkg)
                File "/usr/lib/python2.7/dist-packages/salt/states/pip_state.py", line 176, in _check_pkg_version_format
                  ret['prefix'] = install_req.req.project_name
              AttributeError: 'Requirement' object has no attribute 'project_name'
     Started: 02:02:36.484286
    Duration: 56.197 ms
     Changes:
----------
          ID: docker-py
    Function: pip.installed
        Name: docker-py == 1.4.0
      Result: False
     Comment: One or more requisite failed: core.docker_setup.upgrade-pip, core.docker_setup.upgrade-requests, consul.install.install-python-requests
     Started:
    Duration:
     Changes:
----------
          ID: install-python-consul
    Function: pip.installed
        Name: python-consul
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1624, in call
                  **cdata['kwargs'])
                File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 1491, in wrapper
                  return f(*args, **kwargs)
                File "/usr/lib/python2.7/dist-packages/salt/states/pip_state.py", line 592, in installed
                  out = _check_pkg_version_format(pkg)
                File "/usr/lib/python2.7/dist-packages/salt/states/pip_state.py", line 176, in _check_pkg_version_format
                  ret['prefix'] = install_req.req.project_name
              AttributeError: 'Requirement' object has no attribute 'project_name'
     Started: 02:02:46.170152
    Duration: 58.18 ms
     Changes:

Versions Report

admin@saltshaker-001:~$ salt --versions-report
Salt Version:
           Salt: 2015.8.5

Dependency Versions:
         Jinja2: 2.7.3
       M2Crypto: Not Installed
           Mako: 1.0.0
         PyYAML: 3.11
          PyZMQ: 14.4.0
         Python: 2.7.9 (default, Mar  1 2015, 12:57:24)
           RAET: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.4.2
          gitdb: 0.5.4
      gitpython: 0.3.2 RC1
          ioflo: Not Installed
        libgit2: Not Installed
        libnacl: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.2
   mysql-python: 1.2.3
      pycparser: Not Installed
       pycrypto: 2.6.1
         pygit2: Not Installed
   python-gnupg: 0.3.6
          smmap: 0.8.2
        timelib: Not Installed

System Versions:
           dist: debian 8.3
        machine: x86_64
        release: 3.16.0-4-amd64
         system: debian 8.3

Activity

  1. changed the title [-]Salt incompatible with Pip v8.1.2 [/-] [+]Salt 2015.8.5 incompatible with Pip v8.1.2[/+] on May 11, 2016
  2. uacfboblanton commented on May 11, 2016

    @uacfboblanton

    can verify this as well, same error

  3. codekoala commented on May 11, 2016

    @codekoala
    Contributor

    Affects 2015.8.8.2 as well.

  4. james9k commented on May 11, 2016

    @james9k

    Can confirm downgrading to pip 8.1.1 for Salt 2015.8.8.2 works.

  5. tom-aa commented on May 11, 2016

    @tom-aa

    same error here with 8.1.2, downgrade to 8.1.1 works fine

  6. rrei commented on May 11, 2016

    @rrei

    This affects the 'develop' branch too. Downgrading pip works, but the virtualenv state module is not working for me anymore (perhaps unrelated...).

  7. added
    bug
    severity-medium
    P1
    Platform
    on May 11, 2016
  8. added this to the Approved milestone on May 11, 2016
  9. added
    Upstream-Bug
    and removed
    bug
    on May 11, 2016
  10. 5 remaining items

  11. added
    fixed-pls-verify
    on May 11, 2016
  12. lietu commented on May 12, 2016

    @lietu

    Downgrading Pip with pip install pip==8.1.1 seemed to fix it for now.

  13. added a commit that references this issue on May 12, 2016
  14. cachedout commented on May 12, 2016

    @cachedout
    Contributor

    We should have this all wrapped up with the merge of #33180. I'm going to go ahead and close this.

  15. moloney commented on May 25, 2016

    @moloney

    FYI, this also shows up in Ubuntu Xenial package '8.1.1-2ubuntu0.1' even though "pip --version" returns "8.1.1". Installing the older version "python-pip=8.1.1-2" works.

  16. added a commit that references this issue on Jun 9, 2016
  17. added a commit that references this issue on Jul 28, 2016
  18. haraldrudell commented on Aug 5, 2016

    @haraldrudell
    • This is still broken on Ubuntu 16.04
    • suggested fix no work
    • The true code fix is here: https://github.com/saltstack/salt/pull/33180/files
    • if one puts the below in a file called file (including greater than and hyphens and 23a24):
      23a24
      > import re
      176,177c177,182
      <         ret['prefix'] = install_req.req.project_name
      <         ret['version_spec'] = install_req.req.specs
      ---
      >         ret['prefix'] = re.sub('[^A-Za-z0-9.]+', '-', install_req.name)
      >         if hasattr(install_req, "specifier"):
      >             specifier = install_req.specifier
      >         else:
      >             specifier = install_req.req.specifier
      >         ret['version_spec'] = [(spec.operator, spec.version) for spec in specifier]
      
      and does
      sudo patch /usr/lib/python2.7/dist-packages/salt/states/pip_state.py file

    The problem goes away

  19. moloney commented on Oct 1, 2016

    @moloney

    This is still broken in 2015.8.12

  20. bernielomax commented on Apr 5, 2017

    @bernielomax

    I was still experiencing this issue with Ubuntu's python-pip (8.1.1). I had to run pip install pip==8.1.1 --force --upgrade to fix the issue.

  21. brentsmyth commented on Jun 6, 2017

    @brentsmyth

    So is the idea that on ubuntu one needs to first install the python-pip apt package and then reinstall pip with pip?

  22. servomac commented on Jun 14, 2017

    @servomac

    I have the same problem with pip 9.0.1. It only fails with salt-minion 2015.8.8, but salt-minion 2015.8.13 works. The recipe is extremely simple:

    numpy:
      pip.installed
    
    host:
    ----------
              ID: numpy
        Function: pip.installed
          Result: False
         Comment: An exception occurred in this state: Traceback (most recent call last):
                    File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1626, in call
                      **cdata['kwargs'])
                    File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 1492, in wrapper
                      return f(*args, **kwargs)
                    File "/usr/lib/python2.7/dist-packages/salt/states/pip_state.py", line 592, in installed
                      out = _check_pkg_version_format(pkg)
                    File "/usr/lib/python2.7/dist-packages/salt/states/pip_state.py", line 176, in _check_pkg_version_format
                      ret['prefix'] = install_req.req.project_name
                  AttributeError: 'Requirement' object has no attribute 'project_name'
         Started: 13:48:35.969465
        Duration: 2.269 ms
         Changes:   
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Execution-ModuleP1PlatformState-ModuleUpstream-Bugfixed-pls-verifyseverity-medium

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions