bitcraze / crazyflie-clients-python

Host applications and library for Crazyflie written in Python.
Other
301 stars 468 forks source link

CFclient 2023.11 not starting due to QT6 mismatch #690

Open matejkarasek opened 9 months ago

matejkarasek commented 9 months ago

Hi, I cannot get to run the latest release (2023.11) on Win 11 with Python 3.11.4 installed via pip. 2023.6 works fine. Didn't dig deeper into it, but seems to be related to switching to Qt6?

UserWarning: Using SDL2 binaries from pysdl2-dll 2.24.0
INFO:cfclient.gui:Disabling STL printouts
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Program Files\Python311\Scripts\cfclient.exe\__main__.py", line 7, in <module>
  File "C:\Program Files\Python311\Lib\site-packages\cfclient\gui.py", line 162, in main
    from .ui.main import MainUI
  File "C:\Program Files\Python311\Lib\site-packages\cfclient\ui\main.py", line 35, in <module>
    from cfclient.ui.tab_toolbox import TabToolbox
  File "C:\Program Files\Python311\Lib\site-packages\cfclient\ui\tab_toolbox.py", line 34, in <module>
    from PyQt6 import QtWidgets
ImportError: DLL load failed while importing QtCore: The specified procedure could not be found.
knmcguire commented 9 months ago

Hi! hmmm... that's odd. It sounds like the same issue that people see in the VM... https://github.com/bitcraze/crazyflie-clients-python/issues/689

I'm running it on windows 11 as well with python 3.10, and it worked for me. Is it perhaps something that is missing on this list I wonder? https://doc.qt.io/qt-6/linux-requirements.html, but I can't find the windows equivalent

knmcguire commented 9 months ago

@matejkarasek which version of pyqt6 was installed on your machine?

matejkarasek commented 9 months ago

I believe it is 6.6.0

Collecting cfclient
  Using cached cfclient-2023.11-py3-none-any.whl.metadata (2.3 kB)
Requirement already satisfied: cflib>=0.1.24 in c:\program files\python311\lib\site-packages (from cfclient) (0.1.24)
Requirement already satisfied: appdirs~=1.4.0 in c:\users\matej\appdata\roaming\python\python311\site-packages (from cfclient) (1.4.4)
Requirement already satisfied: pyzmq~=25.0 in c:\users\matej\appdata\roaming\python\python311\site-packages (from cfclient) (25.1.0)
Requirement already satisfied: pyqtgraph~=0.13 in c:\users\matej\appdata\roaming\python\python311\site-packages (from cfclient) (0.13.3)
Collecting PyYAML~=6.0.1 (from cfclient)
  Using cached PyYAML-6.0.1-cp311-cp311-win_amd64.whl.metadata (2.1 kB)
Requirement already satisfied: numpy<1.25,>=1.20 in c:\users\matej\appdata\roaming\python\python311\site-packages (from cfclient) (1.24.4)
Collecting vispy~=0.13.0 (from cfclient)
  Using cached vispy-0.13.0-cp311-cp311-win_amd64.whl.metadata (8.5 kB)
Requirement already satisfied: pyserial~=3.5 in c:\users\matej\appdata\roaming\python\python311\site-packages (from cfclient) (3.5)
Requirement already satisfied: pyqt6~=6.5 in c:\program files\python311\lib\site-packages (from cfclient) (6.6.0)
Requirement already satisfied: PyQt6-sip~=13.5 in c:\program files\python311\lib\site-packages (from cfclient) (13.6.0)
Requirement already satisfied: pysdl2~=0.9.14 in c:\users\matej\appdata\roaming\python\python311\site-packages (from cfclient) (0.9.16)
Requirement already satisfied: pysdl2-dll==2.24.0 in c:\users\matej\appdata\roaming\python\python311\site-packages (from cfclient) (2.24.0)
Requirement already satisfied: pyusb>=1.0.0b2 in c:\users\matej\appdata\roaming\python\python311\site-packages (from cflib>=0.1.24->cfclient) (1.2.1)
Requirement already satisfied: libusb-package~=1.0 in c:\users\matej\appdata\roaming\python\python311\site-packages (from cflib>=0.1.24->cfclient) (1.0.26.2)
Requirement already satisfied: scipy~=1.7 in c:\users\matej\appdata\roaming\python\python311\site-packages (from cflib>=0.1.24->cfclient) (1.11.1)
Requirement already satisfied: PyQt6-Qt6>=6.6.0 in c:\program files\python311\lib\site-packages (from pyqt6~=6.5->cfclient) (6.6.1)
Requirement already satisfied: freetype-py in c:\users\matej\appdata\roaming\python\python311\site-packages (from vispy~=0.13.0->cfclient) (2.4.0)
Requirement already satisfied: hsluv in c:\users\matej\appdata\roaming\python\python311\site-packages (from vispy~=0.13.0->cfclient) (5.0.3)
Requirement already satisfied: kiwisolver in c:\users\matej\appdata\roaming\python\python311\site-packages (from vispy~=0.13.0->cfclient) (1.4.4)
Requirement already satisfied: packaging in c:\users\matej\appdata\roaming\python\python311\site-packages (from vispy~=0.13.0->cfclient) (23.1)
Requirement already satisfied: importlib-resources in c:\users\matej\appdata\roaming\python\python311\site-packages (from libusb-package~=1.0->cflib>=0.1.24->cfclient) (6.0.0)
Using cached cfclient-2023.11-py3-none-any.whl (295 kB)
Using cached PyYAML-6.0.1-cp311-cp311-win_amd64.whl (144 kB)
Using cached vispy-0.13.0-cp311-cp311-win_amd64.whl (1.4 MB)
Installing collected packages: vispy, PyYAML, cfclient
  Attempting uninstall: vispy
    Found existing installation: vispy 0.9.6
    Uninstalling vispy-0.9.6:
      Successfully uninstalled vispy-0.9.6
  Attempting uninstall: PyYAML
    Found existing installation: PyYAML 5.4.1
    Uninstalling PyYAML-5.4.1:
      Successfully uninstalled PyYAML-5.4.1
  Attempting uninstall: cfclient
    Found existing installation: cfclient 2023.6
    Uninstalling cfclient-2023.6:
      Successfully uninstalled cfclient-2023.6
Successfully installed PyYAML-6.0.1 cfclient-2023.11 vispy-0.13.0
knmcguire commented 9 months ago

Hmm interesting. I have 6.5.2. Let me see if I can update it

knmcguire commented 9 months ago

I've just upgraded it to 6.6.1 and no issues there.. the search continues!

matejkarasek commented 9 months ago

So I found a fix. I uninstalled cfclient as well as anything Qt6 related. After that, pip install cfclient and all seems to work!

The problem must have been different versions of PyQt6 and PyQt6-Qt6:

Before

PyQt6               6.6.0
PyQt6-Qt6           6.6.1
PyQt6-sip           13.6.0

After

PyQt6               6.6.1
PyQt6-Qt6           6.6.1
PyQt6-sip           13.6.0
knmcguire commented 9 months ago

Ah good one! Perhaps a bit tricky if already a QT 6 version was installed on the computer... would be handy to not have that happen. We should perhaps put in a check on startup that can detect this mismatch and give some kind of error (like reinstalling QT6)

knmcguire commented 9 months ago

So I've tried it on a clean venv environment, and it opens without issues, so this is an problem for anybody that have installed the cfclient through the development branch first a while ago and then updates it.

So in that sense this fix should be:

pip3 uninstall PyQt6 PyQt6-Qt6 PyQt6-sip cfclient cflib
pip3 install cfclient
knmcguire commented 9 months ago

Same thing with the bitcraze VM, in a clean install this issue will not happen. I'd still like to be able to handle issues like this though... either as a startup warning or indicating in documentation... so let's keep this issue open for now.

faezehmhmdi commented 9 months ago

I have the same issue on Mac: UserWarning: Using SDL2 binaries from pysdl2-dll 2.24.0 INFO:cfclient.gui:Disabling STL printouts INFO:cfclient.utils.input.inputreaders:Input readers: ['linuxjsdev', 'pysdl2'] INFO:cfclient.utils.input.inputreaders:Could not initialize [linuxjsdev]: Only supported on Linux INFO:cfclient.utils.input.inputreaders:Successfully initialized [pysdl2] INFO:cfclient.utils.input.inputinterfaces:Found interfaces: ['leapmotion', 'wiimote', 'zmqpull'] INFO:cfclient.utils.input.inputinterfaces:Could not initialize [leapmotion]: Leap Motion library probably not installed (No module named 'leapsdk') INFO:cfclient.utils.input.inputinterfaces:Could not initialize [wiimote]: Missing cwiid (wiimote) driver No module named 'cwiid' INFO:cfclient.utils.config:Dist config read from /Users/faezeh/crazyflie-clients-python/src/cfclient/configs/config.json INFO:cfclient.utils.config:Config file read from [/Users/faezeh/Library/Application Support/cfclient/config.json] INFO:cfclient.utils.input.inputinterfaces:Could not initialize [zmqpull]: ZMQ input disabled in config file INFO:cfclient.utils.zmq_led_driver:ZMQ led disabled in config file INFO:cfclient.utils.zmq_param:ZMQ param disabled in config file INFO:cfclient.gui:If startup fails because of "xcb", install dependency with sudo apt install libxcb-xinerama0. qt.qpa.plugin: Could not find the Qt platform plugin "cocoa" in "" This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

zsh: abort cfclient

knmcguire commented 9 months ago

Hi! You don't have the same error as @matejkarasek had:

    from PyQt6 import QtWidgets
ImportError: DLL load failed while importing QtCore: The specified procedure could not be found.

Yours is

qt.qpa.plugin: Could not find the Qt platform plugin "cocoa" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem

@faezehmhmdi Could you start a thread in discussions for this so we can first determine if it's an actual bug in the cfclient or just a missing package? https://discussions.bitcraze.io/