[Solved] Python Import mmcv Warning: ImportError: libGL.so.1: cannot open shared object file: No such file or directory

ImportError: libGL.so.1: cannot open shared object file: No such file or directory
centos 7.5 Simply install the relevant dependencies.

 yum install mesa-libGL.x86_64
 
 Installed
  mesa-libGL.x86_64 0:18.3.4-12.el7_9

Installed as a dependency:
  libX11.x86_64 0:1.6.7-3.el7_9       libX11-common.noarch 0:1.6.7-3.el7_9         libXau.x86_64 0:1.0.8-2.1.el7
  libXdamage.x86_64 0:1.1.4-4.1.el7   libXext.x86_64 0:1.3.3-3.el7                 libXfixes.x86_64 0:5.0.3-1.el7
  libXxf86vm.x86_64 0:1.1.4-1.el7     libglvnd.x86_64 1:1.0.1-0.8.git5baa1e5.el7   libglvnd-glx.x86_64 1:1.0.1-0.8.git5baa1e5.el7
  libxcb.x86_64 0:1.13-1.el7          libxshmfence.x86_64 0:1.2-1.el7              mesa-libglapi.x86_64 0:18.3.4-12.el7_9

Done!

Ubuntu 20.04 installation:

(mmdet2) root@ubuntuserver:~# apt install libgl1-mesa-glx
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  libdrm-amdgpu1 libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libgl1 libgl1-mesa-dri libglapi-mesa libglvnd0 libglx-mesa0 libglx0
  libllvm12 libpciaccess0 libsensors-config libsensors5 libvulkan1 libwayland-client0 libx11-xcb1 libxcb-dri2-0 libxcb-dri3-0
  libxcb-glx0 libxcb-present0 libxcb-randr0 libxcb-shm0 libxcb-sync1 libxcb-xfixes0 libxfixes3 libxshmfence1 libxxf86vm1
  mesa-vulkan-drivers
Suggested packages:
  lm-sensors
The following NEW packages will be installed:
  libdrm-amdgpu1 libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libgl1 libgl1-mesa-dri libgl1-mesa-glx libglapi-mesa libglvnd0
  libglx-mesa0 libglx0 libllvm12 libpciaccess0 libsensors-config libsensors5 libvulkan1 libwayland-client0 libx11-xcb1
  libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-randr0 libxcb-shm0 libxcb-sync1 libxcb-xfixes0 libxfixes3
  libxshmfence1 libxxf86vm1 mesa-vulkan-drivers
0 upgraded, 30 newly installed, 0 to remove and 127 not upgraded.
Need to get 34.3 MB/34.8 MB of archives.
After this operation, 458 MB of additional disk space will be used.
Do you want to continue?[Y/n] y
...
Setting up libgl1-mesa-glx:amd64 (21.0.3-0ubuntu0.1~20.04.1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...

Try importing again:

(mmdet) [root@node1 ~]# python
Python 3.8.10 (default, Jun  4 2021, 15:09:15)
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import mmcv
>>> exit

Read More: