Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glitchy display/errors when running vsk on Linux #353

Closed
JackiePease opened this issue Feb 4, 2023 · 16 comments
Closed

Glitchy display/errors when running vsk on Linux #353

JackiePease opened this issue Feb 4, 2023 · 16 comments

Comments

@JackiePease
Copy link

Having a really strange issue with a clean install of vsketch (installed using pipx as per install instructions)

I run vsk run examples/schotter and the window opens but the main display error is unusable and glitching out.

I'm using Ubuntu 22.10. OpenGL messages are mentioned in the traceback. I'm using Blender on this machine with no problems.

The following output appears on the console:

Traceback (most recent call last):
  File "/home/jackie/.local/pipx/venvs/vsketch/lib/python3.10/site-packages/vpype_viewer/qtviewer/viewer.py", line 157, in paintGL
    self._initializeGL()
  File "/home/jackie/.local/pipx/venvs/vsketch/lib/python3.10/site-packages/vpype_viewer/qtviewer/viewer.py", line 137, in _initializeGL
    self._ctx = mgl.create_context()
  File "/home/jackie/.local/pipx/venvs/vsketch/lib/python3.10/site-packages/moderngl/context.py", line 2004, in create_context
    ctx.mglo, ctx.version_code = mgl.create_context(glversion=require, mode=mode, **settings)
  File "/home/jackie/.local/pipx/venvs/vsketch/lib/python3.10/site-packages/glcontext/__init__.py", line 90, in create
    return x11.create_context(**kwargs)
Exception: (detect) glXGetCurrentContext: cannot detect OpenGL context
Traceback (most recent call last):
  File "/home/jackie/.local/pipx/venvs/vsketch/lib/python3.10/site-packages/vpype_viewer/qtviewer/viewer.py", line 157, in paintGL
    self._initializeGL()
  File "/home/jackie/.local/pipx/venvs/vsketch/lib/python3.10/site-packages/vpype_viewer/qtviewer/viewer.py", line 137, in _initializeGL
    self._ctx = mgl.create_context()
  File "/home/jackie/.local/pipx/venvs/vsketch/lib/python3.10/site-packages/moderngl/context.py", line 2004, in create_context
    ctx.mglo, ctx.version_code = mgl.create_context(glversion=require, mode=mode, **settings)
  File "/home/jackie/.local/pipx/venvs/vsketch/lib/python3.10/site-packages/glcontext/__init__.py", line 90, in create
    return x11.create_context(**kwargs)
Exception: (detect) glXGetCurrentContext: cannot detect OpenGL context
Traceback (most recent call last):
  File "/home/jackie/.local/pipx/venvs/vsketch/lib/python3.10/site-packages/vpype_viewer/qtviewer/viewer.py", line 157, in paintGL
    self._initializeGL()
  File "/home/jackie/.local/pipx/venvs/vsketch/lib/python3.10/site-packages/vpype_viewer/qtviewer/viewer.py", line 137, in _initializeGL
    self._ctx = mgl.create_context()
  File "/home/jackie/.local/pipx/venvs/vsketch/lib/python3.10/site-packages/moderngl/context.py", line 2004, in create_context
    ctx.mglo, ctx.version_code = mgl.create_context(glversion=require, mode=mode, **settings)
  File "/home/jackie/.local/pipx/venvs/vsketch/lib/python3.10/site-packages/glcontext/__init__.py", line 90, in create
    return x11.create_context(**kwargs)
Exception: (detect) glXGetCurrentContext: cannot detect OpenGL context
Traceback (most recent call last):
  File "/home/jackie/.local/pipx/venvs/vsketch/lib/python3.10/site-packages/vpype_viewer/qtviewer/viewer.py", line 157, in paintGL
    self._initializeGL()
  File "/home/jackie/.local/pipx/venvs/vsketch/lib/python3.10/site-packages/vpype_viewer/qtviewer/viewer.py", line 137, in _initializeGL
    self._ctx = mgl.create_context()
  File "/home/jackie/.local/pipx/venvs/vsketch/lib/python3.10/site-packages/moderngl/context.py", line 2004, in create_context
    ctx.mglo, ctx.version_code = mgl.create_context(glversion=require, mode=mode, **settings)
  File "/home/jackie/.local/pipx/venvs/vsketch/lib/python3.10/site-packages/glcontext/__init__.py", line 90, in create
    return x11.create_context(**kwargs)
Exception: (detect) glXGetCurrentContext: cannot detect OpenGL context
@willcrobinson
Copy link

I've just run same from a clean Ubuntu 22.04.1 LTS install. Exact same issue, screenshot and traceback below.

image

➜  ~ vsk run ~/Documents/vsketch/examples/schotter/
Running sketch: /home/robinsw/Documents/vsketch/examples/schotter/sketch_schotter.py
Traceback (most recent call last):
  File "/home/robinsw/.local/pipx/venvs/vsketch/lib/python3.10/site-packages/vpype_viewer/qtviewer/viewer.py", line 157, in paintGL
    self._initializeGL()
  File "/home/robinsw/.local/pipx/venvs/vsketch/lib/python3.10/site-packages/vpype_viewer/qtviewer/viewer.py", line 137, in _initializeGL
    self._ctx = mgl.create_context()
  File "/home/robinsw/.local/pipx/venvs/vsketch/lib/python3.10/site-packages/moderngl/context.py", line 2004, in create_context
    ctx.mglo, ctx.version_code = mgl.create_context(glversion=require, mode=mode, **settings)
  File "/home/robinsw/.local/pipx/venvs/vsketch/lib/python3.10/site-packages/glcontext/__init__.py", line 90, in create
    return x11.create_context(**kwargs)
Exception: (detect) glXGetCurrentContext: cannot detect OpenGL context
Traceback (most recent call last):
  File "/home/robinsw/.local/pipx/venvs/vsketch/lib/python3.10/site-packages/vpype_viewer/qtviewer/viewer.py", line 157, in paintGL
    self._initializeGL()
  File "/home/robinsw/.local/pipx/venvs/vsketch/lib/python3.10/site-packages/vpype_viewer/qtviewer/viewer.py", line 137, in _initializeGL
    self._ctx = mgl.create_context()
  File "/home/robinsw/.local/pipx/venvs/vsketch/lib/python3.10/site-packages/moderngl/context.py", line 2004, in create_context
    ctx.mglo, ctx.version_code = mgl.create_context(glversion=require, mode=mode, **settings)
  File "/home/robinsw/.local/pipx/venvs/vsketch/lib/python3.10/site-packages/glcontext/__init__.py", line 90, in create
    return x11.create_context(**kwargs)
Exception: (detect) glXGetCurrentContext: cannot detect OpenGL context

@abey79
Copy link
Owner

abey79 commented Feb 6, 2023

What happens when running vsketch like this?

QT_QPA_PLATFORM=xcb vsk run examples/schotter

@JackiePease
Copy link
Author

JackiePease commented Feb 6, 2023 via email

@willcrobinson
Copy link

Thanks, works fine for me too.

@abey79 abey79 changed the title Glitchy display when running vsk Glitchy display/errors when running vsk on Linux Feb 7, 2023
@abey79 abey79 pinned this issue Feb 7, 2023
@abey79
Copy link
Owner

abey79 commented Feb 7, 2023

@JackiePease @willcrobinson I'm trying to figure out what's going on exactly. Could you show me your Terminal's environment variables (the output of env)?

@willcrobinson
Copy link

@abey79 No problem, output below:

➜  ~ env
SYSTEMD_EXEC_PID=2706
SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
SESSION_MANAGER=local/comp1-dell-5430:@/tmp/.ICE-unix/2542,unix/comp1-dell-5430:/tmp/.ICE-unix/2542
LANG=en_GB.UTF-8
XDG_CURRENT_DESKTOP=ubuntu:GNOME
COLORTERM=truecolor
WAYLAND_DISPLAY=wayland-0
LANGUAGE=en_GB:en
GIO_LAUNCHED_DESKTOP_FILE_PID=6576
XDG_DATA_DIRS=/home/user1/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop
TERMINATOR_UUID=urn:uuid:f1636dd0-a95c-47d5-b49b-e114843d24fc
QT_IM_MODULE=ibus
USER=user1
DESKTOP_SESSION=ubuntu
XDG_MENU_PREFIX=gnome-
OLDPWD=/home/user1
HOME=/home/user1
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
SSH_AGENT_LAUNCHER=gnome-keyring
_=/usr/bin/env
GTK_MODULES=gail:atk-bridge
VTE_VERSION=6800
XDG_SESSION_DESKTOP=ubuntu
JOURNAL_STREAM=8:23333
QT_ACCESSIBILITY=1
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
MANAGERPID=2338
GNOME_SETUP_DISPLAY=:1
LOGNAME=user1
PATH=/home/user1/.local/bin:/home/user1/node_modules/.bin/:/home/user1/.nvm/versions/node/v18.13.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin
XDG_RUNTIME_DIR=/run/user/1000
XMODIFIERS=@im=ibus
GNOME_SHELL_SESSION_MODE=ubuntu
XDG_SESSION_TYPE=wayland
IBUS_DISABLE_SNOOPER=1
SHELL=/usr/bin/zsh
USERNAME=user1
INVOCATION_ID=a7b3cdd7bb714467a7fe51c08768e435
SHLVL=1
XAUTHORITY=/run/user/1000/.mutter-Xwaylandauth.RMMH01
TERMINATOR_DBUS_NAME=net.tenshu.Terminator25ef4b219e3b005583550f2b0f9f990c3
PWD=/home/user1
XDG_SESSION_CLASS=user
DISPLAY=:0
GDMSESSION=ubuntu
TERMINATOR_DBUS_PATH=/net/tenshu/Terminator2
TERM=xterm-256color
ZSH=/home/user1/.oh-my-zsh
PAGER=less
LESS=-R
LSCOLORS=Gxfxcxdxbxegedabagacad
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:
NVM_DIR=/home/user1/.nvm
NVM_CD_FLAGS=-q
NVM_BIN=/home/user1/.nvm/versions/node/v18.13.0/bin
NVM_INC=/home/user1/.nvm/versions/node/v18.13.0/include/node

@abey79
Copy link
Owner

abey79 commented Feb 7, 2023

When installing vpype, pipx install PySide6 as a dependency. PySide6 includes a version of Qt6. I'd like to know what "platforms" plug-ins are included with it. Could one of you take a peak? This should be somewhere looking like:

ls ~/.local/pipx/venvs/vpype/lib/python3.10/site-packages/PySide6/Qt/plugins/platforms/

I'm expecting that path could be somewhat different on a Linux install, though. The first part of the path is given by pipx environment (check for the PIPX_LOCAL_VENVS variable).

@willcrobinson
Copy link

I don't have a vpype directory in my ~/.local/pipx/venvs but I do have a vsketch one.

Contents of /home/user1/.local/pipx/venvs/vsketch/lib/python3.10/site-packages/PySide6/Qt/plugins/platforms are:

libqeglfs.so       libqminimal.so       libqvnc.so              libqxcb.so
libqlinuxfb.so     libqoffscreen.so     libqwayland-egl.so
libqminimalegl.so  libqvkkhrdisplay.so  libqwayland-generic.so

Tried running pipx environment but it wouldn't work as the environment option was only added in pipx 1.1.0

@abey79
Copy link
Owner

abey79 commented Feb 7, 2023

Thanks. I think PySide6/Qt6 is using QT_QPA_PLATFORM=wayland by default which should correspond to libqwayland-generic.so here.

I'm guessing QT_QPA_PLATFORM=wayland vsk run examples/schotter gives you the glitched display. Can you test with QT_QPA_PLATFORM=wayland-egl? Also, what do you get when running with QT_QPA_PLATFORM=iDonTkNow? (this should generate an error and, I think, offer a list of available plugins)

@willcrobinson
Copy link

QT_PLA_PLATFORM=iDonTkNow vsk run test throws the following:

qt.qpa.plugin: Could not find the Qt platform plugin "idontknow" 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: eglfs, linuxfb, minimal, minimalegl, offscreen, vkkhrdisplay, vnc, wayland-egl, wayland, xcb.

[1]    37932 IOT instruction (core dumped)  QT_QPA_PLATFORM=iDonTkNow vsk run test

QT_QPA_PLATFORM=wayland vsk run test exhibits the glitchy window behaviour that we originally saw.

QT_QPA_PLATFORM=wayland-egl vsk run test gives the same glitchy window behaviour.

@abey79
Copy link
Owner

abey79 commented Feb 8, 2023

Thanks for trying. May I ask for one final test to explore this issue? I'm fairly sure the version of PySide6 that was installed alongside with vsketch wasn't the latest. Could you update it with the following command?

pipx inject vsketch pyside6==6.4.2

Does this change the behaviour with QT_QPA_PLATFORM=wayland etc.?

@willcrobinson
Copy link

No problem at all! Injected as you asked but still no joy, whether using QT_QPA_PLATFORM=wayland or QT_QPA_PLATFORM=wayland-egl

@abey79
Copy link
Owner

abey79 commented Feb 8, 2023

Thanks a lot. I'll add a mechanism to default to xcb when wayland is detected, to avoid this issue.

@abey79
Copy link
Owner

abey79 commented Mar 11, 2023

Hey @willcrobinson @JackiePease. I'm trying to address this issue in the next release of vpype (see abey79/vpype#607). Would you be so kind as to test that the patch works as expected?

This could be done by installing vpype from source:

pipx install "git+https://github.com/abey79/vpype@fix-wayland-crash-596#egg=vpype[all]"

You may need to uninstall an existing vpype install before:

pipx uninstall vpype

Then, you need a terminal where QT_QPA_PLATFORM is not defined:

$ echo $QT_QPA_PLATFORM
# no output!!!

The viewer can be tested with:

vpype random show

This should work and display some random lines.

If you want, you can get back to the previous version:

pipx uninstall vpype
pipx install "vpype[all]"

Alternatively, wait for the 1.13 release and simply upgrade:

pipx upgrade vpype

@willcrobinson
Copy link

Hi @abey79

Followed the instructions to the letter, QT_QPA_PLATFORM returns no output. Running vpype random show presents random lines and the interface works as it should.

Thanks

@abey79
Copy link
Owner

abey79 commented Mar 11, 2023

Hey @willcrobinson, awesome—thanks for taking the time. I hope to release vpype 1.13 with this fix in the first half of next week.

@abey79 abey79 closed this as completed Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants