pip install and custom index url

假如想象 提交于 2020-01-02 03:47:05

问题


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?


回答1:


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




回答2:


This is what worked for me:

  1. unset all_proxy (optional in case none are set)
  2. pip install 'requests[socks]' inside the venv



回答3:


I bumped into this problem because https://pypi.org/ doesn't work over my current internet connection. Going through a VPN solved it for me.



来源:https://stackoverflow.com/questions/31559638/pip-install-and-custom-index-url

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!