Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

pyqt5 in virtualenv "Cannot mix incompatible Qt library" error



  • I have to deploy an application based on pyqt5. My setup requires everything to be done inside a python3 virtualenv.

    It is obvious from the logs that I have two versions of pyqt5. One that comes default with my ubuntu-18.04 installation and one that I setup in the virtualenv. And they are picking files from both the versions, which is creating conflicts.

    How do I make my system use only pyqt5 files from the virtualenv and not the system's installation ?

    b-ak@ideapad-330S ~/Coder/venv_0.2.0/lib/python3.6/site-packages/PyQt5/Qt/plugins [009f9b6 *]
    ± % dpkg -al | grep libqt                                                                                                                                                                                      !5014
    ii  libqt5core5a:amd64                    5.9.5+dfsg-0ubuntu1                     amd64        Qt 5 core module
    ii  libqt5dbus5:amd64                     5.9.5+dfsg-0ubuntu1                     amd64        Qt 5 D-Bus module
    ii  libqt5gui5:amd64                      5.9.5+dfsg-0ubuntu1                     amd64        Qt 5 GUI module
    ii  libqt5help5:amd64                     5.9.5-0ubuntu1                          amd64        Qt 5 help module
    ii  libqt5network5:amd64                  5.9.5+dfsg-0ubuntu1                     amd64        Qt 5 network module
    ii  libqt5sql5:amd64                      5.9.5+dfsg-0ubuntu1                     amd64        Qt 5 SQL module
    ii  libqt5sql5-sqlite:amd64               5.9.5+dfsg-0ubuntu1                     amd64        Qt 5 SQLite 3 database driver
    ii  libqt5svg5:amd64                      5.9.5-0ubuntu1                          amd64        Qt 5 SVG module
    ii  libqt5widgets5:amd64                  5.9.5+dfsg-0ubuntu1                     amd64        Qt 5 widgets module
    ii  libqt5x11extras5:amd64                5.9.5-0ubuntu1                          amd64        Qt 5 X11 extras
    (venv_0.2.0) 
    b-ak@ideapad-330S ~/Coder/venv_0.2.0/lib/python3.6/site-packages/PyQt5/Qt/plugins [009f9b6 *]
    ± % pip3 install pyqt5                                                                                                                                                                                         
    Requirement already satisfied: pyqt5 in /home/b-ak/Coder/venv_0.2.0/lib/python3.6/site-packages (5.11.2)
    Requirement already satisfied: PyQt5_sip<4.20,>=4.19.11 in /home/b-ak/Coder/venv_0.2.0/lib/python3.6/site-packages (from pyqt5) (4.19.12)
    (venv_0.2.0) 
    b-ak@ideapad-330S ~/Coder/venv_0.2.0/lib/python3.6/site-packages/PyQt5/Qt/plugins [009f9b6 *]
    ± % python3 audio_gui.py                                                                 
    Cannot mix incompatible Qt library (version 0x50905) with this library (version 0x50b01)
    [1]    10863 abort      python3 audio_gui.py
    (venv_0.2.0)
    ± %   
    


  • @b-ak
    This being a very PyQt question, like my https://forum.qt.io/post/482841 if you do not get a solution here try joining the "PyQt mailing list" (https://riverbankcomputing.com/mailman/listinfo/pyqt or similar) and ask there. And btw I found hassle with virtualenvs and stuck with Ubuntu distribution, though I realise you probably cannot afford this simplification.


Log in to reply