On Ubuntu 22.04 (5.15.0-43-generic) I freshly updated spyder using pip
as follow:
$ sudo -H pip3 install --upgrade spyder
everything went fine, but it throws this error when I start spyder now:
$ 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:
$ 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.
What could I do to fix this error?
2
Answers
Okay, this fixed it for me:
it will probably throw some errors such as:
which, if you try to update it individually will show:
Therefore, in that case, run the installation using the
--ignore-installed
flag on the incriminated package, which should install it without any trouble:After what the above-mentioned error will never show up again. Here as an example:
Repeat the same procedure for all offending packages.
Finally update spyder:
And voila. A working spyder should be available.
As an aside: please note the
-H
option aftersudo
. This install packages under/usr/local/lib/python3.xx/dist-packages
which will normally not conflict withapt
system wide installed packages (which are under/usr/lib/python3/dist-packages
) and which you definitely don't want to touch another what than withapt
actually!I'm using this to avoid installing the same packages on a user-basis by invoking
pip
withoutsudo
, which will install them under~/.local/lib/python3.10/site-packages/
for every user on the machine.Have you looked at this? This is exactly why you shouldn’t use
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 usingapt
. Finally, upgrade Spyder usingpip install --user
(nosudo
!). Everything should work okay after that.