Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pip install and custom index url

Tags:

python

pip

pypi

I am getting the following exception while trying to install using pip:

Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', error(111, 'Connection refused'))': /simple/<package>/

Where does pip install the packages from?

How do I proxy or use alternate internal site to get these packages?

like image 955
Amod Pandey Avatar asked Jul 22 '15 09:07

Amod Pandey


1 Answers

pip install looks at http://pypi.python.org/simple/<package>/

You might see the following error in case the connection to pypi.python.org is not open to access (e.g. because of your firewall rules).

Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', error(111, 'Connection refused'))': /simple/<package>/

The -v option (enabling debug logging/verbose mode is a nice way to start debugging).

Often companies create a proxy to http://pypi.python.org/simple so all the internal sites can access it when they are not exposed to internet.

We can configure this url in pip.conf. By default pip looks into $HOME/.pip/pip.conf for configuration data.

[global]
extra-index-url = https://my-pypi.mywebsite.com/simple
timeout = 10

If you have set the conf and yet if the pip conf is not being picked check that pip.conf is in the right home directory for the user.

e.g. /root, / or /home/user

like image 66
Amod Pandey Avatar answered Oct 13 '22 18:10

Amod Pandey