facebookresearch / habitat-sim

A flexible, high-performance 3D simulator for Embodied AI research.
https://aihabitat.org/
MIT License
2.65k stars 424 forks source link

Platform::WindowlessEglApplication::tryCreateContext(): cannot get default EGL display: EGL_BAD_PARAMETER #1511

Closed robo-alex closed 2 years ago

robo-alex commented 3 years ago

I tried to render data from Replica dataset with python examples/example.py --scene I have installed the Habitat with

conda create -n habitat python=3.6 cmake=3.14.0
conda activate habitat

Then I got the error:

Platform::WindowlessEglApplication::tryCreateContext(): cannot get default EGL display: EGL_BAD_PARAMETER
WindowlessContext: Unable to create windowless context

Could you please help me to solve this issue?

erikwijmans commented 3 years ago

Please run again with export MAGNUM_LOG=verbose MAGNUM_GPU_VALIDATION=ON

robo-alex commented 3 years ago

Please run again with export MAGNUM_LOG=verbose MAGNUM_GPU_VALIDATION=ON

I have tried this. Unfortunately, it seems not to work and the same bugs still exist.

erikwijmans commented 3 years ago

Is there no additional information printed? If so that likely indicates a driver bug or similar.

robo-alex commented 3 years ago

Is there no additional information printed? If so that likely indicates a driver bug or similar.

I tried

python examples/example.py --scene /Replica-Dataset/dataset/apartment_0/habitat/mesh_semantic.ply --save_png --semantic_sensor --max_frame 20

Here is the information printed:

sim_cfg.physics_config_file = ./data/default.physics_config.json
WARNING: Logging before InitGoogleLogging() is written to STDERR
I1003 13:42:57.914039 29584 ManagedFileBasedContainer.h:210] <Dataset>::convertFilenameToPassedExt : Filename : default changed to proposed scene_dataset_config.json filename : default.scene_dataset_config.json
I1003 13:42:57.914077 29584 AttributesManagerBase.h:365] <Dataset>::createFromJsonOrDefaultInternal : Proposing JSON name : default.scene_dataset_config.json from original name : default | This file  does not exist.
I1003 13:42:57.914203 29584 AssetAttributesManager.cpp:120] Asset attributes (capsule3DSolid : capsule3DSolid_hemiRings_4_cylRings_1_segments_12_halfLen_0.75_useTexCoords_false_useTangents_false) created and registered.
I1003 13:42:57.914281 29584 AssetAttributesManager.cpp:120] Asset attributes (capsule3DWireframe : capsule3DWireframe_hemiRings_8_cylRings_1_segments_16_halfLen_1) created and registered.
I1003 13:42:57.914352 29584 AssetAttributesManager.cpp:120] Asset attributes (coneSolid : coneSolid_segments_12_halfLen_1.25_rings_1_useTexCoords_false_useTangents_false_capEnd_true) created and registered.
I1003 13:42:57.914392 29584 AssetAttributesManager.cpp:120] Asset attributes (coneWireframe : coneWireframe_segments_32_halfLen_1.25) created and registered.
I1003 13:42:57.914415 29584 AssetAttributesManager.cpp:120] Asset attributes (cubeSolid : cubeSolid) created and registered.
I1003 13:42:57.914434 29584 AssetAttributesManager.cpp:120] Asset attributes (cubeWireframe : cubeWireframe) created and registered.
I1003 13:42:57.914489 29584 AssetAttributesManager.cpp:120] Asset attributes (cylinderSolid : cylinderSolid_rings_1_segments_12_halfLen_1_useTexCoords_false_useTangents_false_capEnds_true) created and registered.
I1003 13:42:57.914538 29584 AssetAttributesManager.cpp:120] Asset attributes (cylinderWireframe : cylinderWireframe_rings_1_segments_32_halfLen_1) created and registered.
I1003 13:42:57.914566 29584 AssetAttributesManager.cpp:120] Asset attributes (icosphereSolid : icosphereSolid_subdivs_1) created and registered.
I1003 13:42:57.914589 29584 AssetAttributesManager.cpp:120] Asset attributes (icosphereWireframe : icosphereWireframe_subdivs_1) created and registered.
I1003 13:42:57.914623 29584 AssetAttributesManager.cpp:120] Asset attributes (uvSphereSolid : uvSphereSolid_rings_8_segments_16_useTexCoords_false_useTangents_false) created and registered.
I1003 13:42:57.914656 29584 AssetAttributesManager.cpp:120] Asset attributes (uvSphereWireframe : uvSphereWireframe_rings_16_segments_32) created and registered.
I1003 13:42:57.914671 29584 AssetAttributesManager.cpp:108] ::constructor : Built default primitive asset templates : 12
I1003 13:42:57.915589 29584 SceneDatasetAttributesManager.cpp:36] File (default) not found, so new default dataset attributes created and registered.
I1003 13:42:57.915603 29584 MetadataMediator.cpp:127] ::createSceneDataset : Dataset default successfully created.
I1003 13:42:57.915621 29584 AttributesManagerBase.h:365] <Physics Manager>::createFromJsonOrDefaultInternal : Proposing JSON name : ./data/default.physics_config.json from original name : ./data/default.physics_config.json | This file  exists.
I1003 13:42:57.916173 29584 PhysicsAttributesManager.cpp:26] JSON Configuration File (./data/default.physics_config.json) based physics manager attributes created and registered.
I1003 13:42:57.916191 29584 MetadataMediator.cpp:212] ::setActiveSceneDatasetName : Previous active dataset  changed to default successfully.
I1003 13:42:57.916199 29584 MetadataMediator.cpp:183] ::setCurrPhysicsAttributesHandle : Old physics manager attributes  changed to ./data/default.physics_config.json successfully.
I1003 13:42:57.916211 29584 MetadataMediator.cpp:68] ::setSimulatorConfiguration : Set new simulator config for scene/stage : /Replica-Dataset/dataset/apartment_0/habitat/mesh_semantic.ply and dataset : default which is currently active dataset.
Platform::WindowlessEglApplication::tryCreateContext(): cannot get default EGL display: EGL_BAD_PARAMETER
WindowlessContext: Unable to create windowless context

Sorry I am not sure if this if of a driver bug or not.

erikwijmans commented 3 years ago

Likely a driver issue. Headless mode requires a recent(ish) nvidia gpu with nvidia's opengl libraries (those are installed by default with a default driver install).

robo-alex commented 3 years ago

Likely a driver issue. Headless mode requires a recent(ish) nvidia gpu with nvidia's opengl libraries (those are installed by default with a default driver install).

I see. Would you please tell me if there is anything I can do to handle the driver issue? Do I need to install the OpenGL lib manually?

erikwijmans commented 3 years ago

You shouldn't need to manually install them, they are installed as part of a normal driver install

robo-alex commented 3 years ago

You shouldn't need to manually install them, they are installed as part of a normal driver install

I’m still confused because there are nvidia gpus on my cluster. I suppose the libraries are installed by default. But the driver issue still exists.

erikwijmans commented 3 years ago

Possibly not. Others have opened issues here because their cluster admins did not install nvidia's opengl libs. Please talk to them.

robo-alex commented 3 years ago

Possibly not. Others have opened issues here because their cluster admins did not install nvidia's opengl libs. Please talk to them.

Sure. I really appreciate for your help!

aclegg3 commented 2 years ago

This issue seems to be resolved.

jeasinema commented 1 year ago

Just in case someone needs this: here is a solution for those who don't want to use docker and happen to use a server that does not install EGL* along with NVIDIA driver by default. (cross-posted to https://github.com/facebookresearch/habitat-sim/issues/851 as well!)

  1. run nvidia-smi to check the version of your driver

  2. download the driver installation binary from NVIDIA directly. You can do this by searching nvidia driver <version-id> on google. The file should be NVIDIA-Linux-x86_64-<version-id>.run

  3. extract the binary without running. This will create a folder named NVIDIA-Linux-x86_64-<version-id>

    sh NVIDIA-Linux-x86_64-<version-id>.run --extract-only   
  4. create some simlinks

    cd NVIDIA-Linux-x86_64-<version-id>
    ln -s ./libEGL.so.<version-id>  libEGL.so.1 # note: there might be a libEGL_nvidia*, do not symlink it as libEGL.so.1 instead!
    ln -s ./libGL.so.<version> libGL.so.1      
  5. Add this folder to your LD search path

    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/NVIDIA-Linux-x86_64-<version-id>
  6. Check your habitat linker (Thanks @erikwijmans for this!)

    cd
    ldd $(python -c "import habitat_sim; print(habitat_sim._ext.habitat_sim_bindings.__file__)")

    Note that libEGL.so.1, libOpenGL.so.0 and libGLdispatch.so.0 should be all pointed to the ones in /path/to/NVIDIA-Linux-x86_64-<version-id>.

  7. You're good to go! Just follow this to verify your habitat-sim installation.

dhruvbatra commented 1 year ago

Thanks @jeasinema for this. Would you mind sending a PR to add this information to https://github.com/facebookresearch/habitat-sim/blob/main/BUILD_FROM_SOURCE.md#common-build-issues

donggehan commented 1 year ago

@jeasinema Hi, thanks for the information! I'm trying to manually install the missing EGL libraries as you mentioned above. I have driver version 515.105.01 installed (without opengl support). I see in the NVIDIA-Linux-x86_64- folder that there is libEGL_nvidia.so., do I need to symlink this too?

Update: I additionally added the symlink on libEGL_nvidia.so. to libEGL_nvidia.so.0. I can confirm that the method above by @jeasinema works well to resolve the issue (without asking admin to update opengl support). Thanks a lot!

goodstudent9 commented 8 months ago

Just in case someone needs this: here is a solution for those who don't want to use docker and happen to use a server that does not install EGL* along with NVIDIA driver by default. (cross-posted to #851 as well!)

  1. run nvidia-smi to check the version of your driver
  2. download the driver installation binary from NVIDIA directly. You can do this by searching nvidia driver <version-id> on google. The file should be NVIDIA-Linux-x86_64-<version-id>.run
  3. extract the binary without running. This will create a folder named NVIDIA-Linux-x86_64-<version-id>
sh NVIDIA-Linux-x86_64-<version-id>.run --extract-only   
  1. create some simlinks
cd NVIDIA-Linux-x86_64-<version-id>
ln -s ./libEGL.so.<version-id>  libEGL.so.1 # note: there might be a libEGL_nvidia*, do not symlink it as libEGL.so.1 instead!
ln -s ./libGL.so.<version> libGL.so.1      
  1. Add this folder to your LD search path
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/NVIDIA-Linux-x86_64-<version-id>
  1. Check your habitat linker (Thanks @erikwijmans for this!)
cd
ldd $(python -c "import habitat_sim; print(habitat_sim._ext.habitat_sim_bindings.__file__)")

Note that libEGL.so.1, libOpenGL.so.0 and libGLdispatch.so.0 should be all pointed to the ones in /path/to/NVIDIA-Linux-x86_64-<version-id>.

  1. You're good to go! Just follow this to verify your habitat-sim installation.

That seems like I still can not run well. Following is my wrong message. That seems like Ican not use opencv now. Traceback (most recent call last): File "/data5/xrh/navigation/habitat3/habitat-lab/examples/example.py", line 9, in import habitat.gym # noqa: F401 File "/data5/xrh/navigation/habitat3/habitat-lab/habitat-lab/habitat/init.py", line 9, in from habitat.core.benchmark import Benchmark File "/data5/xrh/navigation/habitat3/habitat-lab/habitat-lab/habitat/core/benchmark.py", line 20, in from habitat.core.env import Env File "/data5/xrh/navigation/habitat3/habitat-lab/habitat-lab/habitat/core/env.py", line 32, in from habitat.tasks.registration import make_task File "/data5/xrh/navigation/habitat3/habitat-lab/habitat-lab/habitat/tasks/registration.py", line 28, in _try_register_rearrange_task() File "/data5/xrh/navigation/habitat3/habitat-lab/habitat-lab/habitat/tasks/rearrange/init.py", line 12, in _try_register_rearrange_task import habitat.tasks.rearrange.actions.actions File "/data5/xrh/navigation/habitat3/habitat-lab/habitat-lab/habitat/tasks/rearrange/actions/actions.py", line 17, in from habitat.tasks.rearrange.actions.articulated_agent_action import ( File "/data5/xrh/navigation/habitat3/habitat-lab/habitat-lab/habitat/tasks/rearrange/actions/articulated_agent_action.py", line 2, in from habitat.tasks.rearrange.rearrange_sim import RearrangeSim File "/data5/xrh/navigation/habitat3/habitat-lab/habitat-lab/habitat/tasks/rearrange/rearrange_sim.py", line 35, in from habitat.datasets.rearrange.rearrange_dataset import RearrangeEpisode File "/data5/xrh/navigation/habitat3/habitat-lab/habitat-lab/habitat/datasets/rearrange/rearrange_dataset.py", line 18, in from habitat.datasets.pointnav.pointnav_dataset import PointNavDatasetV1 File "/data5/xrh/navigation/habitat3/habitat-lab/habitat-lab/habitat/datasets/pointnav/pointnav_dataset.py", line 16, in from habitat.tasks.nav.nav import ( File "/data5/xrh/navigation/habitat3/habitat-lab/habitat-lab/habitat/tasks/nav/nav.py", line 42, in from habitat.utils.visualizations import fog_of_war, maps File "/data5/xrh/navigation/habitat3/habitat-lab/habitat-lab/habitat/utils/visualizations/init.py", line 7, in from habitat.utils.visualizations import maps, utils File "/data5/xrh/navigation/habitat3/habitat-lab/habitat-lab/habitat/utils/visualizations/maps.py", line 15, in from habitat.utils.visualizations import utils File "/data5/xrh/navigation/habitat3/habitat-lab/habitat-lab/habitat/utils/visualizations/utils.py", line 20, in cv2 = try_cv2_import() File "/data5/xrh/navigation/habitat3/habitat-lab/habitat-lab/habitat/core/utils.py", line 89, in try_cv2_import import cv2 ImportError: /usr/lib/x86_64-linux-gnu/libGL.so.1: undefined symbol: _glapi_tls_Current Segmentation fault (core dumped)

yhshi9898 commented 5 months ago

Just in case someone needs this: here is a solution for those who don't want to use docker and happen to use a server that does not install EGL* along with NVIDIA driver by default. (cross-posted to #851 as well!)

  1. run nvidia-smi to check the version of your driver
  2. download the driver installation binary from NVIDIA directly. You can do this by searching nvidia driver <version-id> on google. The file should be NVIDIA-Linux-x86_64-<version-id>.run
  3. extract the binary without running. This will create a folder named NVIDIA-Linux-x86_64-<version-id>
sh NVIDIA-Linux-x86_64-<version-id>.run --extract-only   
  1. create some simlinks
cd NVIDIA-Linux-x86_64-<version-id>
ln -s ./libEGL.so.<version-id>  libEGL.so.1 # note: there might be a libEGL_nvidia*, do not symlink it as libEGL.so.1 instead!
ln -s ./libGL.so.<version> libGL.so.1      
  1. Add this folder to your LD search path
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/NVIDIA-Linux-x86_64-<version-id>
  1. Check your habitat linker (Thanks @erikwijmans for this!)
cd
ldd $(python -c "import habitat_sim; print(habitat_sim._ext.habitat_sim_bindings.__file__)")

Note that libEGL.so.1, libOpenGL.so.0 and libGLdispatch.so.0 should be all pointed to the ones in /path/to/NVIDIA-Linux-x86_64-<version-id>.

  1. You're good to go! Just follow this to verify your habitat-sim installation.

That seems like I still can not run well. Following is my wrong message. That seems like Ican not use opencv now. Traceback (most recent call last): File "/data5/xrh/navigation/habitat3/habitat-lab/examples/example.py", line 9, in import habitat.gym # noqa: F401 File "/data5/xrh/navigation/habitat3/habitat-lab/habitat-lab/habitat/init.py", line 9, in from habitat.core.benchmark import Benchmark File "/data5/xrh/navigation/habitat3/habitat-lab/habitat-lab/habitat/core/benchmark.py", line 20, in from habitat.core.env import Env File "/data5/xrh/navigation/habitat3/habitat-lab/habitat-lab/habitat/core/env.py", line 32, in from habitat.tasks.registration import make_task File "/data5/xrh/navigation/habitat3/habitat-lab/habitat-lab/habitat/tasks/registration.py", line 28, in _try_register_rearrange_task() File "/data5/xrh/navigation/habitat3/habitat-lab/habitat-lab/habitat/tasks/rearrange/init.py", line 12, in _try_register_rearrange_task import habitat.tasks.rearrange.actions.actions File "/data5/xrh/navigation/habitat3/habitat-lab/habitat-lab/habitat/tasks/rearrange/actions/actions.py", line 17, in from habitat.tasks.rearrange.actions.articulated_agent_action import ( File "/data5/xrh/navigation/habitat3/habitat-lab/habitat-lab/habitat/tasks/rearrange/actions/articulated_agent_action.py", line 2, in from habitat.tasks.rearrange.rearrange_sim import RearrangeSim File "/data5/xrh/navigation/habitat3/habitat-lab/habitat-lab/habitat/tasks/rearrange/rearrange_sim.py", line 35, in from habitat.datasets.rearrange.rearrange_dataset import RearrangeEpisode File "/data5/xrh/navigation/habitat3/habitat-lab/habitat-lab/habitat/datasets/rearrange/rearrange_dataset.py", line 18, in from habitat.datasets.pointnav.pointnav_dataset import PointNavDatasetV1 File "/data5/xrh/navigation/habitat3/habitat-lab/habitat-lab/habitat/datasets/pointnav/pointnav_dataset.py", line 16, in from habitat.tasks.nav.nav import ( File "/data5/xrh/navigation/habitat3/habitat-lab/habitat-lab/habitat/tasks/nav/nav.py", line 42, in from habitat.utils.visualizations import fog_of_war, maps File "/data5/xrh/navigation/habitat3/habitat-lab/habitat-lab/habitat/utils/visualizations/init.py", line 7, in from habitat.utils.visualizations import maps, utils File "/data5/xrh/navigation/habitat3/habitat-lab/habitat-lab/habitat/utils/visualizations/maps.py", line 15, in from habitat.utils.visualizations import utils File "/data5/xrh/navigation/habitat3/habitat-lab/habitat-lab/habitat/utils/visualizations/utils.py", line 20, in cv2 = try_cv2_import() File "/data5/xrh/navigation/habitat3/habitat-lab/habitat-lab/habitat/core/utils.py", line 89, in try_cv2_import import cv2 ImportError: /usr/lib/x86_64-linux-gnu/libGL.so.1: undefined symbol: _glapi_tls_Current Segmentation fault (core dumped)

Hello, I encountered the same issue as you. Did you manage to resolve it? Thank you!