saltstack / saltstack/salt

[BUG] pip.installed unable to locate matching distribution

Open
#59,708 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug severity-medium
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description
When I try to use the pip.installed state to install a pip package on a minion, the state fails with the error "No matching distribution found for ".

Setup

install_python-pip:
   pkg.latest:
     - name: python-pip

install_pip_MySQL-python:
  pip.installed:
    - name: MySQL-python

Steps to Reproduce the behavior
Running this state will result in the error:

 ID: install_pip_MySQL-python
    Function: pip.installed
        Name: MySQL-python
      Result: False
     Comment: Failed to install packages: MySQL-python. Error: Collecting MySQL-python   Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f452aa49358>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/mysql-python/
                Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f452aa495c0>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/mysql-python/
                Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f452c2afc18>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/mysql-python/
                Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f452b3b3b70>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/mysql-python/
                Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f452b3b3908>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/mysql-python/
                Could not find a version that satisfies the requirement MySQL-python (from versions: )
              No matching distribution found for MySQL-python
     Started: 10:37:30.022022
    Duration: 327149.561 ms
     Changes:

Similarly, if the pip.installed is changed to install the PyMySQL package, the same error (but with a different package name) will result.

Expected behavior
The MySQL-python pip package should install on the minion, or report that the package is already installed.

Versions Report

salt --versions-report Master: Salt Version: Salt: 3002.5

Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.6.1
docker-py: Not Installed
gitdb: 2.0.3
gitpython: 2.1.8
Jinja2: 2.10
libgit2: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 0.5.6
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: Not Installed
pycryptodome: 3.4.7
pygit2: Not Installed
Python: 3.6.9 (default, Jan 26 2021, 15:33:00)
python-gnupg: 0.4.1
PyYAML: 3.12
PyZMQ: 17.1.2
smmap: 2.0.3
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.2.5

System Versions:
dist: ubuntu 18.04 Bionic Beaver
locale: UTF-8
machine: x86_64
release: 4.15.0-135-generic
system: Linux
version: Ubuntu 18.04 Bionic Beaver

Minion:
Salt Version:
Salt: 3002.2

Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.6.1
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 2.10
libgit2: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 0.5.6
msgpack-pure: Not Installed
mysql-python: 1.3.10
pycparser: Not Installed
pycrypto: 2.6.1
pycryptodome: 3.4.7
pygit2: Not Installed
Python: 3.6.9 (default, Oct 8 2020, 12:12:24)
python-gnupg: 0.4.1
PyYAML: 3.12
PyZMQ: 17.1.2
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.1

System Versions:
dist: ubuntu 18.04 Bionic Beaver
locale: UTF-8
machine: x86_64
release: 4.15.0-135-generic
system: Linux
version: Ubuntu 18.04 Bionic Beaver

Additional context
While the state is applying, I can see on the minion that there is a process running:
/usr/bin/python3 -m pip install --disable-pip-version-check MySQL-python

If I run this command manually on the minion, it will run successfully, then if I run the state again from the master, it will correctly report that the package is installed.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the pip.installed state entry point and reproduce the MySQL-python and PyMySQL cases from the issue. Compare the state invocation with the manually successful /usr/bin/python3 -m pip install --disable-pip-version-check MySQL-python command, including the reported network errors. Done means the state installs the package or correctly reports it as already installed.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.