pip
pip copied to clipboard
`pip config set` causes error when PIP_CONFIG_FILE="/dev/null"
Description
Run:
export PIP_CONFIG_FILE="/dev/null"
pip config set global.foo bar
Causes error:
ERROR: Fatal Internal error [id=2]. Please report as a bug.
Expected behavior
Should give a more meaningful error message such as "Cannot set configuration variables when PIP_CONFIG_FILE="/dev/null"
.
pip version
23.0.1
Python version
3.9.2
OS
MacOS
How to Reproduce
export PIP_CONFIG_FILE="/dev/null"
pip config set global.foo bar
Output
ERROR: Fatal Internal error [id=2]. Please report as a bug.
Code of Conduct
- [X] I agree to follow the PSF Code of Conduct.
@Toldry, are you working on this? Can I pick this up?
@murluki I'm not working on this, I just reported it
I get the same with any value for PIP_CONFIG_FILE. Does this feature just not work at all? pip 24, python 3.11.4 on MacOS (or within a container running the official Python 3.11 Docker image)
PIP_CONFIG_FILE=pip.conf pip3 config set global.extra-index-url test
ERROR: Fatal Internal error [id=2]. Please report as a bug.
PIP_CONFIG_FILE=pip.conf pip3 config set global.extra-index-url test
That doesn't look like a real file path, there should probably be a better error, but it looks like you're supplying invalid data.
That doesn't look like a real file path
In what way does it not look like a real file path?
Do you prefer this?
➜ PIP_CONFIG_FILE=/Users/username/pip.conf pip config set global.extra-index-url test
ERROR: Fatal Internal error [id=2]. Please report as a bug.
From your orriginal message I thought you were saying the value of PIP_CONFIG_FILE
is pip.conf pip3 config set global.extra-index-url test
. Now I understand that was your entire shell command.
I'm able to produce the same error my pointing PIP_CONFIG_FILE
to an empty pip.conf
, this seems to be the same error as described here: https://github.com/pypa/pip/issues/11700#issuecomment-1569149237
Workaround appears to be use PIP_CONFIG
.
PIP_CONFIG
is just completely ignored by pip. I can't find any reference to it in any docs, so I guess pip isn't looking for it at all. May as well be setting the env var FOO_BAR
. I believe that comment is mistaken.
➜ cat pip.conf
~ using ☁️ bastion-sso via 🐍 system
➜ PIP_CONFIG=pip.conf pip config set global.extra-index-url test
Writing to /Users/username/.config/pip/pip.conf
~ using ☁️ bastion-sso via 🐍 system
➜ cat pip.conf
~ using ☁️ bastion-sso via 🐍 system
➜ cat ~/.config/pip/pip.conf
[global]
extra-index-url = test
Oh yeah, you're right, I misread the output.
I've just run into this as well:
$ PIP_CONFIG_FILE=~/.pip/pip.conf pip config --user set global.keyring-provider subprocess
ERROR: Fatal Internal error [id=2]. Please report as a bug.
$ cat ~/.pip/pip.conf
[global]
index-url = http://localhost:8080/root/pypi/+simple/
$ ls -l ~/.pip/pip.conf
-rw-r--r-- 1 kenneth kenneth 63 Apr 18 21:05 /home/kenneth/.pip/pip.conf
strace
looks like it is failing @ write
:
geteuid() = 1000
access("/home/kenneth/.cache/pip", W_OK) = 0
newfstatat(AT_FDCWD, "/home/kenneth/.pip/pip.conf", {st_mode=S_IFREG|0644, st_size=63, ...}, 0) = 0
getpid() = 1274847
ioctl(2, TCGETS, {c_iflag=ICRNL|IXON|IUTF8, c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|OPOST|ONLCR, c_cflag=B38400|CS8|CREAD, c_lflag=ISIG|ICANON|ECHO|ECHOE|ECHOK|IEXTEN|ECHOCTL|ECHOKE, ...}) = 0
ioctl(0, TIOCGWINSZ, {ws_row=51, ws_col=211, ws_xpixel=0, ws_ypixel=0}) = 0
ioctl(2, TCGETS, {c_iflag=ICRNL|IXON|IUTF8, c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|OPOST|ONLCR, c_cflag=B38400|CS8|CREAD, c_lflag=ISIG|ICANON|ECHO|ECHOE|ECHOK|IEXTEN|ECHOCTL|ECHOKE, ...}) = 0
ioctl(0, TIOCGWINSZ, {ws_row=51, ws_col=211, ws_xpixel=0, ws_ypixel=0}) = 0
ioctl(2, TCGETS, {c_iflag=ICRNL|IXON|IUTF8, c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|OPOST|ONLCR, c_cflag=B38400|CS8|CREAD, c_lflag=ISIG|ICANON|ECHO|ECHOE|ECHOK|IEXTEN|ECHOCTL|ECHOKE, ...}) = 0
ioctl(0, TIOCGWINSZ, {ws_row=51, ws_col=211, ws_xpixel=0, ws_ypixel=0}) = 0
ioctl(2, TCGETS, {c_iflag=ICRNL|IXON|IUTF8, c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|OPOST|ONLCR, c_cflag=B38400|CS8|CREAD, c_lflag=ISIG|ICANON|ECHO|ECHOE|ECHOK|IEXTEN|ECHOCTL|ECHOKE, ...}) = 0
ioctl(2, TCGETS, {c_iflag=ICRNL|IXON|IUTF8, c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|OPOST|ONLCR, c_cflag=B38400|CS8|CREAD, c_lflag=ISIG|ICANON|ECHO|ECHOE|ECHOK|IEXTEN|ECHOCTL|ECHOKE, ...}) = 0
write(2, "\33[31mERROR: Fatal Internal error"..., 78ERROR: Fatal Internal error [id=2]. Please report as a bug.
) = 78
rt_sigaction(SIGINT, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER|SA_ONSTACK, sa_restorer=0x7fb29201a050}, {sa_handler=0x678c70, sa_mask=[], sa_flags=SA_RESTORER|SA_ONSTACK, sa_restorer=0x7fb29201a050}, 8) = 0