Repository: simpler-env/SimplerEnv
Issue: RuntimeError: vk::PhysicalDevice::createDeviceUnique: ErrorExtensionNotPresent
Root cause: Environment Incompatibility

Hello,
﻿
I encountered an error while running the code from your repository. The error message is as follows:
﻿
RuntimeError: vk::PhysicalDevice::createDeviceUnique: ErrorExtensionNotPresent
﻿
The error occurs after running 10 episodes on all policies. The error is triggered at the following line in the code:
﻿
self._renderer = sapien.SapienRenderer(**renderer_kwargs)
﻿
I have checked the following:
GPU driver is up-to-date.
Vulkan configuration files are present.
All dependencies are correctly installed.
﻿
However, the issue persists. Based on similar issues reported in other projects, it seems this might be related to the Vulkan renderer configuration.
Could you please provide some guidance on how to resolve this error? Any help would be greatly appreciated.
Thank you!

Try `DISPLAY="" CUDA_VISIBLE_DEVICES=0 python {script}`?

> Try `DISPLAY="" CUDA_VISIBLE_DEVICES=0 python {script}`?

Thank you for your reply. Actually, I am using CUDA0 and still have this issue

> Try `DISPLAY="" CUDA_VISIBLE_DEVICES=0 python {script}`?

CUDA_VISIBLE_DEVICES=0 works for me. But why other gpus cannot work?

If you have DISPLAY="" all gpus should work? It's a legacy issue of sapien2.x

Same problem here, I checked the vulkan and nvidia driver, both are ok, after setting 
"
export VK_ICD_FILENAMES=""
export VK_LAYER_PATH=""
export MESA_NO_ACCEL=1
export SVULKAN2_DISABLE=1
export DISPLAY=""
export SAPIEN_RENDERER=cpu
export PYOPENGL_PLATFORM=egl
"
this problem still appears and seems to try display with renderer, how to figure this out?

I also meet this `RuntimeError: vk::PhysicalDevice::createDeviceUnique: ErrorExtensionNotPresent` after eval,

it is same with you . The error occurs after running 10 episodes on all policies 

> If you have DISPLAY="" all gpus should work? It's a legacy issue of sapien2.x


When I use L4,   
DISPLAY="" does not work for me .  CUDA_VISIBLE_DEVICES=0 does not work for me as well . 

When I use A6000. 
I don't need DISPLAY="" or CUDA_VISIBLE_DEVICES=0  .  I don't meet this problem,.  


When I use H100.
DISPLAY="" does not  work for me .  CUDA_VISIBLE_DEVICES=0 does not  work for me as well . 

Chatgpt told me the problem might be Vulkan context / device  maxmium 11. 
1. Properly close the environment after each episode
At the end of every run_maniskill2_eval_single_episode call, manually close the environment by adding:

```
    model.visualize_epoch(predicted_actions, images, save_path=action_path)

    env.close()  # <- Add this line to release Vulkan resources
    return success == "success"
``` 
Put this line at the very end of run_maniskill2_eval_single_episode (after saving the video).

I tried this , but cannot work. 

2. Build the environment once and reuse it across episodes (use reset() instead of rebuilding)
A more advanced solution is:

Build the environment once at the beginning.

Then use reset() to switch between different obj_episode_ids instead of rebuilding the environment every time.

This way, you avoid creating and destroying Vulkan devices repeatedly, saving a lot of resources.

However, your current setup (where each obj_episode_id may have different initialization options) naturally builds a new environment every time.
So for now, this is a more advanced solution you might consider later.

3. Reduce Vulkan/GLFW requirements (disable ray tracing)
If you have enable_raytracing=True set when building the environment, try setting it to False to reduce dependency on Vulkan extensions.
Ray tracing requires special Vulkan extensions that may not be fully available on servers (especially headless servers with no physical display).

You can disable it with:

`--enable-raytracing False`
This will reduce Vulkan extension requirements and may avoid issues like ErrorExtensionNotPresent.


But bridge.sh doesn't have raytracing, so it doesn't work.


I still have not found how to fix it in H100. 


Solved it by following this [doc](https://maniskill.readthedocs.io/en/latest/user_guide/getting_started/installation.html)

> Solved it by following this [doc](https://maniskill.readthedocs.io/en/latest/user_guide/getting_started/installation.html)

Thank you , could you point out which commands are the solution?  
My A6000 is ubuntu22.04,  it shows `E: Unable to locate package vulkan-utils`, but don't have  `RuntimeError: vk::PhysicalDevice::createDeviceUnique: ErrorExtensionNotPresent`
Maybe this solution ? https://github.com/haosulab/SAPIEN/issues/115  


use `vulkan-tools` instead

> use `vulkan-tools` instead

I installed this and  in H100 and it seems make my simpler env totally broken. It hang when create env`    env = build_maniskill2_env(
        env_name,
        **additional_env_build_kwargs,
        **kwargs,
    )` 

And it seems broken some infra function, my libero enviroment also hang 
```
    eval_libero()
  File "/home/user1/anaconda3/envs/vlaoft/lib/python3.10/site-packages/draccus/argparsing.py", line 203, in wrapper_inner
    response = fn(cfg, *args, **kwargs)
    total_episodes, total_successes = run_task(
    success, replay_images, step = run_episode(
    obs, reward, done, info = env.step(action.tolist())  
    return self.env.step(action)
    obs, reward, done, info = super().step(action)
  File "/home/user1/anaconda3/envs/vlaoft/lib/python3.10/site-packages/robosuite/environments/base.py", line 395, in step
    self._update_observables()
  File "/home/user1/anaconda3/envs/vlaoft/lib/python3.10/site-packages/robosuite/environments/base.py", line 324, in _update_observables
    observable.update(timestep=self.model_timestep, obs_cache=self._obs_cache, force=force)
  File "/home/user1/anaconda3/envs/vlaoft/lib/python3.10/site-packages/robosuite/utils/observables.py", line 234, in update
    obs = np.array(self._filter(self._corrupter(self._sensor(obs_cache))))
  File "/home/user1/anaconda3/envs/vlaoft/lib/python3.10/site-packages/robosuite/environments/robot_env.py", line 404, in camera_rgb
    img = self.sim.render(
  File "/home/user1/anaconda3/envs/vlaoft/lib/python3.10/site-packages/robosuite/utils/binding_utils.py", line 1131, in render
    return self._render_context_offscreen.read_pixels(width, height, depth=depth, segmentation=segmentation)
  File "/home/user1/anaconda3/envs/vlaoft/lib/python3.10/site-packages/robosuite/utils/binding_utils.py", line 171, in read_pixels
    mujoco.mjr_readPixels(rgb=rgb_img, depth=depth_img, viewport=viewport, con=self.con)
```

This problem randomly occurs to me. Sometime it works sometimes it does not.

> Hello, ﻿ I encountered an error while running the code from your repository. The error message is as follows: ﻿ RuntimeError: vk::PhysicalDevice::createDeviceUnique: ErrorExtensionNotPresent ﻿ The error occurs after running 10 episodes on all policies. The error is triggered at the following line in the code: ﻿ self._renderer = sapien.SapienRenderer(**renderer_kwargs) ﻿ I have checked the following: GPU driver is up-to-date. Vulkan configuration files are present. All dependencies are correctly installed. ﻿ However, the issue persists. Based on similar issues reported in other projects, it seems this might be related to the Vulkan renderer configuration. Could you please provide some guidance on how to resolve this error? Any help would be greatly appreciated. Thank you!

Check if you have libegl1 install, based on [this post](https://github.com/NVIDIA/nvidia-container-toolkit/issues/191#issuecomment-2022154630), rendering is actually supported by  EGL, not GLX. For me I was having this error in Docker container, and I solved it by 
```
apt install libegl1
``` 

Hi, I met the same issue on A100 SXM 80G, btw I have installed `libegl1`, and I can get messege using `vulkaninfo` normally, I have tried the above method, but they all didn't work for me:(

This error does not appear on other environments but appears only on `move_near_variant_agg`. And for this env, it occurs only after some episodes.

I solved my problem by setting the following:

```
os.environ['DISPLAY'] = '' 
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
os.environ["VK_ICD_FILENAMES"] = '/usr/share/vulkan/icd.d/nvidia_icd.json'
```

The file itself, you can check [here](https://maniskill.readthedocs.io/en/latest/user_guide/getting_started/installation.html). I needed to create it myself 

> This error does not appear on other environments but appears only on `move_near_variant_agg`. And for this env, it occurs only after some episodes.

me too

> This error does not appear on other environments but appears only on `move_near_variant_agg`. And for this env, it occurs only after some episodes.

How do you solve it?

> This error does not appear on other environments but appears only on `move_near_variant_agg`. And for this env, it occurs only after some episodes.

DISPLAY="" CUDA_VISIBLE_DEVICES=0 VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json    
I solved it by this