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.

Using multiple PIP indexes on the same hostname with different credentials does not work

See original GitHub issue

Description

I have a need to simultaneously access two PIP indexes from the same hostname (pkgs.dev.azure.com) but using different credentials.

When configuring it like this:

PIP_INDEX_URL=https://build:password1@pkgs.dev.azure.com/feed1
PIP_EXTRA_INDEX_URL=https://build:password2@pkgs.dev.azure.com/feed2

pip seems to try credentials for feed2 for both feed1 and feed2 failing my builds.

I’ve worked around this for now by setting the same credentials for both feeds.

Expected behavior

feed1 credentials are used with feed1 and feed2 credentials are used with feed2

pip version

21.1.3

Python version

3.9

OS

linux

How to Reproduce

  1. Create two Azure feeds in different organizations, for example pkgs.dev.azure.com/org1/_packaging/org-feed/pypi/simple and pkgs.dev.azure.com/org2/_packaging/org-feed/pypi/simple
  2. Upload package1 to feed1, package2 to feed2
  3. Generate different personal access tokens PAT1 and PAT2 for the two feeds
  4. Set environment variables ``IP_INDEX_URL=https://build:PAT1@pkgs.dev.azure.com/org1/_packaging/org-feed/pypi/simple` and PIP_EXTRA_INDEX_URL=https://build:PAT2@pkgs.dev.azure.com/org2/_packaging/org-feed/pypi/simple
  5. Run pip install package1 package2

Output

pip interactively prompts for username breaking the build instead of installing the two packages.

Code of Conduct

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:25 (16 by maintainers)

github_iconTop GitHub Comments

2reactions
pjstevnscommented, Nov 17, 2022

Please to not close this issue.

It affects also users of gitlab where different groups in gitlab have their own package repositories, each using their own credentials.

It used to work, but no longer does (don’t know since what version of pip). It now forces us to use separate requirements files for a single project, since each file basically support one set of credentials.

2reactions
zoobacommented, Feb 16, 2022

I’ve only skimmed the discussion, but probably it should be caching anything feed related against the index URL as provided by the caller rather than just the netloc.

I noted this when implementing the keyring interface, and there’s logic somewhere that keeps track of the original index URL leading to a request for this purpose, but I didn’t have a reason to change the netloc-based caching at the time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using pip with two --extra-index-url arguments that both point ...
When I try to specify both indices at the same time, I get prompted to log in, but if I use only one...
Read more >
User Guide - pip documentation v21.1.dev0
If no credentials are part of the URL, pip will attempt to get authentication credentials for the URL's hostname from the user's .netrc...
Read more >
mongodump — MongoDB Database Tools
mongodump is a utility that creates a binary export of a database's contents. mongodump can export data from: Standalone deployments. Replica sets.
Read more >
ms-active-directory - PyPI
Python library for integrating with Microsoft Active Directory. ... This is useful when you have multiple different hostnames for a single device, ...
Read more >
django-admin and manage.py
It does the same thing as django-admin but also sets the ... Uses the system check framework to inspect the entire Django project...
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