Comments (33)
Hi I had a similar issue and fixed it by looking at which OpenGL version I had by calling:
glxinfo | grep OpenGL
>> OpenGL core profile version string: 3.3 (Core Profile) Mesa 19.1.3
Then I changed in the constants.py
file in pyrender.py (you can find it wherever you installed pyrender in my case: ~/.local/lib/python3.7/site-packages/pyrender/constants.py)
OPEN_GL_MAJOR = 3
OPEN_GL_MINOR = 3
After that I was able to render :)!
from pyrender.
I still had the problem after re-installing anaconda and creating a new environment but it was fixed by running conda install -c conda-forge libstdcxx-ng
(on Ubuntu 22.04)
from pyrender.
Just for the record, I added:
os.environ['PYOPENGL_PLATFORM'] = 'egl'
to the main script and solved the issue.
from pyrender.
Hi I had a similar issue and fixed it by looking at which OpenGL version I had by calling:
glxinfo | grep OpenGL >> OpenGL core profile version string: 3.3 (Core Profile) Mesa 19.1.3
Then I changed in the
constants.py
file in pyrender.py (you can find it wherever you installed pyrender in my case: ~/.local/lib/python3.7/site-packages/pyrender/constants.py)OPEN_GL_MAJOR = 3 OPEN_GL_MINOR = 3
After that I was able to render :)!
I was facing a very similar issue and this was the solution that finally fixed it for me! One small update: in my pyrender/constants.py file, I had to make the changes
TARGET_OPEN_GL_MAJOR = 3
TARGET_OPEN_GL_MINOR = 3
from pyrender.
Are you running this over SSH?
from pyrender.
Hi,
Thanks for the quick response! No, I am not running over ssh. It is all local.
Henry C.
from pyrender.
Which display drivers are you running? NVIDIA? If so, which version? The error message means that your system was unable to create an OpenGL 3.0+ context, which could be caused by faulty display drivers.
from pyrender.
No Nvidia GPU on this machine. Here's what I've got:
*-display
description: VGA compatible controller
product: Sky Lake Integrated Graphics
vendor: Intel Corporation
physical id: 2
bus info: pci@0000:00:02.0
version: 07
width: 64 bits
clock: 33MHz
capabilities: pciexpress msi pm vga_controller bus_master cap_list rom
configuration: driver=i915_bpo latency=0
resources: irq:132 memory:de000000-deffffff memory:c0000000-cfffffff ioport:f000(size=64)
Blender works fine, if that's any indication about the display drivers being faulty or not.
I've got a 1070Ti with Cuda 9.2 on my work computer but it would be nice to get this working on my laptop.
Henry C.
from pyrender.
Could you run the following tiny script and let me know what it outputs?
from pyglet.window import Window
from pyglet.gl import Config;
w = Window(config=Config(major_version=4, minor_version=1))
print('{}.{}'.format(w.context.config.major_version, w.context.config.minor_version))
from pyrender.
Yes:
File "generate_pose_dataset.py", line 176, in mesh_render
w = Window(config=Config(major_version=4, minor_version=1))
File "/usr/local/lib/python2.7/dist-packages/pyglet/window/xlib/__init__.py", line 170, in __init__
super(XlibWindow, self).__init__(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pyglet/window/__init__.py", line 595, in __init__
context = config.create_context(gl.current_context)
File "/usr/local/lib/python2.7/dist-packages/pyglet/gl/xlib.py", line 216, in create_context
return XlibContextARB(self, share)
File "/usr/local/lib/python2.7/dist-packages/pyglet/gl/xlib.py", line 322, in __init__
super(XlibContext13, self).__init__(config, share)
File "/usr/local/lib/python2.7/dist-packages/pyglet/gl/xlib.py", line 230, in __init__
raise gl.ContextException('Could not create GL context')
pyglet.gl.ContextException: Could not create GL context
from pyrender.
Ah, interesting. Yeah, you're not able to create an OpenGL 3+ context, which is a problem for pyrender
since it uses modern OpenGL for better efficiency. I'd try uninstalling and re-installing PyOpenGL_accelerate
, and make sure it builds properly. Let me know if that fixes anything.
from pyrender.
Hi,
I've tried that, both (1) using pip and (2) from source. It does not appear to have solved the issue. As stated in the first post, it works when you leave the input for Window() blank. I'll keep poking around bit. Couldn't get PyMesh running either with a different but similarly frustrating problem.
Warmth,
Henry C.
from pyrender.
@henryclever Yeah, sorry about that :( It seems that pyglet is just having a struggle getting an OpenGL 3+ context on your machine. If you can get that short script I gave you to work, everything will work in Pyrender, but unfortunately it may require some tweaks to pyglet. I would debug this further for you, but without your hardware, I'm unable to replicate the issue. For now, I'll leave the issue open. Let me know if there's anything else I can do to help you out.
from pyrender.
Thanks for the attention to this!
So, I've made some progress.
A key problem was that I was getting a GPU error when I used the command glxinfo | grep PyOpenGL
. I installed the following to make it go away:
sudo apt-get install linux-generic-lts-wily xserver-xorg-lts-wily libgl1-mesa-glx-lts-wily libglapi-mesa-lts-wily libwayland-egl1-mesa-lts-wily libgl1-mesa-glx-lts-wily:i386 libglapi-mesa-lts-wily:i386
However, I was still getting an error when creating the GL context with pyglet. The problem seems quite silly now. I had installed pyglet with the following:
sudo pip install pyglet
This installs pyglet 1.3.2, which throws an error upon executing Window(config=Config(major_version=4, minor_version=1))
. However, if I installed install pyglet with aptitude:
sudo apt-get install python-pyglet
Then pyglet 1.1.4 is installed, and the error goes away. FYI, When I was building pyglet from source, I was also using 1.3.2.
However, an error is still present with the following code:
print('{}.{}'.format(w.context.config.major_version, w.context.config.minor_version))
as well as with:
pyrender.Viewer(scene, use_raymond_lighting=True)
.
Error:
print('{}.{}'.format(w.context.config.major_version, w.context.config.minor_version))
AttributeError: 'XlibGLConfig13' object has no attribute 'major_version'
And I'm haven't figured it out yet. I'll keep prying, but any if you have any tips, I'm all ears!
Warmth,
Henry C.
from pyrender.
Also: the error is slightly different with pyrender.Viewer(scene).
Here it is:
pyrender.Viewer(scene, use_raymond_lighting=True)
File "/usr/local/lib/python2.7/dist-packages/pyrender/viewer.py", line 347, in __init__
self._init_and_start_app()
File "/usr/local/lib/python2.7/dist-packages/pyrender/viewer.py", line 996, in _init_and_start_app
if self.context.config.major_version < 3:
AttributeError: 'XlibGLConfig13' object has no attribute 'major_version'
from pyrender.
The error you're now seeing is because of code changes between Pyglet version 1.1.4 and 1.3.2, I believe. Basically, somewhere between those versions, the XlibGLConfig13 type got updated. You'll want to get this working with a modern (>1.3) version of Pyglet if possible.
from pyrender.
Got it!
Thanks for all the help.
Ran into yet more problems with my Intel GPU on my labtop. I installed pyrender on my work computer that has a 1070Ti (also running Ubuntu) and pyrender worked in less than a minute. Something about Ubuntu and Nvidia products .... things just seem to work easier in general!
I'll post here again if I find a solution to my Intel GPU problems regarding pyrender.
H
from pyrender.
from pyrender.
@mmatl Maybe it would be a good idea to create a config file to change the OpenGL version without having to change the source code
from pyrender.
@henryclever Did you fix your issue? I think I bumped into an identical one, still going through your steps.
Cheers,
Nathan
from pyrender.
@oarriaga Your comment fixed the issue for me!
I mean this comment:
"
Then I changed in the constants.py file in pyrender.py (you can find it wherever you installed pyrender in my case: ~/.local/lib/python3.7/site-packages/pyrender/constants.py)
OPEN_GL_MAJOR = 3
OPEN_GL_MINOR = 3
"
@henryclever I hope this solves the issue for you and any future readers.
from pyrender.
(smplifyx) mona@ubuntu:~/mona/code$ python test_piglet.py
Traceback (most recent call last):
File "test_piglet.py", line 1, in <module>
from pyglet.window import Window
File "/home/mona/venv/smplifyx/lib/python3.6/site-packages/pyglet/window/__init__.py", line 1897, in <module>
gl._create_shadow_window()
File "/home/mona/venv/smplifyx/lib/python3.6/site-packages/pyglet/gl/__init__.py", line 206, in _create_shadow_window
_shadow_window = Window(width=1, height=1, visible=False)
File "/home/mona/venv/smplifyx/lib/python3.6/site-packages/pyglet/window/xlib/__init__.py", line 173, in __init__
super(XlibWindow, self).__init__(*args, **kwargs)
File "/home/mona/venv/smplifyx/lib/python3.6/site-packages/pyglet/window/__init__.py", line 606, in __init__
context = config.create_context(gl.current_context)
File "/home/mona/venv/smplifyx/lib/python3.6/site-packages/pyglet/gl/xlib.py", line 204, in create_context
return XlibContextARB(self, share)
File "/home/mona/venv/smplifyx/lib/python3.6/site-packages/pyglet/gl/xlib.py", line 314, in __init__
super(XlibContext13, self).__init__(config, share)
File "/home/mona/venv/smplifyx/lib/python3.6/site-packages/pyglet/gl/xlib.py", line 218, in __init__
raise gl.ContextException('Could not create GL context')
pyglet.gl.ContextException: Could not create GL context
and this is your code snippet:
(smplifyx) mona@ubuntu:~/mona/code$ cat test_piglet.py
from pyglet.window import Window
from pyglet.gl import Config;
w = Window(config=Config(major_version=4, minor_version=1))
print('{}.{}'.format(w.context.config.major_version, w.context.config.minor_version))
and I have:
$ glxinfo | grep OpenGL
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 152 (GLX)
Minor opcode of failed request: 24 (X_GLXCreateNewContext)
Value in failed request: 0x0
Serial number of failed request: 41
Current serial number in output stream: 42
from pyrender.
Hi, I met with the same problem. I wonder where should I put_' OPEN_GL_MAJOR = 3, OPEN_GL_MINOR = 3'_? Did you mean global variables? This is my constant.py file. I try to add _OPEN_GL_MAJOR = 3, OPEN_GL_MINOR = 3_after this, and it still didn't work.
from pyrender.
@mmatl I have the same problem as @henryclever, however I am running over SSH.
File "/mnt/Data/nugrinovic/code/visualize/renderer.py", line 85, in __init__
self.renderer = pyrender.OffscreenRenderer(height, width)
File "/home/nugrinovic/miniconda3/envs/torch1.4/lib/python3.7/site-packages/pyrender/offscreen.py", line 31, in __init__
self._create()
File "/home/nugrinovic/miniconda3/envs/torch1.4/lib/python3.7/site-packages/pyrender/offscreen.py", line 149, in _create
self._platform.init_context()
File "/home/nugrinovic/miniconda3/envs/torch1.4/lib/python3.7/site-packages/pyrender/platforms/pyglet_platform.py", line 52, in init_context
width=1, height=1)
File "/home/nugrinovic/miniconda3/envs/torch1.4/lib/python3.7/site-packages/pyglet/window/xlib/__init__.py", line 173, in __init__
super(XlibWindow, self).__init__(*args, **kwargs)
File "/home/nugrinovic/miniconda3/envs/torch1.4/lib/python3.7/site-packages/pyglet/window/__init__.py", line 606, in __init__
context = config.create_context(gl.current_context)
File "/home/nugrinovic/miniconda3/envs/torch1.4/lib/python3.7/site-packages/pyglet/gl/xlib.py", line 204, in create_context
return XlibContextARB(self, share)
File "/home/nugrinovic/miniconda3/envs/torch1.4/lib/python3.7/site-packages/pyglet/gl/xlib.py", line 314, in __init__
super(XlibContext13, self).__init__(config, share)
File "/home/nugrinovic/miniconda3/envs/torch1.4/lib/python3.7/site-packages/pyglet/gl/xlib.py", line 218, in __init__
raise gl.ContextException('Could not create GL context')
from pyrender.
Are you running this over SSH?
I need answer of this problem, can you help...
from pyrender.
Are you running this over SSH?
I need answer of this problem, can you help...
For SSH, seems like the only way is to use the offscreen rendering. I am also curious about how can we run pyrender.Viewer(scene, use_raymond_lighting=True)
with SSH, please? @mmatl Thank you!
from pyrender.
Are you running this over SSH?
I need answer of this problem, can you help...
I just reboot to solve the problem,but I don't know why,you can try to see whether it work or not
from pyrender.
I reboot my ssh server, now not able to connect it, showing timeout error
from pyrender.
Writing from 2022, it is useful to note that many things can cause this error. It sounds like anything that disrupts creating the context, from very general problems with accessing underlying C libraries, to specific issues like like of access to the display or inadequate OpenGL version being available.
I just had this error when using a conda environment installed version of pyrender and pyglet after upgrading from ubuntu 20.04 to 22.04. Evidently glibc was upgraded from 20.04->22.04, so the libraries installed in the conda environment previously.
Documentation of what to do is discussed in:
libGL Error with Ubuntu 22.04
fix in
conda-forge/ctng-compilers-feedstock#98
Newly created conda environments pulling from conda-forge will not have this problem as in May conda-forge updated to use more recent libraries.
from pyrender.
Same problem, installed pyglet with pip in a virtual env. Is there any further discussion going on about this?
from pyrender.
I still had the problem after re-installing anaconda and creating a new environment but it was fixed by running
conda install -c conda-forge libstdcxx-ng
(on Ubuntu 22.04)
Worked on Ubuntu 22.04. Thanks a lot!!!!!
from pyrender.
I still had the problem after re-installing anaconda and creating a new environment but it was fixed by running
conda install -c conda-forge libstdcxx-ng
(on Ubuntu 22.04)
Thanks a lot!!!!!!!!!!! It works for me on WSL2(Ubuntu22.04)!
from pyrender.
Hi I had a similar issue and fixed it by looking at which OpenGL version I had by calling:
glxinfo | grep OpenGL >> OpenGL core profile version string: 3.3 (Core Profile) Mesa 19.1.3
Then I changed in the
constants.py
file in pyrender.py (you can find it wherever you installed pyrender in my case: ~/.local/lib/python3.7/site-packages/pyrender/constants.py)OPEN_GL_MAJOR = 3 OPEN_GL_MINOR = 3
After that I was able to render :)!
I was facing a very similar issue and this was the solution that finally fixed it for me! One small update: in my pyrender/constants.py file, I had to make the changes
TARGET_OPEN_GL_MAJOR = 3 TARGET_OPEN_GL_MINOR = 3
It also works for me. version of my openGL is 1.4, so I only modify:
TARGET_OPEN_GL_MAJOR = 3
but then I encounter another error:
OpenGL.error.NullFunctionError: Attempt to call an undefined function glGenVertexArrays, check for bool(glGenVertexArrays) before calling
Can anyone help me with this out?
from pyrender.
Related Issues (20)
- Request for Assistance: Obtaining Pixel-to-Face Index in Pyrender
- BROKEN LINK: Google colab notebooks HOT 1
- Invalid device ID (0), Pyrender NOT working on Python 3.10 HOT 5
- Inverted triangles?
- How to retrieve intrinsic camera parameters from PerspectiveCamera
- Textures rendering slanted
- Sphere Rendered with Non-reflective Material Not Appearing Black
- offscreen error
- 'Viewer' object has no attribute 'render'. Did you mean: '_render'?
- Interpolation artifacts in segmentation masks.
- Unable to get color on running the bottle example code HOT 1
- Wrong depth rendering in WSL-ubuntu environment
- Path3D type error when loading trimesh scene
- GLB is not rendered correctly HOT 1
- How to properly merge the Scenes from multiple trimeshes?
- Request for Release of Tag 0.1.46 with auto_start Option
- Cannot render SpecularGlossinessMaterial HOT 1
- jupyter notebook support?
- Attempt to call an undefined function glGenVertexArrays, check for bool(glGenVertexArrays) before calling HOT 3
- OpenGL.error.NullFunctionError: Attempt to call an undefined function glGenVertexArrays, check for bool(glGenVertexArrays) before calling
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyrender.