question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pip 10 basic auth failure when installing build dependencies

See original GitHub issue
  • Pip version: 10.0.0
  • Python version: 3.6.5
  • Operating system: Linux (Alpine, Gentoo). Reproduced once on macOS; could not a second time.

Description:

Attempting to install a package with build dependencies from a private index with basic auth, without a ~/.netrc file fails with EOFError: EOF when reading a line on line 189 of _internal/download.py (handle_401(), username = six.moves.input("User for %s: " % parsed.netloc)).

What I’ve run:

$ docker pull python:3.6-alpine
...
$ docker run -it -e PIP_INDEX_URL=https://zware:mypassword@example.com/myindex python:3.6-alpine /bin/sh
/ # python3.6 -m venv venv
/ # ./venv/bin/python -m pip install -U pip
<pip 10 downloaded from private index, replaces pip 9.0.3>
/ # ./venv/bin/python -m pip install aiohttp  # "--no-binary aiohttp" may be necessary on non-Alpine platforms
< downloads from private index >
  Installing build dependencies ... error
  Complete output from command /venv/bin/python -m pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-me9p5l31 <full URL to setuptools on my private index> <full URL to wheel on my private index>:
  Looking in indexes: <my index, with basic auth in URL>
  Collecting setuptools==39.0.1 from <full URL to setuptools on my private index>
  User for <my index netloc>: Exception:
  Traceback (most recent call last):
    File "/venv/lib/python3.6/site-packages/pip/_internal/basecommand.py", line 228, in main
      status = self.run(options, args)
    File "/venv/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 291, in run
      resolver.resolve(requirement_set)
    File "/venv/lib/python3.6/site-packages/pip/_internal/resolve.py", line 103, in resolve
      self._resolve_one(requirement_set, req)
    File "/venv/lib/python3.6/site-packages/pip/_internal/resolve.py", line 257, in _resolve_one
      abstract_dist = self._get_abstract_dist_for(req_to_install)
    File "/venv/lib/python3.6/site-packages/pip/_internal/resolve.py", line 210, in _get_abstract_dist_for
      self.require_hashes
    File "/venv/lib/python3.6/site-packages/pip/_internal/operations/prepare.py", line 308, in prepare_linked_requirement
      progress_bar=self.progress_bar
    File "/venv/lib/python3.6/site-packages/pip/_internal/download.py", line 837, in unpack_url
      progress_bar=progress_bar
    File "/venv/lib/python3.6/site-packages/pip/_internal/download.py", line 674, in unpack_http_url
      progress_bar)
    File "/venv/lib/python3.6/site-packages/pip/_internal/download.py", line 869, in _download_http_url
      stream=True,
    File "/venv/lib/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 521, in get
      return self.request('GET', url, **kwargs)
    File "/venv/lib/python3.6/site-packages/pip/_internal/download.py", line 397, in request
      return super(PipSession, self).request(method, url, *args, **kwargs)
    File "/venv/lib/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 508, in request
      resp = self.send(prep, **send_kwargs)
    File "/venv/lib/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 625, in send
      r = dispatch_hook('response', hooks, r, **kwargs)
    File "/venv/lib/python3.6/site-packages/pip/_vendor/requests/hooks.py", line 31, in dispatch_hook
      _hook_data = hook(hook_data, **kwargs)
    File "/venv/lib/python3.6/site-packages/pip/_internal/download.py", line 189, in handle_401
      username = six.moves.input("User for %s: " % parsed.netloc)
  EOFError: EOF when reading a line

-------------------------------------------
Command "/venv/bin/python -m pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-me9p5l31 <full URL to setuptools on my private index> <full URL to wheel on my private index>" failed with error code 2 in None

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
zwarecommented, Apr 18, 2018

Since it may be helpful to others encountering this: I’ve successfully worked around the issue by adding the credentials to ~/.netrc and leaving the user:pass out of the index URL.

I can also confirm what @lopter said about pip <= 9.0.3 not being affected.

Edit: Left out an all-important =; pip == 9.0.3 is not affected, only 10.0.0.

2reactions
mgucommented, Apr 18, 2018

same for me, the basic auth in the index URL is not used when downloading the packages

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is pip installing an incompatible package version?
Pip does not have a dependency resolver. If you tell it to install package foo without any qualifications, you're getting the newest version ......
Read more >
pip download - pip documentation v22.3.1
Disable isolation when building a modern source distribution. Build dependencies specified by PEP 518 must be already installed if this option is used....
Read more >
pipenv Documentation - Read the Docs
Enables truly deterministic builds, while easily specifying only what you want. • Generates and checks file hashes for locked dependencies when installing from ......
Read more >
User Guide - pip documentation v21.1.dev0
Certain special characters are not valid in the authentication part of URLs. ... To build wheels for your requirements and all their dependencies...
Read more >
PIP Install Git - A quick read - ActiveState
Use Python 3.9 by ActiveState and build your own runtime with the packages and dependencies you need. Get started for free by creating...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found