I have set up a private pypi package index in gitlab.
In my ~/.config/pip/pip.conf
I setup an extra-index-url
# pip.conf
[global]
extra-index-url=https://gitlab.example.com/api/v4/groups/60/-/packages/pypi/simple
Next I setup a ~/.netrc
# .netrc
machine gitlab.example.com
login my_username
The password has been saved in keyring
When I install a package in my system python like
$ pip install my-package
everything works as expected (no interaction, neither asking for user, nor for a password).
But if I activate a virtual environment
(venv)$ pip install my-package
I get asked for user and password of the gitlab instance.
Does someone know, how to fix this?
Thanks in advance!
EDIT:
(.venv) <user>@laptop:~/test$ pip config list -v
For variant 'global', will try loading '/home/<user>/.config/kdedefaults/pip/pip.conf'
For variant 'global', will try loading '/etc/xdg/xdg-plasma/pip/pip.conf'
For variant 'global', will try loading '/etc/xdg/pip/pip.conf'
For variant 'global', will try loading '/etc/pip.conf'
For variant 'user', will try loading '/home/<user>/.pip/pip.conf'
For variant 'user', will try loading '/home/<user>/.config/pip/pip.conf'
For variant 'site', will try loading '/home/<user>/test/.venv/pip.conf'
global.extra-index-url='https://gitlab.example.com/api/v4/groups/60/-/packages/pypi/simple'
and without venv
<user>@laptop:~/test$ pip config list -v
For variant 'global', will try loading '/home/<user>/.config/kdedefaults/pip/pip.conf'
For variant 'global', will try loading '/etc/xdg/xdg-plasma/pip/pip.conf'
For variant 'global', will try loading '/etc/xdg/pip/pip.conf'
For variant 'global', will try loading '/etc/pip.conf'
For variant 'user', will try loading '/home/<user>/.pip/pip.conf'
For variant 'user', will try loading '/home/<user>/.config/pip/pip.conf'
For variant 'site', will try loading '/usr/pip.conf'
global.extra-index-url='https://gitlab.example.com/api/v4/groups/60/-/packages/pypi/simple'