Change the index-url in pip.conf

You may run into the situation that you can’t install libraries for Python on your local computer.

python3 -m pip installpython-dotenv 

You will get a warning like this:

WARNING: 401 Error, Credentials not correct for https://eu.artifactory.yourgroup.com/artifactory/api/pypi/your-team/simple/
Read more: Change the index-url in pip.conf

To solve this, you first list all the pip configurations.

pip config -v list

In the list, you see all your relevant locations.

For variant 'global', will try loading '/Library/Application Support/pip/pip.conf'
For variant 'user', will try loading '/Users/thomassuedbroecker/.pip/pip.conf'
For variant 'user', will try loading '/Users/thomassuedbroecker/.config/pip/pip.conf'
For variant 'site', will try loading '/Users/thomassuedbroecker/.pyenv/versions/3.9.16/pip.conf'
global.index-url='https://eu.artifactory.yourgroup.com/artifactory/api/pypi/your-team/simple/'

Open the file and verify the configuration

nano /Users/thomassuedbroecker/.pip/pip.conf

For example, if you only have one entry, the global configuration to https://pypi.org/simple is provided by Python or just correct the credentials ;-).

[global]
#index-url=https://user:password@eu.artifactory.yourgroup.com/artifactory/api/pypi/your-team/simple/
index-url=https://pypi.org/simple

I hope this was useful to you, and let’s see what’s next?

Greetings,

Thomas

#python, #pip, #indexurl, cheatsheet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Blog at WordPress.com.

Up ↑

%d bloggers like this: