Repository: pytorch/benchmark
Issue: cannot import libGL.so.1 
Root cause: Environment Incompatibility

I was running the benchmark from a remote server. and encountered this error. 

```
$ python run.py
........EEEEEEsEs.sEsEsEEEEEEEEEs.sssEsE...E.E.E...........E.E.E...s.EssssssssssEEEEEEEEsEsEsEsEsEsEsEsEsEsEsEsEsEsEsEsEsEsEsEsEsEsEsEsEsEsEsEsEsEsEsEsEsEsEsEsEsEsEsEsEsEsEsEsE........sEsEsEsEsEsEsEsE...E.E......ss.s...........E.E.E...E.E.EE.s.s.s.s.s.s.s.s.......................................................s.s.sss........................ss............ssss........ssssssss...E.E...E.E.Ess...E.E.E...E.E.E...E.E.Es.sEsEsE...........E.E.Essssssss...E.E.E......ss......ss......sss.sEsEsE...E.E.Essss.......E.E.E...E.E.E...E.E.E...E.E.E...E.E.E.s.s.s.s...E.E.E........s.s.s.s....E.Essssssssssssssssss...E.E.E...E.Ess...E.E.E...E.E.E...E.E.s.sEsEs.E...E.E.EEEEEEEEE...........E.E.E...E.E.EEEEEEEsE
======================================================================
ERROR: test_Background_Matting_check_device_cpu (__main__.TestBenchmark)
----------------------------------------------------------------------
components._impl.workers.subprocess_rpc.ChildTraceException: Traceback (most recent call last):
  File "/home/user/try/benchmark/components/_impl/workers/subprocess_rpc.py", line 482, in _run_block
    exec(  # noqa: P204
  File "<subprocess-worker>", line 44, in <module>
  File "<subprocess-worker>", line 14, in _run_in_worker_f
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/user/try/benchmark/torchbenchmark/models/Background_Matting/__init__.py", line 10, in <module>
    from .data_loader import VideoData
  File "/home/user/try/benchmark/torchbenchmark/models/Background_Matting/data_loader.py", line 11, in <module>
    import random, os, cv2
  File "/home/user/try/env/lib/python3.10/site-packages/cv2/__init__.py", line 181, in <module>
    bootstrap()
  File "/home/user/try/env/lib/python3.10/site-packages/cv2/__init__.py", line 153, in bootstrap
    native_module = importlib.import_module("cv2")
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: libGL.so.1: cannot open shared object file: No such file or directory

    working_dir: /tmp/tmpaajuk6ne
    stdout:
        [2023-04-06] 20:24:39.819561: TIMER_SUBPROCESS_BEGIN_EXEC
        [2023-04-06] 20:24:40.426099: TIMER_SUBPROCESS_FAILED
        [2023-04-06] 20:24:40.426141: TIMER_SUBPROCESS_FINISHED
        [2023-04-06] 20:24:40.426149: TIMER_SUBPROCESS_BEGIN_READ

    stderr:


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/user/try/benchmark/test.py", line 111, in check_device_fn
    task = ModelTask(path, timeout=TIMEOUT)
  File "/home/user/try/benchmark/torchbenchmark/__init__.py", line 265, in __init__
    **self._maybe_import_model(
  File "/home/user/try/benchmark/components/_impl/tasks/base.py", line 273, in inner
    self.worker.run(src)
  File "/home/user/try/benchmark/components/_impl/workers/subprocess_worker.py", line 155, in run
    self._run(snippet)
  File "/home/user/try/benchmark/components/_impl/workers/subprocess_worker.py", line 320, in _run
    subprocess_rpc.SerializedException.raise_from(
  File "/home/user/try/benchmark/components/_impl/workers/subprocess_rpc.py", line 458, in raise_from
    raise e from ChildTraceException(traceback_str)
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
```

which libGL library should be installed to fix this error?

Could you run the [following command](https://stackoverflow.com/questions/55313610/importerror-libgl-so-1-cannot-open-shared-object-file-no-such-file-or-directo) to locate libgl.so?

```
ldconfig -p | grep libGL.so.1
```


Here is the list of packages we installed in our docker image: https://github.com/pytorch/benchmark/blob/main/docker/gcp-a100-runner-dind.dockerfile#L10

`libGL.so.1` should be provided by  libgl1-mesa-glx.

> Could you run the [following command](https://stackoverflow.com/questions/55313610/importerror-libgl-so-1-cannot-open-shared-object-file-no-such-file-or-directo) to locate libgl.so?
> 
> ```
> ldconfig -p | grep libGL.so.1
> ```


thanks for this suggestion to identify the problem. I couldn't find anything with this command unfortunately. Guess my libgl.so was not installed. After installing libgl1-mesa-glx suggested by @xuzhao9 it seems to be available now.

```
$ ldconfig -p | grep libGL.so.1
libGL.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libGL.so.1
```

cc @dany-nonstop  Can we close this issue now?

yes thanks for the help it can be closed.

> cc @dany-nonstop Can we close this issue now?