saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:
https://repo.saltproject.io/
Apache License 2.0
14.1k stars 5.47k forks source link

Pip module exists but is not found #38916

Closed nicksloan closed 6 years ago

nicksloan commented 7 years ago

Description of Issue/Question

The error "An importable pip module is required but could not be found on your system. This usually means that the system's pip package is not installed properly." is occurring, and I can't seem to understand why. I've traced the error to https://github.com/saltstack/salt/blob/v2016.11.1/salt/states/pip_state.py#L111-L116, but as demonstrated in the Gist below, the checks that set HAS_PIP should pass.

Setup

Relevant SLS portion python: pkg.installed:

python-pip: pkg.installed:

virtualenv: pip.installed:

virtualenvwrapper: pip.installed:

Steps to Reproduce Issue

https://gist.github.com/nicksloan/19eea7a7dedfca566cd26ee1bf5c8304

Versions Report

Master

Salt Version: Salt: 2016.11.1

Dependency Versions: cffi: Not Installed cherrypy: Not Installed dateutil: 2.2 gitdb: 0.5.4 gitpython: 0.3.2 RC1 ioflo: Not Installed Jinja2: 2.7.3 libgit2: Not Installed libnacl: Not Installed M2Crypto: Not Installed Mako: 1.0.0 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: 2.7.9 (default, Jun 29 2016, 13:08:31) python-gnupg: Not Installed PyYAML: 3.11 PyZMQ: 14.4.0 RAET: Not Installed smmap: 0.8.2 timelib: Not Installed Tornado: 4.2.1 ZMQ: 4.0.5

System Versions: dist: debian 8.6 machine: x86_64 release: 3.16.0-4-amd64 system: Linux version: debian 8.6

Minion

1.api.qa: Salt Version: Salt: 2016.11.1

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

System Versions:
           dist: debian 8.1
        machine: x86_64
        release: 3.16.0-4-amd64
         system: Linux
        version: debian 8.1
gtmanfred commented 7 years ago

You will need to reload the modules after the pip package is installed.

https://docs.saltstack.com/en/latest/ref/states/#reloading-modules

Add - reload_modules: True to the pkg.installed state.

nicksloan commented 7 years ago

@gtmanfred I'll test that, but pip was previously installed and working, and simply running . These very states ran fine in the past on this machine. I'm not sure when the shift occurred, but one of the more recent changes made was upgrading to salt 2016.11.1. I do not recall which version I came from, though I suspect it was early or late 2015.

Another thing I've noticed is that the pip.install execution module works fine. Something like $ sudo salt 1.api.qa pip.install virtualenv should be roughly similar to the pip.installed state that fails, yet it succeeds with no errors.

Finally, I've run a pkg.upgrade on one of the misbehaving instances, which completed without any visible issue, so everything should be up to date at this point.

gtmanfred commented 7 years ago

Hrm, that is odd, I have salt-minion installed from the package, and python-pip also installed fromthe package, and with the reload modules, it works on 2016.11.1

root@d5261d80765c:/# salt-call --local test.ping
local:
    True
root@d5261d80765c:/# salt-call --local state.apply test
local:
----------
          ID: python
    Function: pkg.installed
        Name: python2.7
      Result: True
     Comment: Package python2.7 is already installed
     Started: 19:06:43.356200
    Duration: 1964.643 ms
     Changes:
----------
          ID: python-pip
    Function: pkg.installed
      Result: True
     Comment: The following packages were installed/updated: python-pip
     Started: 19:06:45.321081
    Duration: 34059.852 ms
     Changes:
              ----------
              binutils:
                  ----------
                  new:
                      2.25-5
                  old:
              binutils-gold:
                  ----------
                  new:
                      1
                  old:
              build-essential:
                  ----------
                  new:
                      11.7
                  old:
              bzip2:
                  ----------
                  new:
                      1.0.6-7+b3
                  old:
              c++-compiler:
                  ----------
                  new:
                      1
                  old:
              c++abi2-dev:
                  ----------
                  new:
                      1
                  old:
              c-compiler:
                  ----------
                  new:
                      1
                  old:
              cpp:
                  ----------
                  new:
                      4:4.9.2-2
                  old:
              cpp-4.9:
                  ----------
                  new:
                      4.9.2-10
                  old:
              cpp:any:
                  ----------
                  new:
                      1
                  old:
              data-dumper:
                  ----------
                  new:
                      1
                  old:
              dpkg-dev:
                  ----------
                  new:
                      1.17.27
                  old:
              elf-binutils:
                  ----------
                  new:
                      1
                  old:
              fakeroot:
                  ----------
                  new:
                      1.20.2-1
                  old:
              g++:
                  ----------
                  new:
                      4:4.9.2-2
                  old:
              g++-4.9:
                  ----------
                  new:
                      4.9.2-10
                  old:
              gcc:
                  ----------
                  new:
                      4:4.9.2-2
                  old:
              gcc-4.9:
                  ----------
                  new:
                      4.9.2-10
                  old:
              libalgorithm-c3-perl:
                  ----------
                  new:
                      0.09-1
                  old:
              libalgorithm-diff-perl:
                  ----------
                  new:
                      1.19.02-3
                  old:
              libalgorithm-diff-xs-perl:
                  ----------
                  new:
                      0.04-3+b1
                  old:
              libalgorithm-merge-perl:
                  ----------
                  new:
                      0.08-2
                  old:
              libansicolor-perl:
                  ----------
                  new:
                      1
                  old:
              libarchive-extract-perl:
                  ----------
                  new:
                      0.72-1
                  old:
              libarchive-tar-perl:
                  ----------
                  new:
                      1
                  old:
              libasan1:
                  ----------
                  new:
                      4.9.2-10
                  old:
              libatomic1:
                  ----------
                  new:
                      4.9.2-10
                  old:
              libattribute-handlers-perl:
                  ----------
                  new:
                      1
                  old:
              libautodie-perl:
                  ----------
                  new:
                      1
                  old:
              libc-dev:
                  ----------
                  new:
                      1
                  old:
              libc-dev-bin:
                  ----------
                  new:
                      2.19-18+deb8u7
                  old:
              libc6-dev:
                  ----------
                  new:
                      2.19-18+deb8u7
                  old:
              libcgi-fast-perl:
                  ----------
                  new:
                      1:2.04-1
                  old:
              libcgi-pm-perl:
                  ----------
                  new:
                      4.09-1
                  old:
              libcilkrts5:
                  ----------
                  new:
                      4.9.2-10
                  old:
              libclass-c3-perl:
                  ----------
                  new:
                      0.26-1
                  old:
              libclass-c3-xs-perl:
                  ----------
                  new:
                      0.13-2+b1
                  old:
              libcloog-isl4:
                  ----------
                  new:
                      0.18.2-1+b2
                  old:
              libcompress-raw-bzip2-perl:
                  ----------
                  new:
                      1
                  old:
              libcompress-raw-zlib-perl:
                  ----------
                  new:
                      1
                  old:
              libcompress-zlib-perl:
                  ----------
                  new:
                      1
                  old:
              libcpan-meta-perl:
                  ----------
                  new:
                      2.142690-1
                  old:
              libcpan-meta-requirements-perl:
                  ----------
                  new:
                      1
                  old:
              libcpan-meta-yaml-perl:
                  ----------
                  new:
                      1
                  old:
              libdata-optlist-perl:
                  ----------
                  new:
                      0.109-1
                  old:
              libdata-section-perl:
                  ----------
                  new:
                      0.200006-1
                  old:
              libdigest-md5-perl:
                  ----------
                  new:
                      1
                  old:
              libdigest-perl:
                  ----------
                  new:
                      1
                  old:
              libdigest-sha-perl:
                  ----------
                  new:
                      1
                  old:
              libdpkg-perl:
                  ----------
                  new:
                      1.17.27
                  old:
              libencode-perl:
                  ----------
                  new:
                      1
                  old:
              libexperimental-perl:
                  ----------
                  new:
                      1
                  old:
              libextutils-cbuilder-perl:
                  ----------
                  new:
                      1
                  old:
              libextutils-command-perl:
                  ----------
                  new:
                      1
                  old:
              libextutils-install-perl:
                  ----------
                  new:
                      1
                  old:
              libextutils-parsexs-perl:
                  ----------
                  new:
                      1
                  old:
              libfakeroot:
                  ----------
                  new:
                      1.20.2-1
                  old:
              libfcgi-perl:
                  ----------
                  new:
                      0.77-1+deb8u1
                  old:
              libfile-fcntllock-perl:
                  ----------
                  new:
                      0.22-1+b1
                  old:
              libfile-rename-perl:
                  ----------
                  new:
                      1
                  old:
              libfile-spec-perl:
                  ----------
                  new:
                      1
                  old:
              libgcc-4.9-dev:
                  ----------
                  new:
                      4.9.2-10
                  old:
              libgdbm3:
                  ----------
                  new:
                      1.8.3-13.1
                  old:
              libgomp1:
                  ----------
                  new:
                      4.9.2-10
                  old:
              libhttp-tiny-perl:
                  ----------
                  new:
                      1
                  old:
              libi18n-langtags-perl:
                  ----------
                  new:
                      1
                  old:
              libio-compress-base-perl:
                  ----------
                  new:
                      1
                  old:
              libio-compress-bzip2-perl:
                  ----------
                  new:
                      1
                  old:
              libio-compress-perl:
                  ----------
                  new:
                      1
                  old:
              libio-compress-zlib-perl:
                  ----------
                  new:
                      1
                  old:
              libio-zlib-perl:
                  ----------
                  new:
                      1
                  old:
              libisl10:
                  ----------
                  new:
                      0.12.2-2
                  old:
              libitm1:
                  ----------
                  new:
                      4.9.2-10
                  old:
              libjson-pp-perl:
                  ----------
                  new:
                      1
                  old:
              liblocale-codes-perl:
                  ----------
                  new:
                      1
                  old:
              liblocale-maketext-perl:
                  ----------
                  new:
                      1
                  old:
              liblocale-maketext-simple-perl:
                  ----------
                  new:
                      1
                  old:
              liblog-message-perl:
                  ----------
                  new:
                      0.8-1
                  old:
              liblog-message-simple-perl:
                  ----------
                  new:
                      0.10-2
                  old:
              liblsan0:
                  ----------
                  new:
                      4.9.2-10
                  old:
              libmath-bigint-perl:
                  ----------
                  new:
                      1
                  old:
              libmath-complex-perl:
                  ----------
                  new:
                      1
                  old:
              libmime-base64-perl:
                  ----------
                  new:
                      1
                  old:
              libmodule-build-perl:
                  ----------
                  new:
                      0.421000-2+deb8u1
                  old:
              libmodule-corelist-perl:
                  ----------
                  new:
                      1
                  old:
              libmodule-load-conditional-perl:
                  ----------
                  new:
                      1
                  old:
              libmodule-load-perl:
                  ----------
                  new:
                      1
                  old:
              libmodule-metadata-perl:
                  ----------
                  new:
                      1
                  old:
              libmodule-pluggable-perl:
                  ----------
                  new:
                      5.1-1
                  old:
              libmodule-signature-perl:
                  ----------
                  new:
                      0.73-1+deb8u2
                  old:
              libmpc3:
                  ----------
                  new:
                      1.0.2-1
                  old:
              libmpfr4:
                  ----------
                  new:
                      3.1.2-2
                  old:
              libmro-compat-perl:
                  ----------
                  new:
                      0.12-1
                  old:
              libnet-perl:
                  ----------
                  new:
                      1
                  old:
              libnet-ping-perl:
                  ----------
                  new:
                      1
                  old:
              libpackage-constants-perl:
                  ----------
                  new:
                      0.04-1
                  old:
              libparams-check-perl:
                  ----------
                  new:
                      1
                  old:
              libparams-util-perl:
                  ----------
                  new:
                      1.07-2+b1
                  old:
              libparent-perl:
                  ----------
                  new:
                      1
                  old:
              libparse-cpan-meta-perl:
                  ----------
                  new:
                      1
                  old:
              libperl-ostype-perl:
                  ----------
                  new:
                      1
                  old:
              libpod-escapes-perl:
                  ----------
                  new:
                      1
                  old:
              libpod-latex-perl:
                  ----------
                  new:
                      0.61-1
                  old:
              libpod-parser-perl:
                  ----------
                  new:
                      1
                  old:
              libpod-readme-perl:
                  ----------
                  new:
                      0.11-1
                  old:
              libpod-simple-perl:
                  ----------
                  new:
                      1
                  old:
              libquadmath0:
                  ----------
                  new:
                      4.9.2-10
                  old:
              libregexp-common-perl:
                  ----------
                  new:
                      2013031301-1
                  old:
              libsoftware-license-perl:
                  ----------
                  new:
                      0.103010-3
                  old:
              libstdc++-4.9-dev:
                  ----------
                  new:
                      4.9.2-10
                  old:
              libstdc++-dev:
                  ----------
                  new:
                      1
                  old:
              libstorable-perl:
                  ----------
                  new:
                      1
                  old:
              libsub-exporter-perl:
                  ----------
                  new:
                      0.986-1
                  old:
              libsub-install-perl:
                  ----------
                  new:
                      0.928-1
                  old:
              libsys-syslog-perl:
                  ----------
                  new:
                      1
                  old:
              libterm-ui-perl:
                  ----------
                  new:
                      0.42-1
                  old:
              libtest-harness-perl:
                  ----------
                  new:
                      1
                  old:
              libtest-simple-perl:
                  ----------
                  new:
                      1
                  old:
              libtext-soundex-perl:
                  ----------
                  new:
                      3.4-1+b2
                  old:
              libtext-template-perl:
                  ----------
                  new:
                      1.46-1
                  old:
              libthread-queue-perl:
                  ----------
                  new:
                      1
                  old:
              libthreads-perl:
                  ----------
                  new:
                      1
                  old:
              libthreads-shared-perl:
                  ----------
                  new:
                      1
                  old:
              libtime-hires-perl:
                  ----------
                  new:
                      1
                  old:
              libtime-local-perl:
                  ----------
                  new:
                      1
                  old:
              libtime-piece-perl:
                  ----------
                  new:
                      1
                  old:
              libtimedate-perl:
                  ----------
                  new:
                      2.3000-2
                  old:
              libtsan0:
                  ----------
                  new:
                      4.9.2-10
                  old:
              libubsan0:
                  ----------
                  new:
                      4.9.2-10
                  old:
              libunicode-collate-perl:
                  ----------
                  new:
                      1
                  old:
              libversion-perl:
                  ----------
                  new:
                      1
                  old:
              libversion-requirements-perl:
                  ----------
                  new:
                      1
                  old:
              linux-kernel-headers:
                  ----------
                  new:
                      1
                  old:
              linux-libc-dev:
                  ----------
                  new:
                      3.16.39-1
                  old:
              make:
                  ----------
                  new:
                      4.0-8.1
                  old:
              manpages:
                  ----------
                  new:
                      3.74-1
                  old:
              manpages-dev:
                  ----------
                  new:
                      3.74-1
                  old:
              patch:
                  ----------
                  new:
                      2.7.5-1
                  old:
              perl:
                  ----------
                  new:
                      5.20.2-3+deb8u6
                  old:
              perl-modules:
                  ----------
                  new:
                      5.20.2-3+deb8u6
                  old:
              perl5:
                  ----------
                  new:
                      1
                  old:
              perl:any:
                  ----------
                  new:
                      1
                  old:
              podlators-perl:
                  ----------
                  new:
                      1
                  old:
              python-colorama:
                  ----------
                  new:
                      0.3.2-1
                  old:
              python-distlib:
                  ----------
                  new:
                      0.1.9-1
                  old:
              python-distribute:
                  ----------
                  new:
                      1
                  old:
              python-html5lib:
                  ----------
                  new:
                      0.999-3
                  old:
              python-pip:
                  ----------
                  new:
                      1.5.6-5
                  old:
              python-setuptools:
                  ----------
                  new:
                      5.5.1-1
                  old:
              python-wheel:
                  ----------
                  new:
                      0.24.0-1
                  old:
              rename:
                  ----------
                  new:
                      0.20-3
                  old:
              timedate:
                  ----------
                  new:
                      1
                  old:
----------
          ID: virtualenv
    Function: pip.installed
      Result: True
     Comment: All packages were successfully installed
     Started: 19:07:19.809786
    Duration: 2046.636 ms
     Changes:
              ----------
              virtualenv==15.1.0:
                  Installed
----------
          ID: virtualenvwrapper
    Function: pip.installed
      Result: True
     Comment: All packages were successfully installed
     Started: 19:07:21.856640
    Duration: 3248.779 ms
     Changes:
              ----------
              virtualenvwrapper==4.7.2:
                  Installed

Summary for local
------------
Succeeded: 4 (changed=3)
Failed:    0
------------
Total states run:     4
Total run time:  41.320 s
root@d5261d80765c:/# cat /srv/salt/test.sls
python:
  pkg.installed:
    - name: python2.7

python-pip:
  pkg.installed:
    - require:
      - pkg: python
    - reload_modules: True

virtualenv:
  pip.installed:
    - require:
      - pkg: python-pip

virtualenvwrapper:
  pip.installed:
    - require:
      - pkg: python-pip

Here is the verison report

root@d5261d80765c:/# salt-call --versions-report
Salt Version:
           Salt: 2016.11.1

Dependency Versions:
           cffi: 0.8.6
       cherrypy: Not Installed
       dateutil: 2.2
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.7.3
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.2
   mysql-python: 1.2.3
      pycparser: 2.10
       pycrypto: 2.6.1
         pygit2: Not Installed
         Python: 2.7.9 (default, Jun 29 2016, 13:08:31)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 14.4.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5

System Versions:
           dist: debian 8.7
        machine: x86_64
        release: 4.4.38-boot2docker
         system: Linux
        version: debian 8.7
nicksloan commented 7 years ago

No luck after adding reload modules on my end. This is not unexpected because presumably it should work on the second run if adding reload modules would have solved the problem. It is not working after any number of runs. Something else must be going on here.

gtmanfred commented 7 years ago

There is not much we can do, because if it isn't loading then inside of salt, it is unable to import python.

Could you try running adding a custom module that returns the sys.path, and check that the location of pip (python -c 'import pip, os; print os.path.dirname(pip.__file__)') is in that sys.path in the running salt process?

Thanks, Daniel

dr-strangecode commented 7 years ago

I've been getting similar messages. Best I could tell, it had to do with the PYTHONPATH that ubuntu is using - the dependency order of pip packages gets messed up. The simplest solution I found was to add the following to /etc/default/salt-minion then do a full stop then start of the minion. That got rid of the pip highstate errors for me.

/etc/default/salt-minion: export PYTHONPATH=/usr/lib/python2.7/dist-packages/

SmilentRhino commented 7 years ago
  1. I ran into a similar problem on ubuntu.
  2. So I tried to log the importerror.

try: import pip HAS_PIP = True except ImportError as e: logging.error("markkkkkkkkkkkkkkkk") logging.error(str(e)) HAS_PIP = False

1. And it said cannot import name IncompleteRead

2017-05-08 16:19:02,811 [root ][ERROR ][13059] markkkkkkkkkkkkkkkk 2017-05-08 16:19:02,812 [root ][ERROR ][13059] cannot import name IncompleteRead 2017-05-08 16:19:02,814 [salt.state ][ERROR ][13059] An importable pip module is required but could not be found on your system. This usually means that the system's pip package is not installed properly.

1. Then I got this on SF [fix importerror](http://stackoverflow.com/questions/27341064/how-do-i-fix-importerror-cannot-import-name-incompleteread)
1. After pip install -U pip, it worked. Default pip is 1.5.4

root@test:/var/log/salt# pip install -U pip Downloading/unpacking pip from https://pypi.python.org/packages/b6/ac/7015eb97dc749283ffdec1c3a88ddb8ae03b8fad0f0e611408f196358da3/pip-9.0.1-py2.py3-none-any.whl#md5=297dbd16ef53bcef0447d245815f5144 Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB): 1.3MB downloaded Installing collected packages: pip Found existing installation: pip 1.5.4 Not uninstalling pip at /usr/lib/python2.7/dist-packages, owned by OS Successfully installed pip Cleaning up...

1. Pip for my salt is 9.0.1 now.

root@test:~# /usr/local/bin/pip --version pip 9.0.1 from /usr/local/lib/python2.7/dist-packages (python 2.7) root@test:~# pip --version pip 1.5.4 from /usr/lib/python2.7/dist-packages (python 2.7) root@test:~# whereis salt salt: /usr/bin/salt /etc/salt /usr/local/bin/salt /usr/share/man/man7/salt.7.gz /usr/share/man/man1/salt.1.gz root@test:~#


1. Not sure they are the same problem, hope it can help.
wongchao commented 7 years ago

same problem with sls, but works fine with modules

salt-master 2017.7.0 (Nitrogen) env:

Minion Side: [root@localhost ~]# which pip /usr/bin/pip [root@localhost ~]# pip --version pip 9.0.1 from /usr/lib/python2.6/site-packages (python 2.6)

salt MINION pip.install scapy -v ### successfully ##

PROBLEM⬇️

Master Side: init.sls: ############################ scapy_install: pip.installed:

output:

      ID: scapy_install
Function: pip.installed
    Name: scapy
  Result: False
 Comment: An importable Python 2 pip module is required but could not be found on your system. This usually means that the system's pip package is not installed properly.
 Started: 15:52:50.391629
Duration: 0.92 ms
 Changes:

Summary for salt_master

Succeeded: 0 Failed: 1

Total states run: 1 Total run time: 0.920 ms

gtmanfred commented 7 years ago

You will need to upgrade and use the new python2.7-pip package, since we require at least python 2.7 for 2017.7.0

On Fri, Aug 11, 2017 at 1:54 AM, Chao notifications@github.com wrote:

same problem

salt-master 2017.7.0 (Nitrogen) env:

  • os:centos6 pip: python2.7 salt-mater: python2.7 salt-minion 2017.7.0 (Nitrogen) env:
  • os:centos6 pip: python2.6 salt-mater: python2.7

init.sls: ############################ scapy_install: pip.installed:

  • name: scapy
  • bin_env: /usr/bin/pip ############################ output:

    ID: scapy_install Function: pip.installed Name: scapy Result: False Comment: An importable Python 2 pip module is required but could not be found on your system. This usually means that the system's pip package is not installed properly. Started: 15:52:50.391629 Duration: 0.92 ms Changes:

Summary for salt_master Succeeded: 0 Failed: 1

Total states run: 1 Total run time: 0.920 ms

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/saltstack/salt/issues/38916#issuecomment-321751189, or mute the thread https://github.com/notifications/unsubscribe-auth/AAssoS3L4YNS7lYKxkBcin0l_inkPHSRks5sXAidgaJpZM4Lsb5J .

wongchao commented 7 years ago

@gtmanfred it works, thx

campbellmc commented 7 years ago

It will also works if you use the -requirements option with a requirements file rather than the - pkg(s) or -name options - without the need of reloading modules or specifically installing python2.7-pip.

reloading modules did not work for me. I think it's a distraction and not the proper solution.

sokratisg commented 7 years ago

Same issue here. The error comes from all minion running on Ubuntu 14.04

State file sample after its compilation on Minion:

python-pip:
  pkg.latest:
    - pkgs:
      - python-pip
      - python-dev
    - reload_modules: True

pip_graypy:
  pip.installed:
    - name: graypy==0.2.11
    - upgrade: False
    - require:
      - pkg: python-pip

Error message on Minion:

[INFO    ] Executing state pip.installed for [graypy==0.2.11]
[ERROR   ] An importable Python 2 pip module is required but could not be found on your system. This usually means that the system's pip package is not installed properly.

python-pip information on Minion:

# pip -V
pip 1.5.4 from /usr/lib/python2.7/dist-packages (python 2.7)

# apt-cache show python-pip
Package: python-pip
Architecture: all
Version: 1.5.4-1ubuntu4
Priority: optional
Section: universe/python
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian Python Modules Team <python-modules-team@lists.alioth.debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 466
Depends: ca-certificates, python-colorama, python-distlib, python-html5lib, python-pip-whl (= 1.5.4-1ubuntu4), python-pkg-resources, python-requests, python-setuptools (>= 0.6c1), python-six, python:any (>= 2.7.5-5~), python, python:any (<< 2.8)
Recommends: build-essential, python-dev-all (>= 2.6), python-wheel
Filename: pool/universe/p/python-pip/python-pip_1.5.4-1ubuntu4_all.deb
Size: 97320
MD5sum: 2f9893e68cba11320605bbc554000b2f
SHA1: 118e52d621b4f8aabbc5c9726e5191cbc27a70a0
SHA256: acf90866fdc9b1715b7298764ba7479bc55294dfa26b7f4dfffeb190bd2eb839
Homepage: http://www.pip-installer.org/
Description-en: alternative Python package installer
 pip is a replacement for easy_install, and is intended to be an improved
 Python package installer.  It integrates with virtualenv, doesn't do partial
 installs, can save package state for replaying, can install from non-egg
 sources, and can install from version control repositories.
Description-md5: 8d21e4048f43043df36daaae334010b5

python2.7 version which Minion uses:

# /usr/bin/python2.7 -V
Python 2.7.6

# lsof -n -p 23780
COMMAND     PID USER   FD   TYPE DEVICE SIZE/OFF   NODE NAME
salt-mini 23780 root  cwd    DIR  252,0     4096      2 /
salt-mini 23780 root  rtd    DIR  252,0     4096      2 /
salt-mini 23780 root  txt    REG  252,0  3341384   5980 /usr/bin/python2.7
salt-mini 23780 root  mem    REG  252,0   170056 130921 /lib/x86_64-linux-gnu/libexpat.so.1.6.0
salt-mini 23780 root  mem    REG  252,0    69200 144779 /usr/lib/python2.7/lib-dynload/pyexpat.x86_64-linux-gnu.so
salt-mini 23780 root  mem    REG  252,0    58360 144777 /usr/lib/python2.7/lib-dynload/_elementtree.x86_64-linux-gnu.so
salt-mini 23780 root  mem    REG  252,0    11152 144800 /usr/lib/python2.7/lib-dynload/resource.x86_64-linux-gnu.so
salt-mini 23780 root  mem    REG  252,0   167096 130955 /lib/x86_64-linux-gnu/libtinfo.so.5.9
salt-mini 23780 root  mem    REG  252,0   211784 130893 /lib/x86_64-linux-gnu/libncursesw.so.5.9
salt-mini 23780 root  mem    REG  252,0    82328 144770 /usr/lib/python2.7/lib-dynload/_curses.x86_64-linux-gnu.so
salt-mini 23780 root  mem    REG  252,0     6112  27575 /usr/lib/python2.7/dist-packages/tornado/speedups.so
salt-mini 23780 root  mem    REG  252,0   129104   6456 /usr/lib/x86_64-linux-gnu/libyaml-0.so.2.0.2
salt-mini 23780 root  mem    REG  252,0   186688  26867 /usr/lib/python2.7/dist-packages/_yaml.so
salt-mini 23780 root  mem    REG  252,0    33448 144788 /usr/lib/python2.7/lib-dynload/_multiprocessing.x86_64-linux-gnu.so
salt-mini 23780 root  mem    REG  252,0    30944   3079 /usr/lib/x86_64-linux-gnu/libffi.so.6.0.1
salt-mini 23780 root  mem    REG  252,0   136232 144795 /usr/lib/python2.7/lib-dynload/_ctypes.x86_64-linux-gnu.so
salt-mini 23780 root  mem    REG  252,0     6256    428 /usr/lib/python2.7/dist-packages/_psutil_posix.x86_64-linux-gnu.so
salt-mini 23780 root  mem    REG  252,0    14768   5617 /usr/lib/python2.7/dist-packages/_psutil_linux.x86_64-linux-gnu.so
salt-mini 23780 root  mem    REG  252,0    31720  40288 /usr/lib/python2.7/dist-packages/Crypto/Cipher/_AES.x86_64-linux-gnu.so
salt-mini 23780 root  mem    REG  252,0    15584  27099 /usr/lib/python2.7/dist-packages/Crypto/Util/_counter.x86_64-linux-gnu.so
salt-mini 23780 root  mem    REG  252,0   475168   6441 /usr/lib/x86_64-linux-gnu/libgmp.so.10.1.3
salt-mini 23780 root  mem    REG  252,0    73728  27069 /usr/lib/python2.7/dist-packages/Crypto/PublicKey/_fastmath.x86_64-linux-gnu.so
salt-mini 23780 root  mem    REG  252,0    21168 144776 /usr/lib/python2.7/lib-dynload/_lsprof.x86_64-linux-gnu.so
salt-mini 23780 root  mem    REG  252,0    24648 144775 /usr/lib/python2.7/lib-dynload/termios.x86_64-linux-gnu.so
salt-mini 23780 root  mem    REG  252,0   387272 130889 /lib/x86_64-linux-gnu/libssl.so.1.0.0
salt-mini 23780 root  mem    REG  252,0    38480 144783 /usr/lib/python2.7/lib-dynload/_ssl.x86_64-linux-gnu.so
salt-mini 23780 root  mem    REG  252,0    54064 144773 /usr/lib/python2.7/lib-dynload/_json.x86_64-linux-gnu.so
salt-mini 23780 root  mem    REG  252,0   109232 144525 /usr/lib/python2.7/lib-dynload/datetime.x86_64-linux-gnu.so
salt-mini 23780 root  mem    REG  252,0  1934624 130888 /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
salt-mini 23780 root  mem    REG  252,0    20664 144768 /usr/lib/python2.7/lib-dynload/_hashlib.x86_64-linux-gnu.so
salt-mini 23780 root  mem    REG  252,0    43616 160238 /lib/x86_64-linux-gnu/libnss_files-2.19.so
salt-mini 23780 root  mem    REG  252,0    47760 160259 /lib/x86_64-linux-gnu/libnss_nis-2.19.so
salt-mini 23780 root  mem    REG  252,0    97296 160231 /lib/x86_64-linux-gnu/libnsl-2.19.so
salt-mini 23780 root  mem    REG  252,0    39824 160256 /lib/x86_64-linux-gnu/libnss_compat-2.19.so
salt-mini 23780 root  mem    REG  252,0  1071552 160241 /lib/x86_64-linux-gnu/libm-2.19.so
salt-mini 23780 root  mem    REG  252,0   100728 130965 /lib/x86_64-linux-gnu/libz.so.1.2.8
salt-mini 23780 root  mem    REG  252,0    10680 160227 /lib/x86_64-linux-gnu/libutil-2.19.so
salt-mini 23780 root  mem    REG  252,0    14664 160248 /lib/x86_64-linux-gnu/libdl-2.19.so
salt-mini 23780 root  mem    REG  252,0  1857312 160242 /lib/x86_64-linux-gnu/libc-2.19.so
salt-mini 23780 root  mem    REG  252,0   141574 160244 /lib/x86_64-linux-gnu/libpthread-2.19.so
salt-mini 23780 root  mem    REG  252,0   149120 160253 /lib/x86_64-linux-gnu/ld-2.19.so

Salt Master versions-report:

Salt Version:
           Salt: 2017.7.1

Dependency Versions:
           cffi: 1.10.0
       cherrypy: 5.6.0
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.8.1
        libgit2: 0.26.0
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: 2.18
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: 0.26.0
         Python: 2.7.13 (default, Jul 12 2017, 17:32:34)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 14.5.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5

System Versions:
           dist: centos 6.9 Final
         locale: UTF-8
        machine: x86_64
        release: 2.6.32-696.10.2.el6.x86_64
         system: Linux
        version: CentOS 6.9 Final

Salt Minion versions-report:

Salt Version:
           Salt: 2017.7.1

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 1.5
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.7.2
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: 0.9.1
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: 1.2.3
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.6 (default, Oct 26 2016, 20:30:19)
   python-gnupg: Not Installed
         PyYAML: 3.10
          PyZMQ: 14.0.1
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5

System Versions:
           dist: Ubuntu 14.04 trusty
         locale: UTF-8
        machine: x86_64
        release: 4.2.0-34-generic
         system: Linux
        version: Ubuntu 14.04 trusty
sokratisg commented 6 years ago

@gtmanfred did you have the chance to check previous comments? Can this issue be related to Ubuntu Trusty's pip2.7 binary?

gtmanfred commented 6 years ago

can you run the command with salt-call, and pass -l debug and provide that log?

Thanks, Daniel

sokratisg commented 6 years ago

below is the output of salt-call -l debug state.sls python_pip.modules

# salt-call -l debug state.sls python_pip.modules

[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG   ] Using cached minion ID from /etc/salt/minion_id: ubuntu-trusty-minion
[DEBUG   ] Configuration file path: /etc/salt/minion
[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG   ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG   ] Please install 'virt-what' to improve results of the 'virtual' grain.
[DEBUG   ] Connecting to master. Attempt 1 (infinite attempts)
[DEBUG   ] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'ubuntu-trusty-minion', 'tcp://10.10.10.1:4506')
[DEBUG   ] Generated random reconnect delay between '1000ms' and '11000ms' (5984)
[DEBUG   ] Setting zmq_reconnect_ivl to '5984ms'
[DEBUG   ] Setting zmq_reconnect_ivl_max to '11000ms'
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'ubuntu-trusty-minion', 'tcp://10.10.10.1:4506', 'clear')
[DEBUG   ] Decrypting the current master AES key
[DEBUG   ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[DEBUG   ] SaltEvent PUB socket URI: /var/run/salt/minion/minion_event_d692cef229_pub.ipc
[DEBUG   ] SaltEvent PULL socket URI: /var/run/salt/minion/minion_event_d692cef229_pull.ipc
[DEBUG   ] Initializing new IPCClient for path: /var/run/salt/minion/minion_event_d692cef229_pull.ipc
[DEBUG   ] Sending event: tag = salt/auth/creds; data = {'_stamp': '2017-10-03T14:49:10.161074', 'creds': {'publish_port': 4505, 'aes': '554/vT54VsOBu5ft+8kOTlrkhNc7xrTRDeXVUllhip26Sd71+5O/va8hrQPfgNJckOQbAz4UDMA=', 'master_uri': 'tcp://10.10.10.1:4506'}, 'key': ('/etc/salt/pki/minion', 'ubuntu-trusty-minion', 'tcp://10.10.10.1:4506')}
[DEBUG   ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[DEBUG   ] Determining pillar cache
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'ubuntu-trusty-minion', 'tcp://10.10.10.1:4506', 'aes')
[DEBUG   ] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'ubuntu-trusty-minion', 'tcp://10.10.10.1:4506')
[DEBUG   ] Loaded minion key: /etc/salt/pki/minion/minion.pem
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] LazyLoaded state.sls
[DEBUG   ] LazyLoaded saltutil.is_running
[DEBUG   ] LazyLoaded grains.get
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'ubuntu-trusty-minion', 'tcp://10.10.10.1:4506', 'aes')
[DEBUG   ] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'ubuntu-trusty-minion', 'tcp://10.10.10.1:4506')
[INFO    ] Loading fresh modules for state activity
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] In saltenv 'base', looking at rel_path 'python_pip/modules.sls' to resolve 'salt://python_pip/modules.sls'
[DEBUG   ] In saltenv 'base', ** considering ** path '/var/cache/salt/minion/files/base/python_pip/modules.sls' to resolve 'salt://python_pip/modules.sls'
[DEBUG   ] Fetching file from saltenv 'base', ** attempting ** 'salt://python_pip/modules.sls'
[DEBUG   ] No dest file found
[INFO    ] Fetching file from saltenv 'base', ** done ** 'python_pip/modules.sls'
[DEBUG   ] compile template: /var/cache/salt/minion/files/base/python_pip/modules.sls
[DEBUG   ] Jinja search path: ['/var/cache/salt/minion/files/base']
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'ubuntu-trusty-minion', 'tcp://10.10.10.1:4506', 'aes')
[DEBUG   ] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'ubuntu-trusty-minion', 'tcp://10.10.10.1:4506')
[DEBUG   ] In saltenv 'base', looking at rel_path 'python_pip/map.jinja' to resolve 'salt://python_pip/map.jinja'
[DEBUG   ] In saltenv 'base', ** considering ** path '/var/cache/salt/minion/files/base/python_pip/map.jinja' to resolve 'salt://python_pip/map.jinja'
[DEBUG   ] Fetching file from saltenv 'base', ** attempting ** 'salt://python_pip/map.jinja'
[DEBUG   ] No dest file found
[INFO    ] Fetching file from saltenv 'base', ** done ** 'python_pip/map.jinja'
[DEBUG   ] LazyLoaded grains.filter_by
[DEBUG   ] LazyLoaded pillar.get
[PROFILE ] Time (in seconds) to render '/var/cache/salt/minion/files/base/python_pip/modules.sls' using 'jinja' renderer: 0.0409889221191
[DEBUG   ] Rendered data from file: /var/cache/salt/minion/files/base/python_pip/modules.sls:

include:
  - python_pip
  - packages.salt-minion

# Graypy for graylog_returner
pip_graypy:
  pip.installed:
    - name: graypy==0.2.11
    - upgrade: False
    - bin_env: /usr/local/bin/pip2.7
    - require:
      - pkg: python-pip
    - onchanges_in:
      - cmd: salt-minion_self_restart
    - order: last

# Upgrade requests package to avoid 'certs not found error'
pip_requests:
  pip.installed:
    - name: requests
    - upgrade: True
    - bin_env: /usr/local/bin/pip2.7
    - require:
      - pkg: python-pip
    - onchanges_in:
      - cmd: salt-minion_self_restart
    - order: last

# Beacons requirement
pip_pyinotify:
  pip.installed:
    - name: pyinotify
    - upgrade: False
    - bin_env: /usr/local/bin/pip2.7
    - require:
      - pkg: python-pip
    - onchanges_in:
      - cmd: salt-minion_self_restart
    - order: last

[DEBUG   ] LazyLoaded config.get
[DEBUG   ] Results of YAML rendering:
OrderedDict([('include', ['python_pip', 'packages.salt-minion']), ('pip_graypy', OrderedDict([('pip.installed', [OrderedDict([('name', 'graypy==0.2.11')]), OrderedDict([('upgrade', False)]), OrderedDict([('bin_env', '/usr/local/bin/pip2.7')]), OrderedDict([('require', [OrderedDict([('pkg', 'python-pip')])])]), OrderedDict([('onchanges_in', [OrderedDict([('cmd', 'salt-minion_self_restart')])])]), OrderedDict([('order', 'last')])])])), ('pip_requests', OrderedDict([('pip.installed', [OrderedDict([('name', 'requests')]), OrderedDict([('upgrade', True)]), OrderedDict([('bin_env', '/usr/local/bin/pip2.7')]), OrderedDict([('require', [OrderedDict([('pkg', 'python-pip')])])]), OrderedDict([('onchanges_in', [OrderedDict([('cmd', 'salt-minion_self_restart')])])]), OrderedDict([('order', 'last')])])])), ('pip_pyinotify', OrderedDict([('pip.installed', [OrderedDict([('name', 'pyinotify')]), OrderedDict([('upgrade', False)]), OrderedDict([('bin_env', '/usr/local/bin/pip2.7')]), OrderedDict([('require', [OrderedDict([('pkg', 'python-pip')])])]), OrderedDict([('onchanges_in', [OrderedDict([('cmd', 'salt-minion_self_restart')])])]), OrderedDict([('order', 'last')])])]))])
[PROFILE ] Time (in seconds) to render '/var/cache/salt/minion/files/base/python_pip/modules.sls' using 'yaml' renderer: 0.0243611335754
[DEBUG   ] Could not find file 'salt://python_pip.sls' in saltenv 'base'
[DEBUG   ] In saltenv 'base', looking at rel_path 'python_pip/init.sls' to resolve 'salt://python_pip/init.sls'
[DEBUG   ] In saltenv 'base', ** considering ** path '/var/cache/salt/minion/files/base/python_pip/init.sls' to resolve 'salt://python_pip/init.sls'
[DEBUG   ] Fetching file from saltenv 'base', ** attempting ** 'salt://python_pip/init.sls'
[DEBUG   ] No dest file found
[INFO    ] Fetching file from saltenv 'base', ** done ** 'python_pip/init.sls'
[DEBUG   ] compile template: /var/cache/salt/minion/files/base/python_pip/init.sls
[DEBUG   ] Jinja search path: ['/var/cache/salt/minion/files/base']
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'ubuntu-trusty-minion', 'tcp://10.10.10.1:4506', 'aes')
[DEBUG   ] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'ubuntu-trusty-minion', 'tcp://10.10.10.1:4506')
[DEBUG   ] In saltenv 'base', looking at rel_path 'python_pip/map.jinja' to resolve 'salt://python_pip/map.jinja'
[DEBUG   ] In saltenv 'base', ** considering ** path '/var/cache/salt/minion/files/base/python_pip/map.jinja' to resolve 'salt://python_pip/map.jinja'
[PROFILE ] Time (in seconds) to render '/var/cache/salt/minion/files/base/python_pip/init.sls' using 'jinja' renderer: 0.024062871933
[DEBUG   ] Rendered data from file: /var/cache/salt/minion/files/base/python_pip/init.sls:

include:
  - packages.devtools

python-pip:
  pkg.latest:
    - pkgs:
      - python-pip
      - python-dev
    - reload_modules: True
    - require:
      - pkg: build-essential

[DEBUG   ] Results of YAML rendering:
OrderedDict([('include', ['packages.devtools']), ('python-pip', OrderedDict([('pkg.latest', [OrderedDict([('pkgs', ['python-pip', 'python-dev'])]), OrderedDict([('reload_modules', True)]), OrderedDict([('require', [OrderedDict([('pkg', 'build-essential')])])])])]))])
[PROFILE ] Time (in seconds) to render '/var/cache/salt/minion/files/base/python_pip/init.sls' using 'yaml' renderer: 0.00482511520386
[DEBUG   ] In saltenv 'base', looking at rel_path 'packages/devtools.sls' to resolve 'salt://packages/devtools.sls'
[DEBUG   ] In saltenv 'base', ** considering ** path '/var/cache/salt/minion/files/base/packages/devtools.sls' to resolve 'salt://packages/devtools.sls'
[DEBUG   ] Fetching file from saltenv 'base', ** attempting ** 'salt://packages/devtools.sls'
[DEBUG   ] No dest file found
[INFO    ] Fetching file from saltenv 'base', ** done ** 'packages/devtools.sls'
[DEBUG   ] compile template: /var/cache/salt/minion/files/base/packages/devtools.sls
[DEBUG   ] Jinja search path: ['/var/cache/salt/minion/files/base']
[PROFILE ] Time (in seconds) to render '/var/cache/salt/minion/files/base/packages/devtools.sls' using 'jinja' renderer: 0.00617504119873
[DEBUG   ] Rendered data from file: /var/cache/salt/minion/files/base/packages/devtools.sls:
git:
  pkg.installed: []

git_root_sslverify:
  git.config_set:
    - name: http.sslVerify
    - value: 'false'
    - global: True
    - user: root
    - require:
        - pkg: git

build-essential:
  pkg.installed: []

[DEBUG   ] Results of YAML rendering:
OrderedDict([('git', OrderedDict([('pkg.installed', [])])), ('git_root_sslverify', OrderedDict([('git.config_set', [OrderedDict([('name', 'http.sslVerify')]), OrderedDict([('value', 'false')]), OrderedDict([('global', True)]), OrderedDict([('user', 'root')]), OrderedDict([('require', [OrderedDict([('pkg', 'git')])])])])])), ('build-essential', OrderedDict([('pkg.installed', [])]))])
[PROFILE ] Time (in seconds) to render '/var/cache/salt/minion/files/base/packages/devtools.sls' using 'yaml' renderer: 0.00633502006531
[DEBUG   ] In saltenv 'base', looking at rel_path 'packages/salt-minion.sls' to resolve 'salt://packages/salt-minion.sls'
[DEBUG   ] In saltenv 'base', ** considering ** path '/var/cache/salt/minion/files/base/packages/salt-minion.sls' to resolve 'salt://packages/salt-minion.sls'
[DEBUG   ] Fetching file from saltenv 'base', ** attempting ** 'salt://packages/salt-minion.sls'
[DEBUG   ] No dest file found
[INFO    ] Fetching file from saltenv 'base', ** done ** 'packages/salt-minion.sls'
[DEBUG   ] compile template: /var/cache/salt/minion/files/base/packages/salt-minion.sls
[DEBUG   ] Jinja search path: ['/var/cache/salt/minion/files/base']
[PROFILE ] Time (in seconds) to render '/var/cache/salt/minion/files/base/packages/salt-minion.sls' using 'jinja' renderer: 0.00485920906067
[DEBUG   ] Rendered data from file: /var/cache/salt/minion/files/base/packages/salt-minion.sls:
# Make sure salt-minion is always enabled
salt-minion_service:
  service.enabled:
    - name: salt-minion

salt-minion_custom_settings:
  file.blockreplace:
    - name: /etc/salt/minion
    - marker_start: "### START CUSTOM CONFIGURATION - DO NOT EDIT --"
    - marker_end: "### END CUSTOM CONFIGURATION - DO NOT EDIT --"
    - content: |
        default_include: minion.d/*.conf
        master_tries: -1
        tcp_authentication_retries: -1
        random_startup_delay: 10
    - append_if_not_found: True
    - backup: False
    - show_changes: False
    - reload_modules: True
    - require:
        - service: salt-minion_service
    - order: last
salt-minion_self_restart:
  cmd.run:
    - name: 'salt-call --local service.restart salt-minion'
    - bg: True
    - onchanges:
      - file: salt-minion_custom_settings

#

[DEBUG   ] Results of YAML rendering:
OrderedDict([('salt-minion_service', OrderedDict([('service.enabled', [OrderedDict([('name', 'salt-minion')])])])), ('salt-minion_custom_settings', OrderedDict([('file.blockreplace', [OrderedDict([('name', '/etc/salt/minion')]), OrderedDict([('marker_start', '### START CUSTOM CONFIGURATION - DO NOT EDIT --')]), OrderedDict([('marker_end', '### END CUSTOM CONFIGURATION - DO NOT EDIT --')]), OrderedDict([('content', 'default_include: minion.d/*.conf\nmaster_tries: -1\ntcp_authentication_retries: -1\nrandom_startup_delay: 10\n')]), OrderedDict([('append_if_not_found', True)]), OrderedDict([('backup', False)]), OrderedDict([('show_changes', False)]), OrderedDict([('reload_modules', True)]), OrderedDict([('require', [OrderedDict([('service', 'salt-minion_service')])])]), OrderedDict([('order', 'last')])])])), ('salt-minion_self_restart', OrderedDict([('cmd.run', [OrderedDict([('name', 'salt-call --local service.restart salt-minion')]), OrderedDict([('bg', True)]), OrderedDict([('onchanges', [OrderedDict([('file', 'salt-minion_custom_settings')])])])])]))])
[PROFILE ] Time (in seconds) to render '/var/cache/salt/minion/files/base/packages/salt-minion.sls' using 'yaml' renderer: 0.00727295875549
[DEBUG   ] LazyLoaded pkg.install
[DEBUG   ] LazyLoaded pkg.installed
[DEBUG   ] You should upgrade pyOpenSSL to at least 0.14.1 to enable the use of X509 extensions in the tls module
[DEBUG   ] Module DSC: Only available on Windows systems
[DEBUG   ] Module PSGet: Only available on Windows systems
[DEBUG   ] Could not LazyLoad pkg.ex_mod_init: 'pkg.ex_mod_init' is not available.
[INFO    ] Running state [git] at time 14:49:12.159094
[INFO    ] Executing state pkg.installed for [git]
[INFO    ] Executing command ['dpkg-query', '--showformat', '${Status} ${Package} ${Version} ${Architecture}', '-W'] in directory '/root'
[DEBUG   ] Could not LazyLoad pkg.normalize_name: 'pkg.normalize_name' is not available.
[INFO    ] Package git is already installed
[INFO    ] Completed state [git] at time 14:49:13.215263 duration_in_ms=1056.169
[INFO    ] Executing command ['git', '--version'] in directory '/root'
[DEBUG   ] stdout: git version 1.9.1
[DEBUG   ] LazyLoaded git.config_set
[INFO    ] Running state [http.sslVerify] at time 14:49:13.349513
[INFO    ] Executing state git.config_set for [http.sslVerify]
[INFO    ] Executing command ['git', 'config', '--global', '--get-all', 'http.sslVerify'] as user 'root' in directory '/root'
stdin: is not a tty
[DEBUG   ] stdout: false
[INFO    ] Global key 'http.sslVerify' is already set to 'false'
[INFO    ] Completed state [http.sslVerify] at time 14:49:13.399752 duration_in_ms=50.239
[INFO    ] Running state [build-essential] at time 14:49:13.400102
[INFO    ] Executing state pkg.installed for [build-essential]
[DEBUG   ] Could not LazyLoad pkg.normalize_name: 'pkg.normalize_name' is not available.
[INFO    ] Package build-essential is already installed
[INFO    ] Completed state [build-essential] at time 14:49:13.409126 duration_in_ms=9.023
[INFO    ] Running state [python-pip] at time 14:49:13.409795
[INFO    ] Executing state pkg.latest for [python-pip]
[DEBUG   ] Could not LazyLoad pkg.normalize_name: 'pkg.normalize_name' is not available.
[INFO    ] Executing command ['apt-get', '-q', 'update'] in directory '/root'
[INFO    ] Executing command ['apt-cache', '-q', 'policy', 'python-pip'] in directory '/root'
[INFO    ] Executing command ['apt-cache', '-q', 'policy', 'python-dev'] in directory '/root'
[INFO    ] All packages are up-to-date (python-dev, python-pip).
[INFO    ] Completed state [python-pip] at time 14:49:24.746066 duration_in_ms=11336.269
[DEBUG   ] LazyLoaded service.enabled
[INFO    ] Running state [salt-minion] at time 14:49:24.747574
[INFO    ] Executing state service.enabled for [salt-minion]
[INFO    ] Executing command ['runlevel', '/run/utmp'] in directory '/root'
[DEBUG   ] output: N 2
[INFO    ] Service salt-minion is already enabled, and is in the desired state
[INFO    ] Completed state [salt-minion] at time 14:49:24.797238 duration_in_ms=49.668
[DEBUG   ] LazyLoaded cmd.run
[DEBUG   ] LazyLoaded file.blockreplace
[INFO    ] Running state [/etc/salt/minion] at time 14:49:24.803641
[INFO    ] Executing state file.blockreplace for [/etc/salt/minion]
[INFO    ] No changes needed to be made
[INFO    ] Completed state [/etc/salt/minion] at time 14:49:24.805271 duration_in_ms=1.631
[DEBUG   ] LazyLoaded boto_datapipeline.create_pipeline
[DEBUG   ] LazyLoaded pip.installed
[INFO    ] Running state [graypy==0.2.11] at time 14:49:24.933205
[INFO    ] Executing state pip.installed for [graypy==0.2.11]
[ERROR   ] An importable Python 2 pip module is required but could not be found on your system. This usually means that the system's pip package is not installed properly.
[INFO    ] Completed state [graypy==0.2.11] at time 14:49:24.934285 duration_in_ms=1.081
[INFO    ] Running state [requests] at time 14:49:24.934751
[INFO    ] Executing state pip.installed for [requests]
[ERROR   ] An importable Python 2 pip module is required but could not be found on your system. This usually means that the system's pip package is not installed properly.
[INFO    ] Completed state [requests] at time 14:49:24.935696 duration_in_ms=0.945
[INFO    ] Running state [pyinotify] at time 14:49:24.936087
[INFO    ] Executing state pip.installed for [pyinotify]
[ERROR   ] An importable Python 2 pip module is required but could not be found on your system. This usually means that the system's pip package is not installed properly.
[INFO    ] Completed state [pyinotify] at time 14:49:24.937167 duration_in_ms=1.081
[DEBUG   ] File /var/cache/salt/minion/accumulator/140737082164176 does not exist, no need to cleanup.
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for ('/etc/salt/pki/minion', 'ubuntu-trusty-minion', 'tcp://10.10.10.1:4506', 'aes')
[DEBUG   ] Initializing new AsyncAuth for ('/etc/salt/pki/minion', 'ubuntu-trusty-minion', 'tcp://10.10.10.1:4506')
[DEBUG   ] LazyLoaded highstate.output
local:
----------
          ID: git
    Function: pkg.installed
      Result: True
     Comment: Package git is already installed
     Started: 14:49:12.159094
    Duration: 1056.169 ms
     Changes:
----------
          ID: git_root_sslverify
    Function: git.config_set
        Name: http.sslVerify
      Result: True
     Comment: Global key 'http.sslVerify' is already set to 'false'
     Started: 14:49:13.349513
    Duration: 50.239 ms
     Changes:
----------
          ID: build-essential
    Function: pkg.installed
      Result: True
     Comment: Package build-essential is already installed
     Started: 14:49:13.400103
    Duration: 9.023 ms
     Changes:
----------
          ID: python-pip
    Function: pkg.latest
      Result: True
     Comment: All packages are up-to-date (python-dev, python-pip).
     Started: 14:49:13.409797
    Duration: 11336.269 ms
     Changes:
----------
          ID: salt-minion_service
    Function: service.enabled
        Name: salt-minion
      Result: True
     Comment: Service salt-minion is already enabled, and is in the desired state
     Started: 14:49:24.747570
    Duration: 49.668 ms
     Changes:
----------
          ID: salt-minion_custom_settings
    Function: file.blockreplace
        Name: /etc/salt/minion
      Result: True
     Comment: No changes needed to be made
     Started: 14:49:24.803640
    Duration: 1.631 ms
     Changes:
----------
          ID: pip_graypy
    Function: pip.installed
        Name: graypy==0.2.11
      Result: False
     Comment: An importable Python 2 pip module is required but could not be found on your system. This usually means that the system's pip package is not installed properly.
     Started: 14:49:24.933204
    Duration: 1.081 ms
     Changes:
----------
          ID: pip_requests
    Function: pip.installed
        Name: requests
      Result: False
     Comment: An importable Python 2 pip module is required but could not be found on your system. This usually means that the system's pip package is not installed properly.
     Started: 14:49:24.934751
    Duration: 0.945 ms
     Changes:
----------
          ID: pip_pyinotify
    Function: pip.installed
        Name: pyinotify
      Result: False
     Comment: An importable Python 2 pip module is required but could not be found on your system. This usually means that the system's pip package is not installed properly.
     Started: 14:49:24.936086
    Duration: 1.081 ms
     Changes:
----------
          ID: salt-minion_self_restart
    Function: cmd.run
        Name: salt-call --local service.restart salt-minion
      Result: False
     Comment: One or more requisite failed: python_pip.modules.pip_requests, python_pip.modules.pip_pyinotify, python_pip.modules.pip_graypy
     Changes:

Summary for local
------------
Succeeded: 6
Failed:    4
------------
Total states run:    10
Total run time:  12.506 s
sokratisg commented 6 years ago

Just wanted to note that we've managed to resolve this issue, although not with the best possible approach. It seems that Ubuntu Trusty's python-pip package (pip version 1.5.4) created this issue.

After upgrading manually to pip 9.0.1 this issue is resolved: pip install --ignore-installed --upgrade 'pip==9.0.1' Wrapped that command into a cmd.run right before any call to pip.installed state and issue is resolved, at least partially. The 1st highstate returns False for all pip.installed states but right after that everything runs smoothly.

Important note and question at the same time: Shouldn't reload_modules: True cover this use case? It seems it doesn't since the 1st state.highstate always fails for all pip.installed states.

Excerpt from our states

pip_upgrade:
  cmd.run:
    - name: pip install --ignore-installed --upgrade 'pip==9.0.1'
    - unless: pip -V | grep '9.0.1'
    - require:
      - pkg: python-pip
    - reload_modules: True
fattybenji commented 6 years ago

I know the issue is pretty old, but I had the same problem today. I noticed that there was a difference in versions of Salt between my master and my slave... The master was in 2017.7.2 and the slave was in 2017.7.3, which is not recommended... I tried the same state with the right version and it worked.

zerthimon commented 6 years ago

Hit the same issue. Downgrading pip from 10.x to 9.0.x helps.

bobbysmith007 commented 6 years ago

I had this issue when installing a new salt on a new ubuntu 18.04 server today. My salt states were giving an error: "An importable pip module is required but could not be found on your system" but pip was runnable from the path. I tracked it down to the pip.req module not being available in pip 10.x which causes it to throw that error

running pip install --upgrade --force 'pip<10.0.0' resolved the error for me

gtmanfred commented 6 years ago

That error will be fixed in 2018.3.1 and 2017.7.6

https://github.com/saltstack/salt/pull/47121