-
Notifications
You must be signed in to change notification settings - Fork 33
MAINT: Make PyOpenGL optional #12
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
Conversation
|
@marsipu if this is okay with you, feel free to merge and push out 0.1.5 or I can do it |
|
@larsoner Yes I think too that OpenGL can be optional to avoid having all these additional problems. Maybe we could see if we collect the data from the speed-test from multiple users with different systems (CPU&GPU-combinations) in the future to see when OpenGL is an advantage. |
I'll remove it
Now they can do |
|
Maybe you could also change the lines 2162-2169 in _pg_figure.py to something like: if self.mne.use_opengl:
try:
import OpenGL
logger.info(f'Using pyopengl with version {OpenGL.__version__}')
except ImportError:
logger.warning('pyopengl was not found and OpenGL can\'t be used!\n'
'Install pyopengl with "pip install pyopengl".')
self.mne.use_opengl = False |
Why is that? PyOpenGL is available on conda-forge, no? So we could just include it as a dependency for the conda-forge package? |
If thats an option I would +1 that. Otherwise we also probably need to change the default for If you both got time you could do a quick run of |
Basically all the reasons it's a pain to deal with OpenGL on CIs. They have to have xvfb on Linux, or you have to use shims on Windows (gl-ci-helpers). So now instead of just having a single meta.yml, you have os-specific build instructions. Then you have to maintain those. It's not impossible to do this stuff, but regardless I don't think we should require OpenGL unless absolutely necessary. It's a pain for maintenance, and causes problems for users. I would feel this way even if OpenGL was way more performant, but given that in reality sometimes it's actually slower I don't see the point in putting in all this effort to deal with OpenGL when we can get away with making it an optional extension. |
I'm also okay with just using it if it's present, and not using it if it's not. Or maybe better, add a |
I tried on my macOS laptop and:
When I and a bunch of errors related to not having PyOpenGL (should probably decorate the tests properly so it doesn't bother trying to run if |
|
@larsoner I think you're somehow mistaken, we can trivially add PyOpenGL as a dep without setting up xvfb etc. just add it as a dep, but avoid relying on it during tests. I don't think this would add any pain for conda-forge users. |
|
It's indeed possible #15 plus the conda forge default of trying to do |
|
In addition to things not working properly macOS with OpenGL (and the OpenGL parts that do manage to work being subjectively slower than the CPU-based variants), on my Linux machine which has a good graphics card I get: So CPU is faster than GPU, at least for me. This to me is very far from meeting the bar for maintenance / support cost versus performance benefit. Okay to make OpenGL opt-in rather than opt-out? In other words, I think we should make it so that the default is not to use OpenGL even if it's installed, and have users set |
|
Yes all good for me! Thanks for running these tests, @larsoner! |
The conda-forge build is failing because PyOpenGL isn't in the required env. Building with PyOpenGL installed will be a pain, and in general we shouldn't absolutely require that users have this anyway. This is true both because OpenGL can be tricky to get working, and because the performance benefits are unclear.