pip3 client error SSL is required for url

I'm unable to install packages with pip3 (pip 9.0.1, fresh Ubuntu 18.04.1 LTS) when I specify --extra-index-url inside requirements.txt. Here is the requirements.txt:

--extra-index-url https://some.domain
attrs==17.4.0

And here is the output:

$ sudo pip3 install -r requirements.txt         

Collecting attrs==17.4.0 (from -r req.txt (line 2))
Exception:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 342, in run
    requirement_set.prepare_files(finder)
  File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 554, in _prepare_file
    require_hashes
  File "/usr/lib/python3/dist-packages/pip/req/req_install.py", line 278, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "/usr/lib/python3/dist-packages/pip/index.py", line 465, in find_requirement
    all_candidates = self.find_all_candidates(req.name)
  File "/usr/lib/python3/dist-packages/pip/index.py", line 423, in find_all_candidates
    for page in self._get_pages(url_locations, project_name):
  File "/usr/lib/python3/dist-packages/pip/index.py", line 568, in _get_pages
    page = self._get_page(location)
  File "/usr/lib/python3/dist-packages/pip/index.py", line 683, in _get_page
    return HTMLPage.get_page(link, session=self.session)
  File "/usr/lib/python3/dist-packages/pip/index.py", line 795, in get_page
    resp.raise_for_status()
  File "/usr/share/python-wheels/requests-2.18.4-py2.py3-none-any.whl/requests/models.py", line 935, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
pip._vendor.requests.exceptions.HTTPError: 403 Client Error: SSL is required for url: http://pypi.python.org/simple/attrs/

An interesting fact might be that:

$ sudo pip3 install attrs==17.4.0 

works just fine.

1 answer

  • answered 2018-09-21 15:56 hmajid2301

    It could be you need make it a trusted host if the domain is insecure. You can use the --trusted-host argument. So replace the first line of your requirements file with.

    --extra-index-url https://some.domain --trusted-host some.domain
    

    Hope that helps.