-
Notifications
You must be signed in to change notification settings - Fork 367
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
GlslRenderer not working in Python virtual environment #1755
Comments
Base on the error which comes from here it appears that GLAD cannot be initialized. I don't have a Linux environment but it seems you have a X Display setup properly so I guess a check to see that the appropriate OpenGL libraries are installed and runnable on an X Display would help narrow the issue down. I think you can test this by running the MaterialXView and / or MaterialXNodeEditor which you can download from a distribution. If you have this built locally then you can run Hope this helps. Ping if you need more follow-up. |
BTW, This is what I do for my renderer class which is the same as the sample code. |
Hello,
My OpenGL has been operational for years, so I have few doubts about it, but I ran
I confirm that, out of any virtual environment:
Moreover I've been using MaterialX for 4 months (developing something based on it...), I was fully satisfied and encountered no issue till yesterday when I decided to move everything to virtual env, for deployment reasons...
Sorry I installed MaterialX from ArchLinux repo (
I fully agree with you!
That's why I suspect |
@kwokcb @jstone-lucasfilm Indeed, if I copy (and patch somewhat) The bash script becomes: # Create virtual env (same as before)
python -m venv .venv
source .venv/bin/activate
pip install MaterialX
# Copy and patch libGL.so.1 (ugly, just for demo)
cd .venv/lib/python3.11/site-packages/materialx.libs
cp /usr/lib/libGL.so.1 .
patchelf --replace-needed libGLdispatch.so.0 libGLdispatch-dcc1ca97.so.0.0.0 libGL.so.1
patchelf --replace-needed libGLX.so.0 libGLX-404aa684.so.0.0.0 libGL.so.1 (nota: without elf patch, At this stage, the Python script now runs without error. Of course, this copy-and-patch workaround is ugly, it is just for demo. But it allows me to conclude that you (or your PyPi packager) should include a |
That sounds like a good catch, @howetuft, and I'm open to that fix, but it's a bit beyond my own knowledge to include that OpenGL file in our Python distributions. Would you have the bandwidth to propose that as a pull request to GitHub, and we can review the changes for our next release? |
Certainly! Or I can try, at least... |
I think you need add a dependency in [options.extras_require]
# Add dependencies specific to Linux
linux = ["libGL"] Adding in @JeanChristopheMorinPerso for comment as he set this up. |
Unfortunately, this doesn't work, as far as I know. Indeed, no matter what you do, |
Maybe the problem is with symbols conflicts? The wheels bundles libOpenGL. From what I understand, both |
Yes, and it does find it (in glad)!
My answer would be yes, because
So, when
Yes, I was wrong to suggest that in my first posts, my apologies. So, now, my suggested solution: This is made possible by a FindOpenGL parameter, named The expected result is achieved by setting this parameter to What would you think about that? |
I'm unfortunately not very familiar with the OpenGL stack. On my arch linux system,
This makes me wonder, should MaterialX really use the old ABI? Though, it seems to be coming from https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/source/MaterialXRenderGlsl/External/Glad/glad.c#L97, which seems like a vendored dependency, so I don't think we should change that...
This won't fix the problem, at least setting We could instruct it not to bundle those libraries, but we would end up with a broken wheel (like we have today)... |
Basically, what I currently thinking is that changing https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/source/MaterialXRenderGlsl/External/Glad/glad.c#L97 to use |
Did you test my proposal? On my system, it fixes the problem: Auditwheel does not bundle the libs anymore, and --> Can you please try it on your own system before rejecting?
As you know, the wheel is compiled in a CentOS 7 environment, dating from 2014. The new ABI was introduced in 2017, if I'm right: GLVND
It is not a vendor dependency, it is an official dynamic loader from Khronos OpenGL: glad.
That's the miracle: OpenGL_GL_PREFERENCE=LEGACY instructs auditwheel not to bundle
I'm not sure we should tamper with glad.c. It is a widely used solution, nearly an industry standard, so it should work as-is. Moreover, if we patch it in any way, this would prevent it from being regenerated in the future and break compatibility with potential future evolutions. However, to extend your thoughts, there is a question we can ask: Why should Those two approaches static/dynamic should be mutually exclusive, in my understanding... So, maybe another solution would be to remove all static dependencies to |
Hello guys, Any news from your end? Let me summarise my proposal: Issue
This results into conflicts between libs and breaks the wheel. Proposed solution Key points
Additional point Moreover, Linux distros are increasingly restricting the use of --> Therefore, can you come back quickly to me with a solution? I obviously promote my own proposal, but I would equally welcome any solution that could fix the bug, as soon as it can be implemented in the short term. Thank you in advance for your responsiveness! |
@howetuft Your proposed fix in #1766 looks very reasonable to me, though I defer to @JeanChristopheMorinPerso and @kwokcb on whether this is the best path forward. Ideally we'd like to consider our |
Since the change proposed in #1766 is not intrusive, only affecting library preferences for Linux Python wheels, I'd be open to including this in our upcoming 1.38.10 release, if @JeanChristopheMorinPerso and @kwokcb don't have objections. Let me know what your thoughts are. |
Thanks to you, and thank you also for this outstanding software! |
* Fix OpenGL issue in Python virtual environment (AcademySoftwareFoundation#1766) See issue AcademySoftwareFoundation#1755 * Finalize changelog for 1.38.10 * Improvements to GitHub CI - Upgrade the MacOS_Xcode_14_Python311 build to the MacOS 14 environment. - Remove unneeded steps in virtual framebuffer setup and JavaScript uploads. * Remove unused classes This changelist removes two unused classes, SurfaceShaderNodeGlsl and SurfaceShaderNodeMsl, which are not leveraged in any active code path for MaterialX shader generation. * Add ESSL unit tests This changelist adds initial unit tests for ESSL shader generation, bringing the measured code coverage of MaterialX unit tests to 88.7%. --------- Co-authored-by: howetuft <[email protected]> Co-authored-by: Jonathan Stone <[email protected]>
* Fix OpenGL issue in Python virtual environment (AcademySoftwareFoundation#1766) See issue AcademySoftwareFoundation#1755 * Finalize changelog for 1.38.10 * Improvements to GitHub CI - Upgrade the MacOS_Xcode_14_Python311 build to the MacOS 14 environment. - Remove unneeded steps in virtual framebuffer setup and JavaScript uploads. * Remove unused classes This changelist removes two unused classes, SurfaceShaderNodeGlsl and SurfaceShaderNodeMsl, which are not leveraged in any active code path for MaterialX shader generation. * Add ESSL unit tests This changelist adds initial unit tests for ESSL shader generation, bringing the measured code coverage of MaterialX unit tests to 88.7%. --------- Co-authored-by: howetuft <[email protected]> Co-authored-by: Jonathan Stone <[email protected]>
Hello,
When I try to run
PyMaterialXRenderGlsl.GlslRenderer
in a Python virtual environment (Linux), I get the following error message:Steps to reproduce:
python -m venv .venv source .venv/bin/activate pip install MaterialX
I tried in Ubuntu 20.04 and ArchLinux environments: same result...
(please note also: when I run the same in a standard environment, everything works fine).
Many thanks in advance!
The text was updated successfully, but these errors were encountered: