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

Manually specifying version 18.0 gives an error #5857

Closed
jared-wallace opened this issue Oct 5, 2018 · 7 comments
Closed

Manually specifying version 18.0 gives an error #5857

jared-wallace opened this issue Oct 5, 2018 · 7 comments
Labels
auto-locked Outdated issues that have been locked by automation resolution: wrong project Should be reported elsewhere

Comments

@jared-wallace
Copy link

Environment

  • pip version:
  • Python version: 3.6.6 and 3.7.0 tested
  • OS: Ubuntu 18.04

Description

the command "python get-pip.py pip==18.0"
gives a result of "Double requirement given: pip (already in pip==18.0, name='pip')"
Expected behavior

This worked fine a day ago, so I suspect a regression with the latest release.
How to Reproduce

sh> PIPVERSION=18.0
sh> curl -o /tmp/get-pip.py -sSL "https://bootstrap.pypa.io/get-pip.py"
sh> python /tmp/get-pip.py pip==${PIPVERSION}
sh> python --version

Output

build@997821efc658:/work$ PIPVERSION=18.0
build@997821efc658:/work$ curl -o /tmp/get-pip.py -sSL "https://bootstrap.pypa.io/get-pip.py"
build@997821efc658:/work$ python /tmp/get-pip.py pip==${PIPVERSION}
Double requirement given: pip (already in pip==18.0, name='pip')
build@997821efc658:/work$ python --version
Python 3.6.6
@benoit-pierre
Copy link
Member

Ah! pip victim of its own internal API changes...

--- get-pip.py.orig	2018-10-05 13:30:50.000000000 +0200
+++ get-pip.py	2018-10-05 17:36:01.236818917 +0200
@@ -81,7 +81,7 @@
     # Import pip so we can use it to install pip and maybe setuptools too
     import pip._internal
     from pip._internal.commands.install import InstallCommand
-    from pip._internal.req import InstallRequirement
+    from pip._internal.req.constructors import install_req_from_line
 
     # Wrapper to provide default certificate with the lowest priority
     class CertInstallCommand(InstallCommand):
@@ -134,7 +134,7 @@
     # install of them.
     for arg in args:
         try:
-            req = InstallRequirement.from_line(arg)
+            req = install_req_from_line(arg)
         except Exception:
             continue
 

@jared-wallace
Copy link
Author

Temp workaround:

sed -i -e '84s/from\ pip\._internal\.req\ import\ InstallRequirement/from\ pip\._internal\.req\.constructors\ import\ install_req_from_line/g' get-pip.py

sed -i -e '137s/req\ =\ InstallRequirement\.from_line(arg)/req\ =\ install_req_from_line(arg)/g' get-pip.py

based off the patch above.

@benoit-pierre
Copy link
Member

You could also use a constraint: python get-pip.py -c <(echo 'pip==18.0').

@voidlily
Copy link

voidlily commented Oct 5, 2018

Ah! pip victim of its own internal API changes...

--- get-pip.py.orig	2018-10-05 13:30:50.000000000 +0200
+++ get-pip.py	2018-10-05 17:36:01.236818917 +0200
@@ -81,7 +81,7 @@
     # Import pip so we can use it to install pip and maybe setuptools too
     import pip._internal
     from pip._internal.commands.install import InstallCommand
-    from pip._internal.req import InstallRequirement
+    from pip._internal.req.constructors import install_req_from_line
 
     # Wrapper to provide default certificate with the lowest priority
     class CertInstallCommand(InstallCommand):
@@ -134,7 +134,7 @@
     # install of them.
     for arg in args:
         try:
-            req = InstallRequirement.from_line(arg)
+            req = install_req_from_line(arg)
         except Exception:
             continue
 

If you've verified this fix works, would you mind submitting it as a PR?

@tianon
Copy link

tianon commented Oct 5, 2018

@voidlily see pypa/get-pip#38 👍

wallies added a commit to wallies/dockerfiles that referenced this issue Oct 8, 2018
@pradyunsg
Copy link
Member

Ah! pip victim of its own internal API changes...

Wheee.

Closing since the get-pip PR is merged.

@pradyunsg pradyunsg added the resolution: wrong project Should be reported elsewhere label Oct 8, 2018
@lock
Copy link

lock bot commented May 31, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label May 31, 2019
@lock lock bot locked as resolved and limited conversation to collaborators May 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation resolution: wrong project Should be reported elsewhere
Projects
None yet
Development

No branches or pull requests

5 participants