xiangyanfei212 / RMBench-2022

In this work, we present RMBench, the first benchmark for robotic manipulations, which have high-dimensional continuous action and state spaces. We implement and evaluate reinforcement learning algorithms that directly use observed pixels as inputs.
8 stars 1 forks source link

OpenGL.error.NullFunctionError: Attempt to call an undefined function OSMesaCreateContextExt, check for bool(OSMesaCreateContextExt) before calling #1

Open dilshan-dev opened 1 year ago

dilshan-dev commented 1 year ago

Hello, I tried to run the experiment using python vpg_train.py task=reach_site and I get the following error.

/home/acar/anaconda3/envs/rmb1/lib/python3.9/site-packages/torch/utils/tensorboard/init.py:3: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead. if not hasattr(tensorboard, 'version') or LooseVersion(tensorboard.version) < LooseVersion('1.15'): /home/acar/anaconda3/envs/rmb1/lib/python3.9/site-packages/torch/utils/tensorboard/init.py:3: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead. if not hasattr(tensorboard, 'version') or LooseVersion(tensorboard.version) < LooseVersion('1.15'): ic| cfg: {'task_name': 'reach_site', 'seed': 3, 'device': 'cuda', 'gpu_id': 2, 'save_video': True, 'use_tb': False, 'episodes': 200, 'steps_per_episode': 2000, 'max_ep_len': 500, 'lr_actor': 0.0003, 'lr_critic': 0.001, 'train_v_iters': 80, 'save_freq': 10, 'gamma': 0.99, 'lam': 0.95, 'experiment': 'exp', 'obs_dim': '???', 'act_dim': '???', 'hidden_dim_1': 512, 'hidden_dim_2': 256, 'hidden_dim_3': 128} workspace: /home/acar/Documents/RMBench-2022/01_VPG/exp_local/reach_site_seed_3/2023.03.01_130720 Init a log at /home/acar/Documents/RMBench-2022/01_VPG/exp_local/reach_site_seed_3/2023.03.01_130720 output_file: <_io.TextIOWrapper name='/home/acar/Documents/RMBench-2022/01_VPG/exp_local/reach_site_seed_3/2023.03.01_130720/progress.txt' mode='a' encoding='UTF-8'> seed: 3 device: cuda:2

Init environment: reach_site ic| domain: 'reach', task: 'site' ic| name: 'reach_site_vision' Error executing job with overrides: ['task=reach_site'] Traceback (most recent call last): File "/home/acar/Documents/RMBench-2022/01_VPG/vpg_train.py", line 296, in main env = dmc.make(name = cfg.task_name, File "/home/acar/Documents/RMBench-2022/01_VPG/../dmc.py", line 248, in make env = manipulation.load(name, seed=seed) File "/home/acar/anaconda3/envs/rmb1/lib/python3.9/site-packages/dm_control/manipulation/init.py", line 76, in load return _composer.Environment(task, time_limit=time_limit, random_state=seed) File "/home/acar/anaconda3/envs/rmb1/lib/python3.9/site-packages/dm_control/composer/environment.py", line 324, in init super().init( File "/home/acar/anaconda3/envs/rmb1/lib/python3.9/site-packages/dm_control/composer/environment.py", line 221, in init self._recompile_physics_and_update_observables() File "/home/acar/anaconda3/envs/rmb1/lib/python3.9/site-packages/dm_control/composer/environment.py", line 243, in _recompile_physics_and_update_observables self._observation_updater.reset(self._physics_proxy, self._random_state) File "/home/acar/anaconda3/envs/rmb1/lib/python3.9/site-packages/dm_control/composer/observation/updater.py", line 165, in reset enabled.observation_callable()) File "/home/acar/anaconda3/envs/rmb1/lib/python3.9/site-packages/dm_control/composer/observation/observable/mjcf.py", line 242, in get_observation pixels = physics.render( File "/home/acar/anaconda3/envs/rmb1/lib/python3.9/site-packages/dm_control/mujoco/engine.py", line 206, in render camera = Camera( File "/home/acar/anaconda3/envs/rmb1/lib/python3.9/site-packages/dm_control/mujoco/engine.py", line 675, in init if self._physics.contexts.mujoco is not None: File "/home/acar/anaconda3/envs/rmb1/lib/python3.9/site-packages/dm_control/mujoco/engine.py", line 514, in contexts self._make_rendering_contexts() File "/home/acar/anaconda3/envs/rmb1/lib/python3.9/site-packages/dm_control/mujoco/engine.py", line 497, in _make_rendering_contexts render_context = _render.Renderer( File "/home/acar/anaconda3/envs/rmb1/lib/python3.9/site-packages/dm_control/_render/base.py", line 63, in init ctx.call(self._platform_init, max_width, max_height) File "/home/acar/anaconda3/envs/rmb1/lib/python3.9/site-packages/dm_control/_render/executor/render_executor.py", line 194, in call return self._call_locked(func, *args, kwargs) File "/home/acar/anaconda3/envs/rmb1/lib/python3.9/site-packages/dm_control/_render/executor/render_executor.py", line 204, in _call_locked return self._executor.submit(func, *args, *kwargs).result() File "/home/acar/anaconda3/envs/rmb1/lib/python3.9/concurrent/futures/_base.py", line 446, in result return self.get_result() File "/home/acar/anaconda3/envs/rmb1/lib/python3.9/concurrent/futures/_base.py", line 391, in get_result raise self._exception File "/home/acar/anaconda3/envs/rmb1/lib/python3.9/concurrent/futures/thread.py", line 58, in run result = self.fn(self.args, self.kwargs) File "/home/acar/anaconda3/envs/rmb1/lib/python3.9/site-packages/dm_control/_render/pyopengl/osmesa_renderer.py", line 49, in _platform_init self._context = osmesa.OSMesaCreateContextExt( File "/home/acar/anaconda3/envs/rmb1/lib/python3.9/site-packages/OpenGL/platform/baseplatform.py", line 423, in call raise error.NullFunctionError( OpenGL.error.NullFunctionError: Attempt to call an undefined function OSMesaCreateContextExt, check for bool(OSMesaCreateContextExt) before calling

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace. Error in atexit._run_exitfuncs: Traceback (most recent call last): File "/home/acar/anaconda3/envs/rmb1/lib/python3.9/site-packages/dm_control/_render/executor/render_executor.py", line 212, in terminate self._call_locked(cleanup_callable) File "/home/acar/anaconda3/envs/rmb1/lib/python3.9/site-packages/dm_control/_render/executor/render_executor.py", line 204, in _call_locked return self._executor.submit(func, *args, *kwargs).result() File "/home/acar/anaconda3/envs/rmb1/lib/python3.9/concurrent/futures/thread.py", line 167, in submit raise RuntimeError('cannot schedule new futures after shutdown') RuntimeError: cannot schedule new futures after shutdown Exception ignored in: <function ContextBase.del at 0x7fa541fab160> Traceback (most recent call last): File "/home/acar/anaconda3/envs/rmb1/lib/python3.9/site-packages/dm_control/_render/base.py", line 115, in del self._free_unconditionally() File "/home/acar/anaconda3/envs/rmb1/lib/python3.9/site-packages/dm_control/_render/base.py", line 112, in _free_unconditionally self._render_executor.terminate(self._free_on_executor_thread) File "/home/acar/anaconda3/envs/rmb1/lib/python3.9/site-packages/dm_control/_render/executor/render_executor.py", line 212, in terminate self._call_locked(cleanup_callable) File "/home/acar/anaconda3/envs/rmb1/lib/python3.9/site-packages/dm_control/_render/executor/render_executor.py", line 204, in _call_locked return self._executor.submit(func, args, **kwargs).result() File "/home/acar/anaconda3/envs/rmb1/lib/python3.9/concurrent/futures/thread.py", line 167, in submit raise RuntimeError('cannot schedule new futures after shutdown') RuntimeError: cannot schedule new futures after shutdown

I tried various solutions related to PyOpenGL and osmesa but I couldn't resolve it. I am using Ubuntu 22.04 and I created a conda env with the packages. The same error is present when running with other algorithms such as SAC and DrQv2. Any help that can be offered is much appreciated. Thank you!

xiangyanfei212 commented 1 year ago

Hello,

This issue may be caused by openGL not being installed properly.

The MuJoCo Python bindings support three different OpenGL rendering backends: EGL (headless, hardware-accelerated), GLFW (windowed, hardware-accelerated), and OSMesa (purely software-based). At least one of these three backends must be available in order render through dm_control.

GLEW: http://glew.sourceforge.net/ http://glew.sourceforge.net/ The OpenGL Extension Wrangler Library (GLEW) is a cross-platform open-source C/C++ extension loading library.

Mesa: https://anaconda.org/conda-forge/mesalib https://anaconda.org/conda-forge/mesalib The Mesa project began as an open-source implementation of the OpenGL https://www.opengl.org/ specification - a system for rendering interactive 3D graphics. Mesa is an open-source implementation of the OpenGL specification - a system for rendering interactive 3D graphics.

GLFW GLFW is an Open Source, multi-platform library for OpenGL, OpenGL ES and Vulkan development on the desktop. It provides a simple API for creating windows, contexts and surfaces, receiving input and events.

Here are installation instructions that may be helpful https://github.com/openai/mujoco-py/issues/627#issuecomment-1007658905 https://github.com/openai/mujoco-py/issues/627#issuecomment-1007658905

Best regards

On Mar 1, 2023, at 10:20, dilshan-dev @.***> wrote:

Any help that can be offered is much appreciated

dilshan-dev commented 1 year ago

Hello, Thank you for your reply. Actually I have done a clean installation of the OS (after the error occurred) and I have tried dm_control and DrQv2 (repo) separately, which work fine (earlier dm_control did not work in the base system and DrQv2 did not work with conda).

I then came back to this repository and in the conda env I separately installed all three backends with the use of your reply, and when I run the experiment I am faced with the following error.

Traceback (most recent call last): File "/home/acar/Documents/RMBench-2022/00_DrQv2/drqv2_train.py", line 24, in import dmc File "/home/acar/Documents/RMBench-2022/00_DrQv2/../dmc.py", line 11, in from dm_control import manipulation, suite File "/home/acar/anaconda3/envs/rmb/lib/python3.9/site-packages/dm_control/manipulation/init.py", line 20, in from dm_control import composer as _composer File "/home/acar/anaconda3/envs/rmb/lib/python3.9/site-packages/dm_control/composer/init.py", line 18, in from dm_control.composer.arena import Arena File "/home/acar/anaconda3/envs/rmb/lib/python3.9/site-packages/dm_control/composer/arena.py", line 20, in from dm_control import mjcf File "/home/acar/anaconda3/envs/rmb/lib/python3.9/site-packages/dm_control/mjcf/init.py", line 18, in from dm_control.mjcf.attribute import Asset File "/home/acar/anaconda3/envs/rmb/lib/python3.9/site-packages/dm_control/mjcf/attribute.py", line 28, in from dm_control.mujoco.wrapper import util File "/home/acar/anaconda3/envs/rmb/lib/python3.9/site-packages/dm_control/mujoco/init.py", line 18, in from dm_control.mujoco.engine import action_spec File "/home/acar/anaconda3/envs/rmb/lib/python3.9/site-packages/dm_control/mujoco/engine.py", line 41, in from dm_control import _render File "/home/acar/anaconda3/envs/rmb/lib/python3.9/site-packages/dm_control/_render/init.py", line 67, in Renderer = import_func() # pylint: disable=invalid-name File "/home/acar/anaconda3/envs/rmb/lib/python3.9/site-packages/dm_control/_render/init.py", line 46, in _import_osmesa from dm_control._render.pyopengl.osmesa_renderer import OSMesaContext File "/home/acar/anaconda3/envs/rmb/lib/python3.9/site-packages/dm_control/_render/pyopengl/osmesa_renderer.py", line 35, in from OpenGL import GL File "/home/acar/anaconda3/envs/rmb/lib/python3.9/site-packages/OpenGL/GL/init.py", line 4, in from OpenGL.GL.VERSION.GL_1_1 import File "/home/acar/anaconda3/envs/rmb/lib/python3.9/site-packages/OpenGL/GL/VERSION/GL_1_1.py", line 14, in from OpenGL.raw.GL.VERSION.GL_1_1 import File "/home/acar/anaconda3/envs/rmb/lib/python3.9/site-packages/OpenGL/raw/GL/VERSION/GL_1_1.py", line 7, in from OpenGL.raw.GL import _errors File "/home/acar/anaconda3/envs/rmb/lib/python3.9/site-packages/OpenGL/raw/GL/_errors.py", line 4, in _error_checker = _ErrorChecker( _p, _p.GL.glGetError ) AttributeError: 'NoneType' object has no attribute 'glGetError'

I faced this error before as well and I sidestepped it with the instructions given in https://github.com/MPI-IS/mesh/issues/23#issuecomment-770860939, which then lead to the error I first mentioned.

When I do the same now, I am still faced with the initial error. Any further help you can offer is highly appreciated.

Thank you!

xiangyanfei212 commented 1 year ago

Hello,

Please note this issue:

File "/home/acar/Documents/RMBench-2022/00_DrQv2/drqv2_train.py", line 24, in import dmc File "/home/acar/Documents/RMBench-2022/00_DrQv2/../dmc.py", line 11, in from dm_control import manipulation, suite

This seems to be a problem with dm_control. But you mentioned that dm_control works fine. I have no idea with this.

Please make sure that dm_control is running properly and that the openGL related packages are installed.

Best regards.

On Mar 2, 2023, at 13:31, dilshan-dev @.***> wrote:

dm_control

dilshan-dev commented 1 year ago

Hello,

Thank you for your reply.

I was able to proceed without errors and run the experiments by using GLFW instead of OSMesa (setting os.environ['MUJOCO_GL'] = 'glfw' instead of os.environ['MUJOCO_GL'] = 'osmesa' in the [ALGORITHM_NAME].py file).

I also had to change the gpu_id: to 0 (in my case) in config.yaml file under /[ALGORITHM_FOLDER]/cfgs/.

Many thanks for your prompt replies and for making this work available.

Cheers.

xiangyanfei212 commented 1 year ago

You're welcome, I'm glad to be of help.

Best regards.

On Mar 6, 2023, at 08:28, dilshan-dev @.***> wrote:

Hello,

Thank you for your reply.

I was able to proceed without errors and run the experiments by using GLFW instead of OSMesa (setting os.environ['MUJOCO_GL'] = 'glfw' instead of os.environ['MUJOCO_GL'] = 'osmesa' in the [ALGORITHM_NAME].py file).

I also had to change the gpu_id: to 0 (in my case) in config.yaml file under /[ALGORITHM_FOLDER]/cfgs/.

Many thanks for your prompt replies and for making this work available.

Cheers.

— Reply to this email directly, view it on GitHub https://github.com/xiangyanfei212/RMBench-2022/issues/1#issuecomment-1455265646, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQY4HQTC6KVZT5C4UNBQVRLW2UVTZANCNFSM6AAAAAAVLO4RVM. You are receiving this because you commented.