Quantcast
Channel: Active questions tagged config - Stack Overflow
Viewing all articles
Browse latest Browse all 5054

Pip config settings not working for virtual environment

$
0
0

Studying https://pip.pypa.io/en/stable/topics/configuration/ I understand that I can have multiple pip.conf files (on a UNIX-based system) which are loaded in the described order.

My task is to write a bash script that automatically creates a virtual environment and sets pip configuration only for the virtual environment.

# my_bash_script.sh...python -m virtualenv .myvenv....touch pip.conf# this will create path/to/.myvenv/pip.conf# otherwise following commands will be in the user's pip.conf at ~/.config/pip/pip.confpath/to/.myvenv/bin/python -m pip config set global.proxy "my-company-proxy.com"# setting our company proxy herepath/to/.myvenv/bin/python -m pip config set global.trusted-host "pypi.org pypi.python.org files.pythonhosted.org" # because of SSL issues from behind the company's firewall I need this to make pip work...

My problem is, that I want to set the configuration not for global but for site. If I exchange global.proxy and global.trusted-host for site.proxy and site.trusted-host pip won't be able to install packages anymore whereas everything works fine if I leave it at global. Also changing it to install.proxy and install.trusted-host doesn't work.

The pip.conf file looks like this afterwards:

# /path/to/.myvenv/pip.conf[global]proxy = "my-company-proxy.com"trusted-host = "pypi.org pypi.python.org files.pythonhosted.org"

pip config debug yields the following:

env_var:env:global:  /etc/xdg/pip/pip.conf, exists: False  /etc/pip.conf, exists: Falsesite:  /path/to/.myvenv/pip.conf, exists: True    global.proxy: my-company-proxy.com    global.trusted-host: pypi.org pypi.python.org files.pythonhosted.orguser:  /path/to/myuser/.pip/pip.conf, exists: False  /path/to/myuser/.config/pip/pip.conf, exists: True

What am I missing here?Thank you in advance for your help!


Viewing all articles
Browse latest Browse all 5054

Trending Articles