makerplane / pyEfis

Electronic Flight Information System in Python
GNU General Public License v2.0
55 stars 31 forks source link

Could not find the Qt platform plugin "xcb" #181

Closed brightproject closed 2 months ago

brightproject commented 3 months ago

I use Python 3.11 on Windows 10. There were no particular problems with other scripts, but with pyEfis I haven’t been able to find a solution for the past three hours. I cloned the repository to my PC git clone https://github.com/makerplane/pyEfis.git entered the folder cd pyEfis/ And I run the script python3 pyEfis.py I receive the following response:

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

Available platform plugins are: minimal, offscreen, webgl, windows.

In a folder along the way C:\Users\%USER%\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\PyQt5\Qt5\plugins\platforms There are actually four *dll plugin libraries. dll_qt5 The second method I used was to install WSL - Windows Subsystem for Linux. In the Linux emulator there are difficulties with displaying on the display, which is why the message appears on the command python3 pyEfis.py

qt.qpa.xcb: could not connect to display

And after it there is a similar message as in Windows.

qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.

Aborted (core dumped)

The most interesting thing is that when I go to the Linux folders, along the way \\wsl.localhost\Ubuntu\home\%USER%\.local\lib\python3.10\site-packages\PyQt5\Qt5\plugins\platforms I see a lot of plugins, some of them have the same name as in Qt5 for Windows, only the extension *so. so_qt5 Searching for a plugin in the form of a *dll library for Windows called libqxcb did not give me anything. Various methods that supposedly save the situation in Linux are not suitable for Windows. Unfortunately, in WSL I was not able to complete the installation procedure as it says

https://github.com/makerplane/pyEfis/blob/master/INSTALLING.md

Command entered into the WSL emulator sudo snap set system experimental.hotplug=true Gives the following information:

Interacting with snapd is not yet supported on Windows Subsystem for Linux 1.
This command has been left available for documentation purposes only.

I have a vicious circle: in Windows on Python I cannot run a script without snap packages, but Linux does not allow it. Of course, I’ll try to run Linux on a full-fledged virtual machine or on a separate PC, but this is not very convenient for me. I also can’t buy a single-board PC at the moment. Tell me please @birkelbach and @e100 , is it even possible to run your script on Windows?

e100 commented 3 months ago

Honestly I never gave a thought to this running on Windows, I have runLinux on all my computers and laptops for about 15 years now.

Please try commenting out this line and see if it resolves your issue: https://github.com/makerplane/pyEfis/blob/master/pyefis/main.py#L31

brightproject commented 3 months ago

Please try commenting out this line and see if it resolves your issue: https://github.com/makerplane/pyEfis/blob/master/pyefis/main.py#L31

INFO:20240418-22:09:28:root - Starting pyEFIS
INFO:20240418-22:09:28:pyavtools.fix - Initializing FIX Client
INFO:20240418-22:09:28:pyavtools.scheduler - Initializing Scheduler
INFO:20240418-22:09:28:pyefis.hmi - Initializing Actions
INFO:20240418-22:09:28:pyefis.gui - Initializing Graphics
CRITICAL:20240418-22:09:28:pyefis.gui - Unable to load module - pyefis.screens.screenbuilder: No module named 'pycond'
Traceback (most recent call last):
  File "G:\Need_Projects\HUD_SynteticVision\pyEfis\pyEfis.py", line 21, in <module>
    main.main()
  File "G:\Need_Projects\HUD_SynteticVision\pyEfis\pyefis\main.py", line 178, in main
    gui.initialize(config,config_path)
  File "G:\Need_Projects\HUD_SynteticVision\pyEfis\pyefis\gui.py", line 200, in initialize
    screens.append(Screen(name, module, config['screens'][each]))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "G:\Need_Projects\HUD_SynteticVision\pyEfis\pyefis\gui.py", line 41, in __init__
    self.module = importlib.import_module(module)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1264.0_x64__qbz5n2kfra8p0\Lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "G:\Need_Projects\HUD_SynteticVision\pyEfis\pyefis\screens\screenbuilder.py", line 31, in <module>
    from pyefis.instruments import button
  File "G:\Need_Projects\HUD_SynteticVision\pyEfis\pyefis\instruments\button\__init__.py", line 22, in <module>
    import pycond as pc
ModuleNotFoundError: No module named 'pycond'
INFO:20240418-22:09:31:pyavtools.fix.client - Attempting to Reconnect to 127.0.0.1:3490
INFO:20240418-22:09:34:pyavtools.fix.client - Attempting to Reconnect to 127.0.0.1:3490
INFO:20240418-22:09:37:pyavtools.fix.client - Attempting to Reconnect to 127.0.0.1:3490
INFO:20240418-22:09:40:pyavtools.fix.client - Attempting to Reconnect to 127.0.0.1:3490
INFO:20240418-22:09:43:pyavtools.fix.client - Attempting to Reconnect to 127.0.0.1:3490
INFO:20240418-22:09:46:pyavtools.fix.client - Attempting to Reconnect to 127.0.0.1:3490
INFO:20240418-22:09:50:pyavtools.fix.client - Attempting to Reconnect to 127.0.0.1:3490
INFO:20240418-22:09:53:pyavtools.fix.client - Attempting to Reconnect to 127.0.0.1:3490
INFO:20240418-22:09:56:pyavtools.fix.client - Attempting to Reconnect to 127.0.0.1:3490

Probably nothing will work with Windows... Your main.py script code contains path code

path_options = ['{USER}/makerplane/pyefis/config',
                 '{PREFIX}/local/etc/pyefis',
                 '{PREFIX}/etc/pyefis',
                 '/etc/pyefis',
                 '.']

They are for Linux. ...................................................... Small addition @e100 After commenting out line 31 of the main.py file, you need to install

python3 -m pip install pycond
python3 -m pip install geomag
python3 -m pip install geopy

I see the following in the console

INFO:20240418-22:22:29:root - Starting pyEFIS
INFO:20240418-22:22:29:pyavtools.fix - Initializing FIX Client
INFO:20240418-22:22:29:pyavtools.scheduler - Initializing Scheduler
INFO:20240418-22:22:29:pyefis.hmi - Initializing Actions
INFO:20240418-22:22:29:pyefis.gui - Initializing Graphics
INFO:20240418-22:22:32:pyavtools.fix.client - Attempting to Reconnect to 127.0.0.1:3490
INFO:20240418-22:22:35:pyavtools.fix.client - Attempting to Reconnect to 127.0.0.1:3490
INFO:20240418-22:22:38:pyavtools.fix.client - Attempting to Reconnect to 127.0.0.1:3490
INFO:20240418-22:22:41:pyavtools.fix.client - Attempting to Reconnect to 127.0.0.1:3490
INFO:20240418-22:22:44:pyavtools.fix.client - Attempting to Reconnect to 127.0.0.1:3490
e100 commented 3 months ago

You also need to run the fix gateway https://github.com/makerplane/FIX-Gateway

pyEFIS is the display for the data that FIX-Gateway collects.

brightproject commented 3 months ago

Thank you @e100, for your clarification and patience. I don’t understand well about the fix-gateway. I cloned the repository, installed the dependencies:

git clone https://github.com/makerplane/FIX-Gateway.git
python3 -m pip install ./

Result:

Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... done
Successfully built fixgw
Installing collected packages: fixgw
Successfully installed fixgw-0.1.0

Then I entered the command: python3 ./fixgwc.py And got the result FIX: What should I enter there and how can I start the server? Command: G:\Need_Projects\HUD_SynteticVision\pyEfis>python3 pyEfis.py --debug Result:

INFO:20240418-23:37:23:root - Starting pyEFIS
DEBUG:20240418-23:37:23:pyavtools.fix.client - ClientThread - Starting
INFO:20240418-23:37:23:pyavtools.fix - Initializing FIX Client
INFO:20240418-23:37:23:pyavtools.scheduler - Initializing Scheduler
DEBUG:20240418-23:37:23:pyavtools.fix - Adding output for BARO, method = onchange
DEBUG:20240418-23:37:23:pyavtools.fix - Adding output for TRIMP, method = onchange
DEBUG:20240418-23:37:23:pyavtools.fix - Adding output for TRIMR, method = onchange
DEBUG:20240418-23:37:23:pyavtools.fix - Adding output for TRIMY, method = onchange
DEBUG:20240418-23:37:23:pyavtools.fix - Adding output for APREQ, method = onchange
DEBUG:20240418-23:37:23:pyavtools.fix - Adding output for BTNHH, method = onchange
DEBUG:20240418-23:37:23:pyavtools.fix - Adding output for APADJ, method = onchange
DEBUG:20240418-23:37:23:pyavtools.fix - Adding output for BTNFP, method = onchange
INFO:20240418-23:37:23:pyefis.hmi - Initializing Actions
INFO:20240418-23:37:23:pyefis.gui - Initializing Graphics
DEBUG:20240418-23:37:23:pyefis.gui - Creating Screen SIXPACK
DEBUG:20240418-23:37:23:pyefis.gui - Creating Screen ANDROID
DEBUG:20240418-23:37:23:pyefis.gui - Creating Screen PFD
DEBUG:20240418-23:37:23:pyefis.gui - Creating Screen RADIO
DEBUG:20240418-23:37:23:pyefis.gui - Creating Screen EMS
DEBUG:20240418-23:37:23:pyefis.gui - Creating Screen EMS2
DEBUG:20240418-23:37:23:pyefis.gui - setting screen PFD to default
DEBUG:20240418-23:37:24:pyavtools.fix.client - Failed to connect timed out
INFO:20240418-23:37:26:pyavtools.fix.client - Attempting to Reconnect to 127.0.0.1:3490
DEBUG:20240418-23:37:27:pyavtools.fix.client - Failed to connect timed out

As I understand it, pyEFIS is waiting for the fix-gateway server to start and connect to it. A GUI appeared with the -g flag, but I can’t do anything in it. GUI_fix_gateway1

But I’m afraid you won’t be able to help me on Windows, I’ll have to install Linux on my laptop.

brightproject commented 3 months ago

Hello @birkelbach I managed to launch the pyEfis.py script, but there are some clear points. I had to install two different Linux distributions on a virtual machine, and I see different manifestations.

  1. On Linux Ubuntu 22.04, a makerplanefolder was spontaneously created and it contained pyefis configs, in which you can configure the screen size and other parameters. ubuntu_22_04_one ubuntu_22_04_two
  2. On Linux Mint 21.3, the makerplane folder was also somehow created, but inside it there were already folders with the fixgw and pyefis configs. mint_21_3_one mint_21_3_owo Video and the document used to make the installations here Moreover, in the first case, when starting the FIX-Gateway server for Stratux, I get the message running stratux plugin And in the second case, I get the message none Can you provide answers to the following questions: Can I run the pyEfis.py example without the FIX-Gateway server? Where can I read about the demo mode - when flight data is loaded from a flight, and why now the data loading is fly, there is no smooth change in parameters. How often does the program write samples if data is written to a black box? The main display is displayed correctly, but when you press the android button, the script stops working. Main You will forgive me in advance for some stupid questions, I am not a Linux expert, but I want to understand the topics that interest me.
e100 commented 2 months ago

I just merged #188 that removes the code that set QT_QPA_PLATFORM That variable is needed if you plan to use the Android feature. The snap includes it but when running the code with python one would need to set that variable, if they plan to use android too.

QT_QPA_PLATFORM=xcb python pyEfis.py

The fixgateway is required, think of it as the database for all the data.

The demo mode, enabled by default, is a plugin in fix gateway. Simply disable the demo plugin in the default.yaml config file for fix gateway to disable it. https://github.com/makerplane/FIX-Gateway/blob/04d2e8571e83d16fe88e9b64a9fa29d40e8cdb77/fixgw/config/default.yaml#L495

The Android feature only works on Linux after having also setup waydroid: https://github.com/makerplane/pyEfis/blob/master/ANDROID.md

'black box' is implemented with the data_recoder fixgateway plugin, you can also playback data previously recorded. How to set that up and use it is explained in the config file: https://github.com/makerplane/FIX-Gateway/blob/04d2e8571e83d16fe88e9b64a9fa29d40e8cdb77/fixgw/config/default.yaml#L29

On Ubuntu you can install pyefis and fixgateway with:

sudo snap install fixgateway
sudo snap install pyefis

For a 'production' setup start here: https://github.com/makerplane/pyEfis/blob/master/INSTALLING.md I would expect the INSTALLING.md instructions will work for any debian based distribution but I've only tested the procedure on Raspberry PI OS 'bookworm'

If you want to do development, start here: https://github.com/makerplane/pyEfis/blob/master/README.rst

Pull requests to get this running on Windows would be welcome but I think the majority of us here plan to run this on Raspberry PI or similar so that is where we have focused efforts.

With the original issue resolved and I think most of your questions answered I'm going to close this. If you have more questions the discussions or our forum would be the place to ask them.