rasmushaugaard / surfemb

SurfEmb (CVPR 2022)
https://surfemb.github.io/
MIT License
77 stars 17 forks source link

cannot import name 'egl' from 'glcontext' #13

Closed cuccomat closed 2 years ago

cuccomat commented 2 years ago

I have tried to run the Inference Inspection code in my windows machine with the given inference data as proposed in the README but I got the error:

$ python -m surfemb.scripts.infer_debug data/models/tless-2rs64lwh.compact.ckpt --device cpu
loading objects: 0it [00:00, ?it/s]
Traceback (most recent call last):
  File "C:\Users\39331\anaconda3\envs\surfemb\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\39331\anaconda3\envs\surfemb\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\39331\Documenti\Final Year Project\surfemb\surfemb\scripts\infer_debug.py", line 43, in <module>
    renderer = ObjCoordRenderer(objs, res_crop)
  File "C:\Users\39331\Documenti\Final Year Project\surfemb\surfemb\data\renderer.py", line 43, in __init__
    self.ctx = moderngl.create_context(standalone=True, backend='egl', device_index=device_idx)
  File "C:\Users\39331\anaconda3\envs\surfemb\lib\site-packages\moderngl\context.py", line 1619, in create_context
    ctx.mglo, ctx.version_code = mgl.create_context(glversion=require, mode=mode, **settings)
  File "C:\Users\39331\anaconda3\envs\surfemb\lib\site-packages\glcontext\__init__.py", line 49, in get_backend_by_name
    return _egl()
  File "C:\Users\39331\anaconda3\envs\surfemb\lib\site-packages\glcontext\__init__.py", line 106, in _egl
    from glcontext import egl
ImportError: cannot import name 'egl' from 'glcontext' (C:\Users\39331\anaconda3\envs\surfemb\lib\site-packages\glcontext\__init__.py)

I have tried installing OpenGL again but it did not solve the problem, I cannot find any sources for solving the dependency. How would you suggest me to solve it?

rasmushaugaard commented 2 years ago

Hi there, I have only tested the code on Ubuntu. If you are on Windows and still have the problem, I would suggest trying Ubuntu.

smoothumut commented 2 years ago

I have tried installing OpenGL again but it did not solve the problem, I cannot find any sources for solving the dependency. How would you suggest me to solve it?

I have tried the code on ubuntu and it works but on windows I am getting the same error. it looks it is because moderngl cannot create context with "egl" backend on windows. it works on linux but not on windows did you solve the problem on windows, or does anybody know any workaround for this...

Note: removing "egl" backend parameter and using default backend which is "wgl" (according to moderngl package site) creates the context but it gives another error

thanks in advance

meropis commented 2 years ago

If it works on Ubuntu why do you need it to work on Windows?