Giter VIP home page Giter VIP logo

Comments (33)

oarriaga avatar oarriaga commented on May 31, 2024 40

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.

OleBialas avatar OleBialas commented on May 31, 2024 27

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.

nicolasugrinovic avatar nicolasugrinovic commented on May 31, 2024 12

Just for the record, I added:

os.environ['PYOPENGL_PLATFORM'] = 'egl'

to the main script and solved the issue.

from pyrender.

UttaranB127 avatar UttaranB127 commented on May 31, 2024 4

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.

mmatl avatar mmatl commented on May 31, 2024

Are you running this over SSH?

from pyrender.

henryclever avatar henryclever commented on May 31, 2024

Hi,

Thanks for the quick response! No, I am not running over ssh. It is all local.

Henry C.

from pyrender.

mmatl avatar mmatl commented on May 31, 2024

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.

henryclever avatar henryclever commented on May 31, 2024

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.

mmatl avatar mmatl commented on May 31, 2024

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.

henryclever avatar henryclever commented on May 31, 2024

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.

mmatl avatar mmatl commented on May 31, 2024

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.

henryclever avatar henryclever commented on May 31, 2024

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.

mmatl avatar mmatl commented on May 31, 2024

@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.

henryclever avatar henryclever commented on May 31, 2024

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.

henryclever avatar henryclever commented on May 31, 2024

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.

mmatl avatar mmatl commented on May 31, 2024

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.

henryclever avatar henryclever commented on May 31, 2024

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.

mmatl avatar mmatl commented on May 31, 2024

from pyrender.

oarriaga avatar oarriaga commented on May 31, 2024

@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.

neonb88 avatar neonb88 commented on May 31, 2024

@henryclever Did you fix your issue? I think I bumped into an identical one, still going through your steps.

Cheers,
Nathan

from pyrender.

neonb88 avatar neonb88 commented on May 31, 2024

@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.

monacv avatar monacv commented on May 31, 2024

@mmatl

(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.

XihuaQiao avatar XihuaQiao commented on May 31, 2024

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.
image

from pyrender.

nicolasugrinovic avatar nicolasugrinovic commented on May 31, 2024

@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.

kumar665manjeet avatar kumar665manjeet commented on May 31, 2024

Are you running this over SSH?

I need answer of this problem, can you help...

from pyrender.

HaFred avatar HaFred commented on May 31, 2024

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.

zouyuancc avatar zouyuancc commented on May 31, 2024

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.

kumar665manjeet avatar kumar665manjeet commented on May 31, 2024

I reboot my ssh server, now not able to connect it, showing timeout error

from pyrender.

cleemesser avatar cleemesser commented on May 31, 2024

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.

teymuri avatar teymuri commented on May 31, 2024

Same problem, installed pyglet with pip in a virtual env. Is there any further discussion going on about this?

from pyrender.

toannguyen1904 avatar toannguyen1904 commented on May 31, 2024

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.

sunyuan789 avatar sunyuan789 commented on May 31, 2024

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.

YixuannnL avatar YixuannnL commented on May 31, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.