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

40
我最近将系统从Ubuntu 18.04更新到20.04。之后,我尝试使用此处提到的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

1
这个问题已经在下面的回答中提到的问题中得到了修复。运行pip install --upgrade pip即可解决该问题。 - Paul Rougieux
@PaulRougieux,我今天使用的pip版本是22.3.1,遇到了这个问题。 - msoutopico
3个回答

48

这对我解决了问题:

python3 -m keyring --disable

运行它会添加:

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

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

据推测在https://dev59.com/SVIG5IYBdhLWcg3wiAtO#68504137提到的 PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring 提供了一种使用环境变量的方式来实现相同的结果。

没有这个,每次我尝试安装软件包时都会显示令人讨厌的KDE密钥环弹窗:

enter image description here

Google,把这个索引:

KDE钱包系统

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

  • 传统的,Blowfish加密文件
  • 使用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。


8

这个问题已经向上游报告,在https://github.com/pypa/pip/issues/8090和相关线程中的其他问题中可以查看。

简述:新版pip过于热心地搜索密钥环以获取访问某些软件包下载所需的凭据。如果它最终查询的密钥环(例如kdewallet)尚不存在,则会出现您注意到的提示。目前还不清楚在哪个版本中将完全修复此问题。

编辑:请注意,stackoverflow不是报告错误的正确位置:pip维护人员不太可能看到这个问题,而且据我所知,它也不真正适用于stackoverflow。这可能是另一个stackexchange社区(例如superuser)的问题。但由于您已经确定这是pip的问题,因此报告的最佳位置将是README中在https://github.com/pypa/pip上指示的任何通信渠道。


3
PIp最近一团糟。在这个和pip警告之间,这是一个动荡的时期。 - Jonathan

1
你可以将这个添加到你的启动文件中。
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring

致谢jrd在Python漏洞上的评论

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接