After installing anaconda3, I began to install pyside2.
I directly typed pip install pyside2
, and successfully installed pyside2 5.15. But when I ran the toy
I had a similar issue, though I was not using anaconda. The error appears to be a krb5 version mismatch between PySide2 and Ubuntu packages. I was able to resolve the issue by compiling krb5 from source and adding the lib directory to LD_LIBRARY_PATH.
tar xf krb5-1.18.2.tar.gz
cd krb5-1.18.2/src
./configure --prefix=/opt/krb5/
make && make install
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/krb5/lib
python -c "import PySide2.QtCore"
The python import no longer raised an error. I found this worked with several different krb5 versions from the offical website; the error seems to be in the Ubuntu modifcations to the package.
You may have success with uninstalling and reinstalling the Python Qt bindings, as suggested by the other answers, but this did not work for me.
You are getting the error because you have a wrong version of qt on your machine. I mean it seems anaconda installs the wrong version of QT by default. First, you need to install essential packages (enter link description here) and then do the following steps:
pip uninstall pyside2, qt, pyqt5
if you have installed them with pip
conda remove pyside2, qt, pyqt5
if you have installed them with conda
conda install -c conda-forge pyside2
I am sorry, your answer above seems correct except for the presence of opencv, which is not in the original question. Opencv in my opinion has nothing to do with pyside2 or the question. So, the correct procedure in my opinion would be:
1. pip uninstall pyside2, qt, pyqt5 if you have installed them with pip
2. conda remove pyside2, qt, pyqt5 if you have installed them with conda
3. conda install -c conda-forge pyside2