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

hard to interpret error in Frame.show #392

Closed
tlambert03 opened this issue Dec 8, 2023 · 5 comments
Closed

hard to interpret error in Frame.show #392

tlambert03 opened this issue Dec 8, 2023 · 5 comments

Comments

@tlambert03
Copy link
Contributor

Looks like Frame.show tries to infer the environment, but it looks like some of the assumptions/logic it's using is a bit faulty and can result in a NameError:

❯ python examples/desktop/line_collection/line_stack.py
/Users/talley/dev/forks/fastplotlib/fastplotlib/graphics/_features/_base.py:34: UserWarning: converting float64 array to float32
  warn(f"converting {array.dtype} array to float32")
Traceback (most recent call last):
  File "/Users/talley/dev/forks/fastplotlib/examples/desktop/line_collection/line_stack.py", line 27, in <module>
    plot.show(maintain_aspect=False)
  File "/Users/talley/dev/forks/fastplotlib/fastplotlib/layouts/_frame/_frame.py", line 170, in show
    self._output = QOutputContext(
                   ^^^^^^^^^^^^^^
NameError: name 'QOutputContext' is not defined
pip list
anyio                     4.1.0
appnope                   0.1.3
argon2-cffi               23.1.0
argon2-cffi-bindings      21.2.0
arrow                     1.3.0
asttokens                 2.4.1
async-lru                 2.0.4
attrs                     23.1.0
av                        11.0.0
Babel                     2.13.1
beautifulsoup4            4.12.2
black                     23.11.0
bleach                    6.1.0
build                     1.0.3
certifi                   2023.11.17
cffi                      1.16.0
cfgv                      3.4.0
charset-normalizer        3.3.2
check-manifest            0.49
click                     8.1.7
cmap                      0.1.3
comm                      0.2.0
contourpy                 1.2.0
cycler                    0.12.1
debugpy                   1.8.0
decorator                 5.1.1
defusedxml                0.7.1
distlib                   0.3.7
docutils                  0.20.1
executing                 2.0.1
fancycompleter            0.9.1
fastjsonschema            2.19.0
fastplotlib               0.1.0a16   /Users/talley/dev/forks/fastplotlib
filelock                  3.13.1
fonttools                 4.46.0
fqdn                      1.5.1
freetype-py               2.4.0
identify                  2.5.32
idna                      3.6
imageio                   2.33.0
importlib-metadata        6.10.0
iniconfig                 2.0.0
ipykernel                 6.27.1
ipython                   8.18.1
ipywidgets                8.1.1
isoduration               20.11.0
jaraco.classes            3.3.0
jedi                      0.19.1
Jinja2                    3.1.2
joblib                    1.3.2
json5                     0.9.14
jsonpointer               2.4
jsonschema                4.20.0
jsonschema-specifications 2023.11.2
jupyter_client            8.6.0
jupyter_core              5.5.0
jupyter-events            0.9.0
jupyter-lsp               2.2.1
jupyter-rfb               0.4.2
jupyter_server            2.11.1
jupyter_server_terminals  0.4.4
jupyterlab                4.0.9
jupyterlab_pygments       0.3.0
jupyterlab_server         2.25.2
jupyterlab-widgets        3.0.9
keyring                   24.3.0
kiwisolver                1.4.5
markdown-it-py            2.2.0
MarkupSafe                2.1.3
matplotlib                3.8.2
matplotlib-inline         0.1.6
mdurl                     0.1.2
mistune                   3.0.2
more-itertools            10.1.0
mypy                      1.7.1
mypy-extensions           1.0.0
nbclient                  0.6.8
nbconvert                 7.11.0
nbformat                  5.9.2
nbmake                    1.4.6
nest-asyncio              1.5.8
nh3                       0.2.14
nodeenv                   1.8.0
notebook_shim             0.2.3
numpy                     1.26.2
overrides                 7.4.0
packaging                 23.2
pandocfilters             1.5.0
parso                     0.8.3
pathspec                  0.11.2
pdbpp                     0.10.3
pexpect                   4.9.0
Pillow                    10.1.0
pip                       23.3.1
pkginfo                   1.9.6
platformdirs              4.0.0
pluggy                    1.3.0
pre-commit                3.5.0
prometheus-client         0.19.0
prompt-toolkit            3.0.41
psutil                    5.9.6
ptyprocess                0.7.0
pure-eval                 0.2.2
pycparser                 2.21
pygfx                     0.1.17
Pygments                  2.17.2
pylinalg                  0.4.1
pyparsing                 3.1.1
pyproject_hooks           1.0.0
pyrepl                    0.9.0
PySide6                   6.6.0
PySide6-Addons            6.6.0
PySide6-Essentials        6.6.0
pytest                    7.4.3
python-dateutil           2.8.2
python-json-logger        2.0.7
PyYAML                    6.0.1
pyzmq                     25.1.1
readme-renderer           42.0
referencing               0.31.1
requests                  2.31.0
requests-toolbelt         1.0.0
rfc3339-validator         0.1.4
rfc3986                   2.0.0
rfc3986-validator         0.1.1
rich                      13.3.1
rpds-py                   0.13.2
rubicon-objc              0.4.7
ruff                      0.1.6
scikit-learn              1.3.2
scipy                     1.11.4
Send2Trash                1.8.2
setuptools                68.2.2
shiboken6                 6.6.0
sidecar                   0.7.0
simplejpeg                1.7.2
six                       1.16.0
sniffio                   1.3.0
soupsieve                 2.5
stack-data                0.6.3
terminado                 0.18.0
threadpoolctl             3.2.0
tinycss2                  1.2.1
tornado                   6.4
tqdm                      4.66.1
traitlets                 5.14.0
twine                     4.0.2
types-python-dateutil     2.8.19.14
typing_extensions         4.8.0
uharfbuzz                 0.37.3
uri-template              1.3.0
urllib3                   2.1.0
virtualenv                20.25.0
wcwidth                   0.2.12
webcolors                 1.13
webencodings              0.5.1
websocket-client          1.7.0
wgpu                      0.13.0
wheel                     0.42.0
widgetsnbextension        4.0.9
wmctrl                    0.5
zipp                      3.17.0

I can probably figure out what is needed, but one way or another, the code probably shouldn't ever reach that NameError

@tlambert03
Copy link
Contributor Author

(using pyqt6 instead of pyside6 solved it... but the error is still confusing)

@kushalkolar
Copy link
Member

Sorry for the late reply, busy time of year! I think the issue is that you tried to force the Qt canvas but pyqt6 was not installed. Right now the %gui qt hook specifically looks for pyqt6, we have plans for pyside etc. support on the roadmap #384

@tlambert03
Copy link
Contributor Author

What makes you say that? I use the %gui qt magic with pyside all the time.

I also could get this error simply by running the script outside of ipython.

But in any case, the issue here is not “add support for pyside”, it’s “ensure that a name error is never encountered, regardless of the user’s environment”

@kushalkolar
Copy link
Member

Yup that hook works with pyside, but fastplotlib doesn't. This is one place where we need to add more than pyqt6: https://github.com/fastplotlib/fastplotlib/blob/main/fastplotlib%2Flayouts%2F_frame%2F_qt_output.py

@kushalkolar
Copy link
Member

kushalkolar commented Apr 1, 2024

this was fixed in #431 , GUI selection mostly done by WGPU now

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

2 participants