-
-
Notifications
You must be signed in to change notification settings - Fork 1
Troubleshooting Launch Issues on Raspberry Pi
This guide addresses issues where moleditpy crashes immediately upon launch or fails to display the window when running on Raspberry Pi (Raspberry Pi OS). It assumes you installed via Installation for Linux (the moleditpy-linux package). As of this writing, the workarounds below still need to be applied manually — the app does not yet auto-detect Raspberry Pi's GPU/driver and apply them itself.
When launching the application, it crashes with the following error logs in the terminal:
-
X Window System Error:
X Error of failed request: BadWindow (invalid Window parameter) Major opcode of failed request: 12 (X_ConfigureWindow) -
OpenGL / Shader Compilation Error:
vtkShaderProgram ... error: syntax error, unexpected NEW_IDENTIFIER attempt to add attribute without a program for attribute ndCoordIn Couldn't build the shader program for resolving msaa.
The issue stems from compatibility conflicts between the Raspberry Pi graphics driver (VC4/V3D) and the visualization libraries (VTK/Qt).
-
OpenGL Version Mismatch: The application requests Anti-Aliasing (MSAA) features requiring
sampler2DMS(GLSL 1.50+). The default Raspberry Pi driver may not expose this version, causing shader compilation to fail. -
Window System (Wayland vs. X11): On Raspberry Pi OS (Bookworm and later), which uses Wayland by default, Qt may encounter race conditions when interacting with XWayland, leading to the
BadWindowerror.
You can resolve these issues by setting specific environment variables before launching the application.
Run the following commands in your terminal to set the variables and launch the app:
export QT_QPA_PLATFORM=xcb
export MESA_GL_VERSION_OVERRIDE=3.2
export MESA_GLSL_VERSION_OVERRIDE=150
moleditpy-
QT_QPA_PLATFORM=xcb: Forces Qt to use the X11 backend instead of Wayland. -
MESA_GL_...: Overrides the reported OpenGL version to 3.2 (GLSL 1.50), allowing the driver to attempt compiling the required shaders.
To avoid typing these commands every time, create a shell script (e.g., run_moleditpy.sh).
- Create the file:
nano run_moleditpy.sh
- Paste the following content:
#!/bin/bash export QT_QPA_PLATFORM=xcb export MESA_GL_VERSION_OVERRIDE=3.2 export MESA_GLSL_VERSION_OVERRIDE=150 moleditpy
- Make it executable and run:
chmod +x run_moleditpy.sh ./run_moleditpy.sh
If you are modifying the source code, you can fix the root cause of the shader error by disabling Multi-Sampling (MSAA). This removes the need for the MESA_... environment overrides, as the complex shaders will not be generated.
Python (VTK) Example:
# Disable multisampling on the render window
render_window.SetMultiSamples(0)Note: The QT_QPA_PLATFORM=xcb variable may still be required depending on the specific OS version and Qt environment.