-
Notifications
You must be signed in to change notification settings - Fork 33
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
use *some other vispy backend* instead of pyqt5 #86
Conversation
PyQt5 causes installation issues on M1 macs (see issue #83). PyQt is not used explicitly; only as a backend for vispy. PyQt6 does not seem to have such issues on M1, and selecting it as a vispy extra rather than a direct dependency should be more robust.
Perhaps @dokato could take this PR for a spin? A minimal test would be to run this in a terminal: >>> import navis
>>> nl = navis.example_neurons()
>>> navis.plot3d(nl)
>>> # Check if 3d viewer pops up. If so, see if we can close it properly:
>>> navis.close3() |
Sure. On
>>> navis.plot3d(nl)
[...]
File ~/anaconda3/envs/testnavis/lib/python3.9/site-packages/vispy-0.9.6-py3.9-macosx-11.0-arm64.egg/vispy/app/canvas.py:173, in Canvas.__init__(self, title, size, position, show, autoswap, app, create_native, vsync, resizable, decorate, fullscreen, config, shared, keys, parent, dpi, always_on_top, px_scale, backend_kwargs)
171 # Get app instance
172 if app is None:
--> 173 self._app = use_app(call_reuse=False)
174 elif isinstance(app, Application):
175 self._app = app
File ~/anaconda3/envs/testnavis/lib/python3.9/site-packages/vispy-0.9.6-py3.9-macosx-11.0-arm64.egg/vispy/app/_default_app.py:47, in use_app(backend_name, call_reuse)
44 return default_app # Current backend matches backend_name
46 # Create default app
---> 47 default_app = Application(backend_name)
48 return default_app
File ~/anaconda3/envs/testnavis/lib/python3.9/site-packages/vispy-0.9.6-py3.9-macosx-11.0-arm64.egg/vispy/app/application.py:47, in Application.__init__(self, backend_name)
45 self._backend_module = None
46 self._backend = None
---> 47 self._use(backend_name)
File ~/anaconda3/envs/testnavis/lib/python3.9/site-packages/vispy-0.9.6-py3.9-macosx-11.0-arm64.egg/vispy/app/application.py:258, in Application._use(self, backend_name)
256 break
257 else:
--> 258 raise RuntimeError('Could not import any of the backends. '
259 'You need to install any of %s. We recommend '
260 'PyQt' % [b[0] for b in CORE_BACKENDS])
262 # Store classes for app backend and canvas backend
263 self._backend = self.backend_module.ApplicationBackend()
RuntimeError: Could not import any of the backends. You need to install any of ['PyQt4', 'PyQt5', 'PyQt6', 'PySide', 'PySide2', 'PySide6', 'Pyglet', 'Glfw', 'SDL2', 'wx', 'EGL', 'osmesa', 'tkinter']. We recommend PyQt |
I think this is due to some missing compiled components which pip can't handle either way. Could you try the same code, after uninstalling pyqt6 and installing pyside6, just in case? Then maybe try installing qt6 with brew, and make sure you have xcode. Thanks for your help! Sorry that I don't have an M1 to test on; there are no CI providers either. |
Yeah, pyqt6 universal2 macos wheels do exist, but may dynamically link against something at the system level. As I understand it, pyqt gained a lot of popularity because it had qt5 support about 2 years before pyside. However, since then pyside has been blessed as the official qt for python, and has a more permissive license, so if it works I don't see any issue switching. |
This reverts commit 6f5e06c.
Another data point: With PyQt5 and PyQt6, With pyside6, it only works from |
Tricky. I don't think I've ever had a "clean" run of qt-based libs in python, and which backend works in which situation seems to be highly dependent on hardware, OS, extra libs, how you call it... a nightmare. Maybe the best thing to do is for vispy with each of its backends to be included as extras (e.g. |
Agreed, it is a nightmare. Not sure if my setup is just funky though: do you see the same behaviour with |
I'd also be game with using |
So long as that wouldn't break at install-time or import-time, just use-time (when we can catch it and recommend using another backend). Batteries included is definitely preferable, but it would be easier to ship something which always installs and has optional extra functionality, than something which sends a solid chunk of users scurrying for documentation because it won't install. |
I do 🤦 PyQt 5 and 6 work in python or ipython; pyside6 only works in ipython. Wonder what's going on there. On the other hand, using a bare |
Closing in favour of #90 |
PyQt5 causes installation issues on M1 macs (see issue #83).
PyQt is not used explicitly; only as a backend for vispy.
PyQt6 does not seem to have such issues on M1, and selecting it
as a vispy extra rather than a direct dependency should be more robust.
Would appreciate someone with an M1 mac testing out installation and running some 3D plotting.