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

python::pip's 'latest' not compatible with latest 'pip' (version 20.3) due to changed output #586

Open
kBite opened this issue Dec 2, 2020 · 7 comments
Assignees

Comments

@kBite
Copy link

kBite commented Dec 2, 2020

Affected Puppet, Ruby, OS and module versions/distributions

  • Module version: v5.0.0

How to reproduce (e.g Puppet code you use)

Starting with 20.3 pip is using a new dependency resolver which does not produce the same output as before and breaks puppet-python's logic to determine latest available package version.

Upgrade to pip 20.3 and try installing latest of any package via python::pip.

python::pyvenv { $venv_path:
  ensure     => 'present',
  systempkgs => true,
  owner      => 'agent',
  group      => 'agent',
  mode       => '0755',
}
-> python::pip { 'agent' :
  ensure       => 'latest',
  pkgname      => 'agent',
  pip_provider => 'pip',
  virtualenv   => $venv_path,
  owner        => 'agent',
  group        => 'agent',
  timeout      => 1800,
  require      => Package['python36-devel'],
  notify       => Service['agent'],
}

What are you seeing / What behaviour did you expect instead

With pip 20.2.4 installing a non-existing version returns all available versions (see below).

# /home/agent/venv/bin/pip3 --version
pip 20.2.4 from /home/agent/venv/lib64/python3.6/site-packages/pip (python 3.6)

# /home/agent/venv/bin/pip3 --log /home/agent/venv/pip.log install     agent==notreallyaversion 2>&1
Looking in indexes: https://artifactory.internal-domain.net/artifactory/api/pypi/python-pypi.python.org-remote/simple
ERROR: Could not find a version that satisfies the requirement agent==notreallyaversion (from versions: 0.2.5, 0.2.6, 0.2.7, 0.2.8, 0.2.9, 0.2.10, 0.2.13, 0.2.14)
ERROR: No matching distribution found for agent==notreallyaversion
WARNING: You are using pip version 20.2.4; however, version 20.3 is available.
You should consider upgrading via the '/home/agent/venv/bin/python3.6 -m pip install --upgrade pip' command.

Starting with version 20.3 this information is not returned anymore.

# /home/agent/venv/bin/pip3 --version
pip 20.3 from /home/agent/venv/lib64/python3.6/site-packages/pip (python 3.6)

# /home/agent/venv/bin/pip3 --log /home/agent/venv/pip.log install     agent==notreallyaversion 2>&1
Looking in indexes: https://artifactory.internal-domain.net/artifactory/api/pypi/python-pypi.python.org-remote/simple
ERROR: Could not find a version that satisfies the requirement agent==notreallyaversion
ERROR: No matching distribution found for agent==notreallyaversion

relevant Puppet code

This snippet is from pip.pp and fails due to the missing from versions: string that was dropped with the new dependecy resolver.

'latest': {
  # Unfortunately this is the smartest way of getting the latest available package version with pip as of now
  # Note: we DO need to repeat ourselves with "from version" in both grep and sed as on some systems pip returns
  # more than one line with paretheses.
  $latest_version = join(["${pip_install} ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${real_pkgname}==notreallyaversion 2>&1",
      ' | grep -oP "\(from versions: .*\)" | sed -E "s/\(from versions: (.*?, )*(.*)\)/\2/g"',
  ' | tr -d "[:space:]"'])

reference

@kBite kBite changed the title python::pip's 'latest' not compatible with latest pip (version 20.3) due to change output python::pip's 'latest' not compatible with latest 'pip' (version 20.3) due to change output Dec 2, 2020
@kBite kBite changed the title python::pip's 'latest' not compatible with latest 'pip' (version 20.3) due to change output python::pip's 'latest' not compatible with latest 'pip' (version 20.3) due to changed output Dec 3, 2020
@bastelfreak bastelfreak self-assigned this Dec 3, 2020
@bastelfreak
Copy link
Member

Hi,
I put your code, and a few variations, into an acceptance test and that looks quite good at the moment: #588

bastelfreak added a commit to bastelfreak/puppet-python that referenced this issue Dec 7, 2020
This test currently fails because of voxpupuli#586
bastelfreak added a commit to bastelfreak/puppet-python that referenced this issue Dec 7, 2020
This test currently fails because of voxpupuli#586
@bastelfreak
Copy link
Member

I managed to reproduce the error in #591

bastelfreak added a commit to bastelfreak/puppet-python that referenced this issue Dec 23, 2020
This test currently fails because of voxpupuli#586
@vchepkov
Copy link
Contributor

There is a huge discussion on pypa/pip#9139 to bring functionality back, but for now, one can use

# /opt/python3/bin/pip install --use-deprecated=legacy-resolver agent== 
ERROR: Could not find a version that satisfies the requirement agent== (from versions: 0.1.0, 0.1.1, 0.1.2)
ERROR: No matching distribution found for agent==

notice that you don't have to add anything after ==

bastelfreak added a commit to bastelfreak/puppet-python that referenced this issue Apr 2, 2021
This test currently fails because of voxpupuli#586
bastelfreak added a commit to bastelfreak/puppet-python that referenced this issue Apr 3, 2021
This test currently fails because of voxpupuli#586
@uranusjr
Copy link

uranusjr commented Apr 18, 2021

Hi, a resolution has since been proposed and merged to resolver pypa/pip#9139 by a contributor. Are there still things missing to resolve this?

@vchepkov
Copy link
Contributor

I have the latest pip 21.0.1 and feature is not included there yet

@uranusjr
Copy link

Yes, the change will be the 21.1 release due this month. I was asking whether there are any more things you’d need, or maybe some people to test 21.1 against the current main branch to make sure it works for you, so we don’t need to wait for another feature release to get this resolved.

@bhundven-skytap
Copy link

should be fixed in newer version? pypa/pip#9405

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

No branches or pull requests

5 participants