Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pip.conf not paying attention to trusted-host

Tags:

I have my pip.conf file as follows:

[global]
trusted-host = <private IP>
extra-index-url = http://<private IP>/pypi

However, whenever I try to install a package (just a test package) from the private pypi repo, I receive an error that instructs me to add --trusted-host <private IP>. If I do, I can successfully install the package, so I know that pip is reading the pip.conf file. Why isn't it respecting the trusted-host config? I've triple checked that the IPs match in the config file.

Several blogs and cursory searches of Google seem to suggest that it should. (https://pseudoscripter.wordpress.com/2016/05/07/pip-the-repository-located-at-some-ip-is-not-a-trusted-or-secure-host-and-is-being-ignored/)

like image 542
celestialorb Avatar asked Jul 26 '17 20:07

celestialorb


People also ask

Where is Pip conf in VENV?

Inside a virtualenv: On Unix and macOS the file is $VIRTUAL_ENV/pip. conf. On Windows the file is: %VIRTUAL_ENV%\pip.

Does PIP have a config file?

pip has 3 “levels” of configuration files: global : system-wide configuration file, shared across users. user : per-user configuration file. site : per-environment configuration file; i.e. per-virtualenv.

Where is Pip config?

On Unix the file may be located in /etc/pip. conf. Alternatively it may be in a "pip" subdirectory of any of the paths set in the environment variable XDG_CONFIG_DIRS (if it exists), for example /etc/xdg/pip/pip. conf.


1 Answers

Couldn't this be a problem of different pip.conf having different configurations?According to the official docs:

The names and locations of the configuration files vary slightly across platforms. You may have per-user, per-virtualenv or site-wide (shared amongst all users) configuration.

  • On Unix the default configuration file is: $HOME/.config/pip/pip.conf which respects the XDG_CONFIG_HOME environment variable.
  • There is also a legacy per-user configuration file which is also respected, and is located at $HOME/.pip/pip.conf on Unix and macOS.
  • Inside a virtualenv, on Unix and macOS the file is $VIRTUAL_ENV/pip.conf
  • Site-wide, on Unix the file may be located in /etc/pip.conf. Alternatively it may be in a "pip" subdirectory of any of the paths set in the environment variable XDG_CONFIG_DIRS (if it exists), for example /etc/xdg/pip/pip.conf.
like image 152
gmauch Avatar answered Sep 23 '22 04:09

gmauch