Public bug reported:

I am running Ubuntu 16.04, with the python3-pip package installed,
version 8.1.1-2.

We have a local PyPI server setup to serve python modules not available on the 
official PyPI server. I've added the local server using the extra-index-url 
option to my pip.conf file. Everything works as expected when I try to install 
one of the modules from the local PyPI server. However, when I try to install a 
module only available on the official PyPI server, say jsonschema, I get the 
following error:
Collecting jsonschema
Exception:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 209, in main
    status = self.run(options, args)
  File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 328, in 
run
    wb.build(autobuilding=True)
  File "/usr/lib/python3/dist-packages/pip/wheel.py", line 748, in build
    self.requirement_set.prepare_files(self.finder)
  File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 360, in 
prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 512, in 
_prepare_file
    finder, self.upgrade, require_hashes)
  File "/usr/lib/python3/dist-packages/pip/req/req_install.py", line 273, in 
populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "/usr/lib/python3/dist-packages/pip/index.py", line 440, in 
find_requirement
    all_candidates = self.find_all_candidates(req.name)
  File "/usr/lib/python3/dist-packages/pip/index.py", line 398, in 
find_all_candidates
    for page in self._get_pages(url_locations, project_name):
  File "/usr/lib/python3/dist-packages/pip/index.py", line 543, in _get_pages
    page = self._get_page(location)
  File "/usr/lib/python3/dist-packages/pip/index.py", line 646, in _get_page
    return HTMLPage.get_page(link, session=self.session)
  File "/usr/lib/python3/dist-packages/pip/index.py", line 758, in get_page
    resp.raise_for_status()
  File 
"/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/models.py",
 line 840, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
pip._vendor.requests.exceptions.HTTPError: 404 Client Error: Not Found for url: 
http://172.17.0.1/packages/wheels-py3/simple/jsonschema/

The problem is that when the requests module raises HTTPError, it's
being seen by pip as pip._vendor.requests.exceptions.HTTPError, while on
pip/index.py line 775, it's trying to catch requests.HTTPError, so the
raised error is not caught.

This error does not occur when pip is installed using the
https://bootstrap.pypa.io/get-pip.py script since the requests module is
bundled under _vendor, and the HTTPError is caught and handled
accordingly.

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

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1579196

Title:
  HTTPError not being caught when module cannot be found

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

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to