Question: I try to use library cv2 for changing picture. In mode debug I found out that problem in function cv2.namedWindow: def run(self): name_of_window = 'Test_version' image_cv2 = cv2.imread('external_data/probe.jpg') cv2.namedWindow(name_of_window, cv2.WINDOW_NORMAL) cv2.imshow(name_of_window, image_cv2) cv2.waitKey(0) cv2.destroyAllWindows()  After cv2.namedWindow appears warning and program stops. I will be pleasure if somebody give the advice. When I call os.environ , appears this: environ({ 'PATH': '/home/spartak/PycharmProjects/python_base/lesson_016/env/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin', 'LC_MEASUREMENT': 'ru_RU.UTF-8', 'XAUTHORITY': '/run/user/1000/.mutter-Xwaylandauth.MJ52B1', 'INVOCATION_ID': 'dd129fae7f7c452cb8fa8cd53b9da873', 'XMODIFIERS': '@im=ibus', 'LC_TELEPHONE': 'ru_RU.UTF-8', 'XDG_DATA_DIRS': '/usr/share/ubuntu:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop', 'GDMSESSION': 'ubuntu', 'LC_TIME': 'ru_RU.UTF-8', 'SNAP_COMMON': '/var/snap/pycharm-community/common', 'SNAP_INSTANCE_KEY': '', 'SNAP_USER_COMMON': '/home/spartak/snap/pycharm-community/common', 'DBUS_SESSION_BUS_ADDRESS': 'unix:path=/run/user/1000/bus', 'IDE_PROJECT_ROOTS': '/home/spartak/PycharmProjects/python_base', 'PS1': '(env) ', 'SNAP_REVISION': '256', 'XDG_CURRENT_DESKTOP': 'ubuntu:GNOME', 'JOURNAL_STREAM': '8:37824', 'LC_PAPER': 'ru_RU.UTF-8', 'SESSION_MANAGER': 'local/spartak-pc:@/tmp/.ICE-unix/2082,unix/spartak-pc:/tmp/.ICE-unix/2082', 'USERNAME': 'spartak', 'LOGNAME': 'spartak', 'PWD': '/home/spartak/PycharmProjects/python_base/lesson_016', 'MANAGERPID': '1951', 'IM_CONFIG_PHASE': '1', 'PYCHARM_HOSTED': '1', 'GJS_DEBUG_TOPICS': 'JS ERROR;JS LOG', 'PYTHONPATH': '/home/spartak/PycharmProjects/python_base:/home/spartak/PycharmProjects/python_base/lesson_012/python_snippets:/home/spartak/PycharmProjects/python_base/chatbot:/snap/pycharm-community/256/plugins/python-ce/helpers/third_party/thriftpy:/snap/pycharm-community/256/plugins/python-ce/helpers/pydev:/home/spartak/.cache/JetBrains/PyCharmCE2021.2/cythonExtensions:/home/spartak/PycharmProjects/python_base/lesson_016', 'SHELL': '/bin/bash', 'LC_ADDRESS': 'ru_RU.UTF-8', 'GIO_LAUNCHED_DESKTOP_FILE': '/var/lib/snapd/desktop/applications/pycharm-community_pycharm-community.desktop', 'BAMF_DESKTOP_FILE_HINT': '/var/lib/snapd/desktop/applications/pycharm-community_pycharm-community.desktop', 'IPYTHONENABLE': 'True', 'GNOME_DESKTOP_SESSION_ID': 'this-is-deprecated', 'GTK_MODULES': 'gail:atk-bridge', 'VIRTUAL_ENV': '/home/spartak/PycharmProjects/python_base/lesson_016/env', 'SNAP_ARCH': 'amd64', 'SYSTEMD_EXEC_PID': '2099', 'XDG_SESSION_DESKTOP': 'ubuntu', 'GNOME_SETUP_DISPLAY': ':1', 'SNAP_LIBRARY_PATH': '/var/lib/snapd/lib/gl:/var/lib/snapd/lib/gl32:/var/lib/snapd/void', 'SSH_AGENT_LAUNCHER': 'gnome-keyring', 'SHLVL': '0', 'LC_IDENTIFICATION': 'ru_RU.UTF-8', 'LC_MONETARY': 'ru_RU.UTF-8', 'SNAP_NAME': 'pycharm-community', 'QT_IM_MODULE': 'ibus', 'XDG_CONFIG_DIRS': '/etc/xdg/xdg-ubuntu:/etc/xdg', 'LANG': 'en_US.UTF-8', 'SNAP_INSTANCE_NAME': 'pycharm-community', 'XDG_SESSION_TYPE': 'wayland', 'SNAP_USER_DATA': '/home/spartak/snap/pycharm-community/256', 'PYDEVD_LOAD_VALUES_ASYNC': 'True', 'DISPLAY': ':0', 'SNAP_REEXEC': '', 'WAYLAND_DISPLAY': 'wayland-0', 'LIBRARY_ROOTS': '/home/spartak/.pyenv/versions/3.9.7/lib/python3.9:/home/spartak/.pyenv/versions/3.9.7/lib/python3.9/lib-dynload:/home/spartak/PycharmProjects/python_base/lesson_016/env/lib/python3.9/site-packages:/home/spartak/.cache/JetBrains/PyCharmCE2021.2/python_stubs/-1475777083:/snap/pycharm-community/256/plugins/python-ce/helpers/python-skeletons:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stdlib:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/jwt:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/six:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/mock:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/nmap:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/annoy:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/attrs:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/polib:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/retry:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/docopt:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/enum34:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/orjson:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/pysftp:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/xxhash:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/chardet:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/futures:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/pyaudio:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/tzlocal:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/Markdown:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/Werkzeug:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/aiofiles:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/colorama:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/filelock:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/paramiko:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/pathlib2:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/requests:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/waitress:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/freezegun:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/ipaddress:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/pyRFC3339:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/typed-ast:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/Deprecated:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/cachetools:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/frozendict:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/pyfarmhash:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/JACK-Client:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/contextvars:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/atomicwrites:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/cryptography:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/DateTimeRange:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/click-spinner:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/pkg_resources:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/python-gflags:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/python-slugify:/snap/pycharm-community/256/plugins/python-ce/helpers/typeshed/stubs/python-dateutil', 'SNAP_VERSION': '2021.2.3', 'LC_NAME': 'ru_RU.UTF-8', 'XDG_SESSION_CLASS': 'user', '_': '/usr/bin/gnome-session', 'SNAP_DATA': '/var/snap/pycharm-community/256', 'PYTHONIOENCODING': 'UTF-8', 'DESKTOP_SESSION': 'ubuntu', 'SNAP': '/snap/pycharm-community/256', 'USER': 'spartak', 'SNAP_REAL_HOME': '/home/spartak', 'XDG_MENU_PREFIX': 'gnome-', 'GIO_LAUNCHED_DESKTOP_FILE_PID': '122719', 'QT_ACCESSIBILITY': '1', 'PYTHONDONTWRITEBYTECODE': '1', 'LC_NUMERIC': 'ru_RU.UTF-8', 'GJS_DEBUG_OUTPUT': 'stderr', 'SSH_AUTH_SOCK': '/run/user/1000/keyring/ssh', 'PYTHONUNBUFFERED': '1', 'GNOME_SHELL_SESSION_MODE': 'ubuntu', 'SNAP_CONTEXT': 'AoM6cqDJGx0xxWBUHLXWyVdhoNwTuHJsXSu2foumZWGYLCOaeHoL', 'XDG_RUNTIME_DIR': '/run/user/1000', 'SNAP_COOKIE': 'AoM6cqDJGx0xxWBUHLXWyVdhoNwTuHJsXSu2foumZWGYLCOaeHoL', 'HOME': '/home/spartak', 'QT_QPA_PLATFORM_PLUGIN_PATH': '/home/spartak/PycharmProjects/python_base/lesson_016/env/lib/python3.9/site-packages/cv2/qt/plugins', 'QT_QPA_FONTDIR': '/home/spartak/PycharmProjects/python_base/lesson_016/env/lib/python3.9/site-packages/cv2/qt/fonts', 'LD_LIBRARY_PATH': '/home/spartak/PycharmProjects/python_base/lesson_016/env/lib/python3.9/site-packages/cv2/../../lib64:'}) 

Answer: I reverted back to Xorg from wayland and its working, no more warnings Here are the steps:  Disabled Wayland by uncommenting WaylandEnable=false in the /etc/gdm3/custom.conf Add QT_QPA_PLATFORM=xcb in /etc/environment Check whether you are on Wayland or Xorg using: echo $XDG_SESSION_TYPE