close

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

Hello Guys, How are you all? Hope You all Are Fine. Today I am just trying to run CV2 but its fail with this error message ImportError: libGL.so.1: cannot open shared object file: No such file or directory in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How ImportError: libGL.so.1: cannot open shared object file: No such file or directory Error Occurs ?

I am just trying to run CV2 but its fail with this error message.

ImportError: libGL.so.1: cannot open shared object file: No such file or directory

How To Solve ImportError: libGL.so.1: cannot open shared object file: No such file or directory Error ?

  1. How To Solve ImportError: libGL.so.1: cannot open shared object file: No such file or directory Error?

    To Solve ImportError: libGL.so.1: cannot open shared object file: No such file or directory Error You just need to add this 2 lines in your Dockerfile RUN apt-get update RUN apt-get install ffmpeg libsm6 libxext6 -y. Second solution is Just Run this command sudo apt update and sudo apt install libgl1-mesa-glx.

  2. ImportError: libGL.so.1: cannot open shared object file: No such file or directory

    To Solve ImportError: libGL.so.1: cannot open shared object file: No such file or directory Error You just need to add this 2 lines in your Dockerfile RUN apt-get update RUN apt-get install ffmpeg libsm6 libxext6 -y. Second solution is Just Run this command sudo apt update and sudo apt install libgl1-mesa-glx.

Solution 1: Just add this line in your Dockerfile

You just need to add this 2 lines in your Dockerfile.

RUN apt-get update
RUN apt-get install ffmpeg libsm6 libxext6  -y

Solution 2: Put this in the Dockerfile

Put this in the Dockerfile

RUN apt-get update && apt-get install -y python3-opencv
RUN pip install opencv-python

Solution 3: Edit your Dockerfile

Edit your Dockerfile.

RUN apt-get update
RUN apt install -y libgl1-mesa-glx

Solution 4: Run this command

Just Run this command.

sudo apt update

sudo apt install libgl1-mesa-glx

Summary

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also, Read

Please Rate Our Solution to Motivate Us For Give Our Best

Leave a Comment