简体   繁体   English

Spyder(已安装 pip)不再以错误启动:未定义符号:_ZdaPvm,版本 QT_5

[英]Spyder (pip installed) doesn't start anymore with the error: undefined symbol: _ZdaPvm, version QT_5

On Ubuntu 22.04 (5.15.0-43-generic) I freshly updated spyder using pip as follow:在 Ubuntu 22.04(5.15.0-43-generic)上,我使用pip全新更新了spyder ,如下所示:

$ sudo -H pip3 install --upgrade spyder

everything went fine, but it throws this error when I start spyder now:一切都很好,但是当我现在启动 spyder 时它会抛出这个错误:

$ spyder 
Traceback (most recent call last):
  File "/usr/local/bin/spyder", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/dist-packages/spyder/app/start.py", line 248, in main
    from spyder.app import mainwindow
  File "/usr/local/lib/python3.10/dist-packages/spyder/app/mainwindow.py", line 57, in <module>
    from qtpy import QtWebEngineWidgets  # analysis:ignore
  File "/usr/local/lib/python3.10/dist-packages/qtpy/QtWebEngineWidgets.py", line 29, in <module>
    from PyQt5.QtWebEngineWidgets import QWebEnginePage
ImportError: /usr/local/lib/python3.10/dist-packages/PyQt5/Qt5/lib/libQt5Network.so.5: undefined symbol: _ZdaPvm, version Qt_5

Some more info:更多信息:

$ python3 --version
Python 3.10.4
$ pip list | grep -i pyqt
PyQt5                         5.15.6
PyQt5-Qt5                     5.15.2
PyQt5-sip                     12.11.0
PyQtWebEngine                 5.15.5
PyQtWebEngine-Qt5             5.15.2
$ pip list | grep -i spyder
pyls-spyder                   0.4.0
spyder                        5.3.2
spyder-kernels                2.3.2

And I'm not able to uninstall PyQt5:而且我无法卸载 PyQt5:

$ sudo -H pip uninstall pyqt5
Found existing installation: PyQt5 5.15.6
ERROR: Cannot uninstall PyQt5 5.15.6, RECORD file not found. Hint: The package was installed by sip-build.

The last line being printed in red in the terminal.最后一行在终端中以红色打印。

From that point, I'm not able to find relevant information on how to debug this in order to make spyder work again.从那时起,我无法找到有关如何调试它以使 spyder 再次工作的相关信息。

What could I do to fix this error?我能做些什么来解决这个错误?

Have you looked at this ?你看过这个吗? This is exactly why you shouldn't use sudo pip install .这正是您不应该使用sudo pip install的原因。 Library versions get borked, inconsistencies arise, and stuff doesn't work.库版本变得乏味,出现不一致,并且东西不起作用。

Use sudo pip (for the last time) to uninstall Spyder and PyQT5, then reinstall the relevant packages using apt .使用sudo pip (最后一次)卸载 Spyder 和 PyQT5,然后使用apt重新安装相关包。 Finally, upgrade Spyder using pip install --user ( no sudo ! ).最后,使用pip install --user ( no sudo ! ) 升级 Spyder。 Everything should work okay after that.之后一切都应该正常工作。

Okay, this fixed it for me:好的,这为我解决了:

$ sudo -H pip3 install --force-reinstall spyder

it will probably throw some errors such as:它可能会抛出一些错误,例如:

  Attempting uninstall: PyQtWebEngine
    Found existing installation: PyQtWebEngine 5.15.5
ERROR: Cannot uninstall PyQtWebEngine 5.15.5, RECORD file not found. Hint: The package was installed by sip-build.

which, if you try to update it individually will show:如果您尝试单独更新它,则会显示:

$ sudo -H pip3 install -U PyQtWebEngine
Requirement already satisfied: PyQtWebEngine in /usr/lib/python3/dist-packages (5.15.5)
Collecting PyQtWebEngine
  Using cached PyQtWebEngine-5.15.6-cp37-abi3-manylinux1_x86_64.whl (230 kB)
Requirement already satisfied: PyQt5>=5.15.4 in /usr/local/lib/python3.10/dist-packages (from PyQtWebEngine) (5.15.7)
Requirement already satisfied: PyQtWebEngine-Qt5>=5.15.0 in /usr/local/lib/python3.10/dist-packages (from PyQtWebEngine) (5.15.2)
Requirement already satisfied: PyQt5-sip<13,>=12.11 in /usr/local/lib/python3.10/dist-packages (from PyQtWebEngine) (12.11.0)
Requirement already satisfied: PyQt5-Qt5>=5.15.0 in /usr/local/lib/python3.10/dist-packages (from PyQt5>=5.15.4->PyQtWebEngine) (5.15.2)
Installing collected packages: PyQtWebEngine
  Attempting uninstall: PyQtWebEngine
    Found existing installation: PyQtWebEngine 5.15.5
ERROR: Cannot uninstall PyQtWebEngine 5.15.5, RECORD file not found. Hint: The package was installed by sip-build.

Therefore, in that case, run the installation using the --ignore-installed flag on the incriminated package, which should install it without any trouble:因此,在这种情况下,使用--ignore-installed标志在有罪的 package 上运行安装,它应该可以毫无问题地安装它:

$ sudo -H pip3 install --ignore-installed PyQtWebEngine
Collecting PyQtWebEngine
  Using cached PyQtWebEngine-5.15.6-cp37-abi3-manylinux1_x86_64.whl (230 kB)
Collecting PyQtWebEngine-Qt5>=5.15.0
  Using cached PyQtWebEngine_Qt5-5.15.2-py3-none-manylinux2014_x86_64.whl (67.5 MB)
Collecting PyQt5>=5.15.4
  Using cached PyQt5-5.15.7-cp37-abi3-manylinux1_x86_64.whl (8.4 MB)
Collecting PyQt5-sip<13,>=12.11
  Using cached PyQt5_sip-12.11.0-cp310-cp310-manylinux1_x86_64.whl (359 kB)
Collecting PyQt5-Qt5>=5.15.0
  Using cached PyQt5_Qt5-5.15.2-py3-none-manylinux2014_x86_64.whl (59.9 MB)
Installing collected packages: PyQtWebEngine-Qt5, PyQt5-Qt5, PyQt5-sip, PyQt5, PyQtWebEngine
Successfully installed PyQt5-5.15.7 PyQt5-Qt5-5.15.2 PyQt5-sip-12.11.0 PyQtWebEngine-5.15.6 PyQtWebEngine-Qt5-5.15.2

After what the above-mentioned error will never show up again.之后上述错误将永远不会再出现。 Here as an example:这里作为一个例子:

$ sudo -H pip3 install -U PyQtWebEngine
Requirement already satisfied: PyQtWebEngine in /usr/local/lib/python3.10/dist-packages (5.15.6)
Requirement already satisfied: PyQtWebEngine-Qt5>=5.15.0 in /usr/local/lib/python3.10/dist-packages (from PyQtWebEngine) (5.15.2)
Requirement already satisfied: PyQt5-sip<13,>=12.11 in /usr/local/lib/python3.10/dist-packages (from PyQtWebEngine) (12.11.0)
Requirement already satisfied: PyQt5>=5.15.4 in /usr/local/lib/python3.10/dist-packages (from PyQtWebEngine) (5.15.7)
Requirement already satisfied: PyQt5-Qt5>=5.15.0 in /usr/local/lib/python3.10/dist-packages (from PyQt5>=5.15.4->PyQtWebEngine) (5.15.2)

Repeat the same procedure for all offending packages.对所有有问题的包裹重复相同的程序。

Finally update spyder:最后更新spyder:

$ sudo -H pip3 install --force-reinstall spyder

And voila.瞧。 A working spyder should be available.应该有一个可以工作的 spyder。

As an aside: please note the -H option after sudo .顺便说一句:请注意sudo之后的-H选项。 This install packages under /usr/local/lib/python3.xx/dist-packages which will normally not conflict with apt system wide installed packages (which are under /usr/lib/python3/dist-packages ) and which you definitely don't want to touch another what than with apt actually!此安装包位于/usr/local/lib/python3.xx/dist-packages下,通常不会与apt系统范围内安装的包(位于/usr/lib/python3/dist-packages下)冲突,而且您绝对不会实际上,除了apt之外,我不想触及其他东西!
I'm using this to avoid installing the same packages on a user-basis by invoking pip without sudo , which will install them under ~/.local/lib/python3.10/site-packages/ for every user on the machine.我使用它来避免在用户基础上安装相同的软件包,方法是调用pip而不使用sudo ,这将为机器上的每个用户安装它们在~/.local/lib/python3.10/site-packages/下。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM