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

Posted

技术标签:

【中文标题】为啥 pip3 在 Ubuntu 20.04 上安装/更新软件包后要创建一个 kdewallet?【英文标题】:Why does pip3 want to create a kdewallet after installing/updating packages on Ubuntu 20.04?为什么 pip3 在 Ubuntu 20.04 上安装/更新软件包后要创建一个 kdewallet? 【发布时间】:2021-02-10 16:20:09 【问题描述】:

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

在它更新了几个包之后,出现了这个提示: KDE Wallet Service

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

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

【问题讨论】:

这已在下面的答案中提到的an issue 中得到修复。 pip install --upgrade pip 解决了这个问题。 【参考方案1】:

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

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

编辑: 请注意,*** 不是错误报告的正确位置:pip 维护人员不太可能看到这一点,而且据我所知,它也不真正在 *** 的范围内。这可能是另一个 stackexchange 社区的问题(也许是超级用户?)。但是由于您已经确定这是 pip 的问题,因此报告的最佳位置是https://github.com/pypa/pip 上的自述文件中指出的任何通信渠道

【讨论】:

PIp 现在一团糟。在这和点子警告之间是一段艰难的时期。【参考方案2】:

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

export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring

感谢jrd's comment on a python bug

【讨论】:

【参考方案3】:

这为我解决了:

python3 -m keyring --disable

运行它会添加:

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

到文件~/.config/python_keyring/keyringrc.cfg

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

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

谷歌,索引这个:

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

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

【讨论】:

以上是关于为啥 pip3 在 Ubuntu 20.04 上安装/更新软件包后要创建一个 kdewallet?的主要内容,如果未能解决你的问题,请参考以下文章

为啥 Spring Batch 在我的 Ubuntu 20.04 机器上的 MySql 上创建小写表?

天翼云主机ubuntu20.04搭建实录

腾讯云Ubuntu20.04配置Jupyter notebook

腾讯云Ubuntu20.04配置Jupyter notebook

腾讯云Ubuntu20.04配置Jupyter notebook

腾讯云Ubuntu20.04配置Jupyter notebook