为什么 pip3 在 Ubuntu 20.04 上安装/更新软件包后要创建 kdewallet?

问题描述 投票:0回答:3

我最近将系统从 Ubuntu 18.04 更新到 20.04。之后,我尝试使用here提到的 shell 命令更新所有 pip3 软件包(我将“pip”更改为“pip3”)。

更新了几个包后,出现了这个提示: KDE 钱包服务

由于我在更新/安装软件包时从未见过它,所以我取消了它,这导致立即重新打开相同的提示,并且终端显示以下警告:

WARNING: Keyring is skipped due to an exception: Failed to unlock the keyring!

在尝试安装的下一个软件包发生同样的情况后,我按了 CTRL+C。从那时起,当我尝试安装软件包时,就会发生同样的事情。

示例:

pip3 install numpy
WARNING: Keyring is skipped due to an exception: Failed to unlock the keyring!
WARNING: Keyring is skipped due to an exception: Failed to unlock the keyring!
Collecting numpy
  WARNING: Keyring is skipped due to an exception: Failed to unlock the keyring!
  Using cached numpy-1.19.2-cp38-cp38-manylinux2010_x86_64.whl (14.5 MB)
Installing collected packages: numpy
  WARNING: The scripts f2py, f2py3 and f2py3.8 are installed in '/home/gesuchter/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed numpy-1.19.2

我已经尝试通过重新安装 python3-pip 来解决我的问题。

希望以下是一些有用的信息:

pip3 --version
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)

ls ~/.local/share/keyrings
default  login.keyring  user.keystore

find ~/.config/kwalletrc
find: ‘/home/gesuchter/.config/kwalletrc’: No such file or directory
python-3.x pip sudo kde-plasma ubuntu-20.04
3个回答
55
投票

这为我解决了这个问题:

python3 -m keyring --disable

运行它会添加:

[backend]
default-keyring=keyring.backends.null.Keyring

到文件

~/.config/python_keyring/keyringrc.cfg

大概在

https://stackoverflow.com/a/68504137/895245
提到的PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring 提供了一种环境变量方法来实现相同的结果。

如果没有这个,每次我尝试安装软件包时,它都会显示恼人的 KDE 密钥环弹出窗口:

enter image description here

谷歌,索引此:

KDE 钱包系统

应用程序

'/usr/lib/python3/dist-packages/pip/__main__.py'
已请求创建一个名为“kdewallet”的新钱包。这用于以安全的方式存储敏感数据。请在下面选择新钱包的类型或单击“取消”以拒绝应用程序的请求。

  • 经典的河豚加密文件
  • 使用GPG加密,更好的保护

相关:https://askubuntu.com/questions/1205161/annoying-kde-wallet-service-popup-the-application-kded5-has-requested-to-open

TODO:Poetry 1.8.2 中的

poetry install
仍然多次打开弹出窗口。怎么解决这个问题?

在 Ubuntu 21.04、Python 3.9.5、pip3 20.3.4、keyring==22.2.0 上测试。


8
投票

此问题已在上游报告,请参阅 https://github.com/pypa/pip/issues/8090 以及该线程链接的其他问题。

tl;dr: 新版本的 pip 过于急切地在密钥环中搜索访问某些软件包下载可能需要的凭据。如果它最终查询尚不存在的密钥环(例如 kdewallet),则会出现您注意到的提示。目前尚不清楚这个问题将如何以及在哪个版本中得到完全修复。

编辑: 请注意,stackoverflow 不是错误报告的正确位置:pip 维护者不太可能看到这一点,而且据我所知,它也不在 stackoverflow 的范围内。这可能是另一个 stackexchange 社区(也许是超级用户?)的问题。但由于您已经确定这是 pip 的问题,因此报告的最佳位置是 https://github.com/pypa/pip

上的自述文件中指示的任何沟通渠道

4
投票

您可以将其添加到您的启动文件中

export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring

归功于

jrd
对 python bug 的评论

© www.soinside.com 2019 - 2024. All rights reserved.