Opened 2 years ago

Last modified 2 years ago

#9390 assigned defect

Qt WebEngine initialized in nogui offscreen mode

Reported by: Greg Couch Owned by: Greg Couch
Priority: low Milestone:
Component: Window Toolkit Version:
Keywords: Cc: Tom Goddard, Zach Pearson
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

While Qt needs to be initialized in nogui offscreen mode to be able to rasterize text, QtWebEngine should not be. Repeat with:

$ chimerax-daily --nogui --offscreen
Qt WebEngine seems to be initialized from a plugin. Please set Qt::AA_ShareOpenGLContexts using QCoreApplication::setAttribute and QSGRendererInterface::OpenGLRhi using QQuickWindow::setGraphicsApi before constructing QGuiApplication.
UCSF ChimeraX version: 1.7.dev202307110732 (2023-07-11)
© 2016-2023 Regents of the University of California.  All rights reserved.
[How to cite UCSF ChimeraX](cxcmd:help help:credits.html)  

cmd> 

Change History (3)

comment:1 by pett, 2 years ago

Cc: Tom Goddard added
Component: UnassignedWindow Toolkit
Owner: set to Greg Couch
Status: newassigned

comment:2 by Tom Goddard, 2 years ago

The DICOM bundle custom init ends up importing chimerax.ui.widgets that imports QWebEngineCore. It also import Qt.QtWidgets. Probably those imports should not be happening in nogui mode.

I put a traceback.print_stack() in Qt/QtWebEngine.py to see that DICOM was the first importer

$ cx --nogui
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/core/__main__.py", line 1044, in <module>
    exit_code = init(sys.argv)
  File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/core/__main__.py", line 652, in init
    sess.toolshed.bootstrap_bundles(sess, opts.safe_mode)
  File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/core/toolshed/__init__.py", line 768, in bootstrap_bundles
    failed += self._init_custom(session)
  File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/core/toolshed/__init__.py", line 786, in _init_custom
    self._init_bundle_custom(session, bi, done, initializing, failed)
  File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/core/toolshed/__init__.py", line 807, in _init_bundle_custom
    bi.initialize(session)
  File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/core/toolshed/info.py", line 364, in initialize
    api = self._get_api(session.logger)
  File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/core/toolshed/info.py", line 509, in _get_api
    m = self.get_module()
  File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/core/toolshed/info.py", line 490, in get_module
    m = importlib.import_module(self.package_name)
  File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, 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 "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/dicom/__init__.py", line 17, in <module>
    from .dicom import (
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, 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 "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/dicom/dicom/__init__.py", line 3, in <module>
    from .ui import DICOMBrowserTool, DICOMDatabases
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, 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 "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/dicom/dicom/ui/__init__.py", line 14, in <module>
    from .metadata_tool import *
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, 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 "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/dicom/dicom/ui/metadata_tool.py", line 27, in <module>
    from .widgets import DICOMTable
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, 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 "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/dicom/dicom/ui/widgets/__init__.py", line 1, in <module>
    from .table import *
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, 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 "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/dicom/dicom/ui/widgets/table.py", line 19, in <module>
    from chimerax.ui.widgets import ItemTable
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, 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 "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/ui/widgets/__init__.py", line 19, in <module>
    from .htmlview import HtmlView, ChimeraXHtmlView
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, 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 "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/ui/widgets/htmlview.py", line 20, in <module>
    from Qt.QtWebEngineCore import QWebEnginePage, QWebEngineProfile
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, 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 "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/Qt/QtWebEngineCore.py", line 10, in <module>
    traceback.print_stack()
UCSF ChimeraX version: 1.7.dev202307180036 (2023-07-18)
© 2016-2023 Regents of the University of California.  All rights reserved.
cmd> 

comment:3 by Tom Goddard, 2 years ago

Cc: Zach Pearson added
Note: See TracTickets for help on using tickets.