'pip is not using extra index url defined in pip.conf

I am using MacOS, and I created a pip.conf in ~/.pip. There is only one extral-index-url in this file, which looks like:

[global]
extra-index-url=https://[username]:[password]@artifactory

After that I tried to run pip config list, and I can see global.extra-index-url=https://[username]:[password]@artifactory in the terminal

However, when I try to use pip to install a package, it still doesn't check this URL. I can install the package by using pip install <package> --extra-index-url https://[username]:[password]@artifactory, but just curious why my pip.conf is not being used.

BTW I am using a virtual env when I run pip. I did copy pip.conf to the virtualenv folder, but it doesn't work either.



Solution 1:[1]

@hoefling's comment on the question is the answer I needed. According to the docs, if a directory

$HOME/Library/Application Support/pip/

exists, that will shadow any

$HOME/.config/pip/pip.conf

file. If that exists, it will shadow any

$HOME/.pip/pip.conf

file. So investigate those locations in order, perhaps one of them is getting in the way.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ken Williams