pip's configparser dependency breaks backports namespace conventions

Bug #1812589 reported by Chaz M
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
configparser (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

This is specifically a problem with the debundling of the pip package, see https://github.com/pypa/pip/issues/6149 for further discussion.

Environment
pip version: python-pip (9.0.1-2.3)
Python version: Python 2.7.15+
OS: Ubuntu 18.10

Description
The python-pip package (at least on Ubuntu 18.10) depends on the python-configparser package, which dumps a blank __init__.py into the /usr/lib/python2.7/dist-packages/backports directory. However, backports should instead be defined as a namespace package (see PEP 420 and https://pypi.org/project/backports/). While this is not good in general, this is particularly problematic for pip because the some of packages it installs do not work as a result!

Expected behavior
pip should be able to install backports packages, which can then be imported without error.

How to Reproduce
After installing python-pip, run command pip install backports.shutil_which (the specific backports package does not particularly matter)
Then run from backports.shutil_which import which inside a python shell
An error occurs.

Output
>>> from backports.shutil_which import which
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named shutil_which```

Revision history for this message
Dan Kegel (dank) wrote :

This just cost me four hours on Ubuntu 18.04.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in python-pip (Ubuntu):
status: New → Confirmed
Revision history for this message
Dan Kegel (dank) wrote :

More specifically, if I do

pip install backports.os
python -c "from backports import os"

it fails as described. But if I then do

sudo apt remove python-configparser

it succeeds.

Revision history for this message
Chaz M (chazzz) wrote :

I believe this has been fixed in the configparser source, thanks to Jason R. Coombs (https://github.com/jaraco/configparser/issues/17).

Revision history for this message
Dan Kegel (dank) wrote :
affects: python-pip (Ubuntu) → configparser (Ubuntu)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.