Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specifying multiple trusted hosts in pip.conf

This is what I tried setting in my /etc/pip.conf:

[global]
trusted-host = pypi.org, files.pythonhosted.org

However, it is not working properly.

References:

  • https://pip.pypa.io/en/stable/reference/pip_config

  • https://pip.pypa.io/en/stable/reference/pip/#cmdoption-trusted-host

See also: pip.conf not paying attention to trusted-host

like image 282
oxr463 Avatar asked Dec 11 '19 14:12

oxr463


Video Answer


2 Answers

This worked for me using the command line, Python 3.9.1, pip 20.2.3, & a virtual environment. No equals sign after "global.trusted-host".

pip config set global.trusted-host "pypi.org files.pythonhosted.org pypi.python.org"

Motivation: I don't want to disconnect from a VPN or specify --trusted-host each time I install a package.

pip config list

Produces the following:

global.trusted-host='pypi.org files.pythonhosted.org pypi.python.org'

DID NOT work:

pip config set global.trusted-host="pypi.org files.pythonhosted.org pypi.python.org"

ERROR: Got unexpected number of arguments, expected 2. (example: "pip config set [name] [value]")
like image 128
Jason Cook Avatar answered Nov 02 '22 22:11

Jason Cook


To do from the command line python -m pip config set global.trusted-host=pypi.org files.pythonhosted.org

like image 41
Dave Edwards Avatar answered Nov 02 '22 22:11

Dave Edwards