bosco-
bosco-

Reputation: 1823

pip, how to remove dead index base url

When i try to install a package using pip it first tries to fetch from a url which no longer exists which leads to the following error

Cannot fetch index base URL http://xyz.xxx:8080/simple/

but it goes on to download and install the package from pypi.I want to get rid of this index base url, i don't want to see this message every time.I don't remember how i added this url but it was a valid private package index at some point.I've already gotten rid of the url from the /etc/hosts file but pip still tries to fetch packages from that location.

Upvotes: 13

Views: 25019

Answers (3)

Classicus
Classicus

Reputation: 58

Had the same issue, solved it by using unset with sudo.

So in your example, if you run pip config show, you should see:

global.extra-index-url=http://xyz.xxx:8080/simple/

You can then remove it with:

sudo pip config --global unset global.extra-index-url

You can check pip config show again to ensure it's gone.

Upvotes: 4

Yousef Azizi
Yousef Azizi

Reputation: 159

I had this issue for a long time and I solved finally using this metheod There is a manual way to do this. First use

pip config list

This will show a list of configuration in pip.ini, specially 'global.extra-index-url'. If you see the url as value for this cofig, you can "unset" it using:

pip config unset global.extra-index-url

when you run this, a message will be shown in terminal: "Writing to ...\pip\pip.ini" I suggest that also unset global.trusted_host related to this setting to be sure about other side-effects.

Upvotes: 14

alecxe
alecxe

Reputation: 474003

It looks like there is a pip configuration file where you've added the URL. Quote from docs:

The names and locations of the configuration files vary slightly across platforms.

On Unix and Mac OS X the configuration file is: $HOME/.pip/pip.conf

On Windows, the configuration file is: %HOME%\pip\pip.ini

Upvotes: 8

Related Questions