← Back to team overview

group.of.nepali.translators team mailing list archive

[Bug 1864766] [NEW] [SRU] pip in xenial is installing packages incompatible with Python 2.7 (and those are becoming common)

 

Public bug reported:

[Impact]

Python 2.7 support is ending upstream.
Python libraries are dropping 2.7 support, in response to this.

One of the ways that legacy applications & libraries can stay installable is that Python packages can declare Requires-Python >= 3 (or similar).
https://packaging.python.org/guides/dropping-older-python-versions/

The version of pip in Xenial is *just* too old to support this, so it
happily downloads and installs libraries that declare incompatibility
with Python 2.7.

setuptools 45.0.0 was released earlier this year, dropping support for Python 2.7.
It's one of the core packages installed by virtualenv.
Since it was released, virtualenv has been installing it, and then been unable to build C extensions.

[Test Case]

These should install setuptools older than 45, that still works with
Python 2.7:

$ pip install --user setuptools
$ python -c 'import setuptools; print(setuptools.__version__)'
44.0.0

$ virtualenv -v -p python testve
$ testve/bin/python -c 'import setuptools; print(setuptools.__version__)'
44.0.0

Clean up, assuming you don't have anything important in there:
$ rm -rf ~/.local/{bin,lib} testve

These should install setuptools newer than 45, which is compatible with
Python 3.5:

$ pip3 install --user setuptools
$ python3 -c 'import setuptools; print(setuptools.__version__)'
45.2.0

$ virtualenv -v -p python3 testve
$ testve/bin/python -c 'import setuptools; print(setuptools.__version__)'
45.2.0

$ rm -rf ~/.local/{bin,lib} testve

[Regression Potential]

Changing behaviour of core tools always comes with a risk. And pip is at
the centre of the python ecosystem.

However, this is an attempt to fix a post-release regression.

The patch comes from pip's git history. This code has changed since
then, so it's not known to be bug-free.

>From NEWS spelunking, these changes seem related, but are not backported
in this SRU, to keep it minimal:

>From 19.2:
 * Update ``pip download`` to respect the given ``--python-version`` when 
   checking ``"Requires-Python"``.
   https://github.com/pypa/pip/issues/5369
 * Fix ``pip install`` to respect ``--ignore-requires-python`` when
   evaluating links.
   https://github.com/pypa/pip/issues/6371

>From 9.0.0:
 * Raise when Requires-Python do not match the running version and add
   ``--ignore-requires-python`` option as escape hatch.
   https://github.com/pypa/pip/issues/3846

[Other Info]

User Bug: https://github.com/pypa/packaging-problems/issues/325
PEP 503 - Simple Repository API: https://www.python.org/dev/peps/pep-0503/
PEP 345 - Metadata for Python Software Packages 1.2: https://www.python.org/dev/peps/pep-0345/

** Affects: python-pip (Ubuntu)
     Importance: Undecided
         Status: Fix Released

** Affects: python-pip (Ubuntu Xenial)
     Importance: Medium
         Status: In Progress

** Description changed:

  [Impact]
  
  Python 2.7 support is ending upstream.
  Python libraries are dropping 2.7 support, in response to this.
  
  One of the ways that legacy applications & libraries can stay installable is that Python packages can declare Requires-Python >= 3 (or similar).
  https://packaging.python.org/guides/dropping-older-python-versions/
  
  The version of pip in Xenial is *just* too old to support this, so it
  happily downloads and installs libraries that declare incompatibility
  with Python 2.7.
  
  setuptools 45.0.0 was released earlier this year, dropping support for Python 2.7.
  It's one of the core packages installed by virtualenv.
  Since it was released, virtualenv has been installing it, and then been unable to build C extensions.
  
  [Test Case]
  
  These should install setuptools older than 45, that still works with
  Python 2.7:
  
  $ pip install --user setuptools
  $ python -c 'import setuptools; print(setuptools.__version__)'
  44.0.0
  
  $ virtualenv -v -p python testve
  $ testve/bin/python -c 'import setuptools; print(setuptools.__version__)'
  44.0.0
  
  Clean up, assuming you don't have anything important in there:
  $ rm -rf ~/.local/{bin,lib} testve
  
  These should install setuptools newer than 45, which is compatible with
  Python 3.5:
  
  $ pip3 install --user setuptools
  $ python3 -c 'import setuptools; print(setuptools.__version__)'
  45.2.0
  
  $ virtualenv -v -p python3 testve
  $ testve/bin/python -c 'import setuptools; print(setuptools.__version__)'
  45.2.0
  
  $ rm -rf ~/.local/{bin,lib} testve
  
  [Regression Potential]
  
  Changing behaviour of core tools always comes with a risk. And pip is at
  the centre of the python ecosystem.
  
  However, this is an attempt to fix a post-release regression.
  
  The patch comes from pip's git history. This code has changed since
  then, so it's not known to be bug-free.
  
  From NEWS spelunking, these changes seem related, but are not backported
  in this SRU, to keep it minimal:
  
  From 19.2:
-  * Update ``pip download`` to respect the given ``--python-version`` when checking ``"Requires-Python"``.
-    https://github.com/pypa/pip/issues/5369
-  * Fix ``pip install`` to respect ``--ignore-requires-python`` when evaluating links.
-    https://github.com/pypa/pip/issues/6371
+  * Update ``pip download`` to respect the given ``--python-version`` when 
+    checking ``"Requires-Python"``.
+    https://github.com/pypa/pip/issues/5369
+  * Fix ``pip install`` to respect ``--ignore-requires-python`` when
+    evaluating links.
+    https://github.com/pypa/pip/issues/6371
  
  From 9.0.0:
-  * Raise when Requires-Python do not match the running version and add ``--ignore-requires-python`` option as escape hatch.
-    https://github.com/pypa/pip/issues/3846
+  * Raise when Requires-Python do not match the running version and add
+    ``--ignore-requires-python`` option as escape hatch.
+    https://github.com/pypa/pip/issues/3846
  
  [Other Info]
  
  User Bug: https://github.com/pypa/packaging-problems/issues/325
  PEP 503 - Simple Repository API: https://www.python.org/dev/peps/pep-0503/
  PEP 345 - Metadata for Python Software Packages 1.2: https://www.python.org/dev/peps/pep-0345/

** Also affects: python-pip (Ubuntu Xenial)
   Importance: Undecided
       Status: New

** Changed in: python-pip (Ubuntu)
       Status: New => Fix Released

** Changed in: python-pip (Ubuntu Xenial)
   Importance: Undecided => Medium

-- 
You received this bug notification because you are a member of नेपाली
भाषा समायोजकहरुको समूह, which is subscribed to Xenial.
Matching subscriptions: Ubuntu 16.04 Bugs
https://bugs.launchpad.net/bugs/1864766

Title:
  [SRU] pip in xenial is installing packages incompatible with Python
  2.7 (and those are becoming common)

Status in python-pip package in Ubuntu:
  Fix Released
Status in python-pip source package in Xenial:
  In Progress

Bug description:
  [Impact]

  Python 2.7 support is ending upstream.
  Python libraries are dropping 2.7 support, in response to this.

  One of the ways that legacy applications & libraries can stay installable is that Python packages can declare Requires-Python >= 3 (or similar).
  https://packaging.python.org/guides/dropping-older-python-versions/

  The version of pip in Xenial is *just* too old to support this, so it
  happily downloads and installs libraries that declare incompatibility
  with Python 2.7.

  setuptools 45.0.0 was released earlier this year, dropping support for Python 2.7.
  It's one of the core packages installed by virtualenv.
  Since it was released, virtualenv has been installing it, and then been unable to build C extensions.

  [Test Case]

  These should install setuptools older than 45, that still works with
  Python 2.7:

  $ pip install --user setuptools
  $ python -c 'import setuptools; print(setuptools.__version__)'
  44.0.0

  $ virtualenv -v -p python testve
  $ testve/bin/python -c 'import setuptools; print(setuptools.__version__)'
  44.0.0

  Clean up, assuming you don't have anything important in there:
  $ rm -rf ~/.local/{bin,lib} testve

  These should install setuptools newer than 45, which is compatible
  with Python 3.5:

  $ pip3 install --user setuptools
  $ python3 -c 'import setuptools; print(setuptools.__version__)'
  45.2.0

  $ virtualenv -v -p python3 testve
  $ testve/bin/python -c 'import setuptools; print(setuptools.__version__)'
  45.2.0

  $ rm -rf ~/.local/{bin,lib} testve

  [Regression Potential]

  Changing behaviour of core tools always comes with a risk. And pip is
  at the centre of the python ecosystem.

  However, this is an attempt to fix a post-release regression.

  The patch comes from pip's git history. This code has changed since
  then, so it's not known to be bug-free.

  From NEWS spelunking, these changes seem related, but are not
  backported in this SRU, to keep it minimal:

  From 19.2:
   * Update ``pip download`` to respect the given ``--python-version`` when 
     checking ``"Requires-Python"``.
     https://github.com/pypa/pip/issues/5369
   * Fix ``pip install`` to respect ``--ignore-requires-python`` when
     evaluating links.
     https://github.com/pypa/pip/issues/6371

  From 9.0.0:
   * Raise when Requires-Python do not match the running version and add
     ``--ignore-requires-python`` option as escape hatch.
     https://github.com/pypa/pip/issues/3846

  [Other Info]

  User Bug: https://github.com/pypa/packaging-problems/issues/325
  PEP 503 - Simple Repository API: https://www.python.org/dev/peps/pep-0503/
  PEP 345 - Metadata for Python Software Packages 1.2: https://www.python.org/dev/peps/pep-0345/

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python-pip/+bug/1864766/+subscriptions


Follow ups