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

ImportError: libGL.so.1 on CentOS
Asked 1 year, 3 months ago
Active 5 months ago
Viewed 5k times

4

1
When I try to import cv2 in python I get the following error:

ImportError: libGL.so.1: cannot open shared object file: No such file or directory
I found this thread which suggested I install libgl1-mesa-glx, but I’m wondering if that’s only available on Ubuntu because I’m on CentOS and when I try to sudo yum install libgl1-mesa-glx I get No package libgl1-mesa-glx available. Also, when I added the installation to my dockerfile I got this error: The command ‘/bin/sh -c yum install libgl1-mesa-glx’ returned a non-zero code: 1

Then I found what looked like a Fedora solution to the same problem that said to use mesa-libGL-devel. When I sudo yum install mesa-libGL-devel it appears to install correctly, but when I added that to my dockerfile I get The command ‘/bin/sh -c yum install mesa-libGL-devel’ returned a non-zero code: 1.

What else should I try?

EDIT: Here is the Dockerfile:

FROM nvidia/cuda:10.1-cudnn7-devel-centos7

WORKDIR /app/
COPY ./. ./
ENV CONDA_DIR “/opt/conda”
ENV PATH " C O N D A D I R " / b i n : CONDA_DIR"/bin: CONDADIR"/bin:PATH
ONBUILD ENV PATH " C O N D A D I R " / b i n : CONDA_DIR"/bin: CONDADIR"/bin:PATH

RUN
yum -y install epel-release &&
yum -y update &&
yum install -y
bzip2
curl
which
libXext
libSM
libXrender
git
cuda-nvcc-10-1
openssh-server
postgresql-devel
yum clean all && rm -rf /var/cache/yum/*

RUN CONDA_VERSION=“4.5.1” &&
curl -L
https://repo.continuum.io/miniconda/Miniconda3-KaTeX parse error: Expected 'EOF', got '&' at position 49: …o miniconda.sh &̲& \ mkdir -…CONDA_DIR" &&
bash miniconda.sh -f -b -p “KaTeX parse error: Expected 'EOF', got '&' at position 12: CONDA_DIR" &̲& \ echo "e…CONDA_DIR/bin:$PATH” > /etc/profile.d/conda.sh &&
rm miniconda.sh &&
conda config --add channels conda-forge &&
conda update -y conda &&
conda config --set auto_update_conda False &&
pip install --upgrade pip &&
pip install -r requirements.txt &&
rm -rf /root/.cache/pip/* &&
conda install gdal2.4.2 tensorflow-gpu numpy1.16.5

RUN conda env create -f py2_env.yaml
RUN conda env create -f py3_env.yaml

#Add gdal
RUN yum update -y
RUN yum upgrade -y
RUN yum install -y gcc python3-dev python3-pip libxml2-dev libxslt1-dev zlib1g-dev g++

RUN export CPLUS_INCLUDE_PATH=/usr/include/gdal
RUN export C_INCLUDE_PATH=/usr/include/gdal
RUN yum install -y gdal libgdal-dev gdal-devel
#RUN /opt/conda/envs/py2/bin/pip install gdal2.4.2
RUN /opt/conda/envs/py3/bin/pip install gdal
2.4.2

RUN /bin/bash -c “conda init bash && source /root/.bashrc && conda activate py2 && conda install -y notebook ipykernel && ipython kernel install --user && conda deactivate”

RUN /bin/bash -c “conda init bash && source /root/.bashrc && conda activate py3 && conda install -y notebook ipykernel && ipython kernel install --user && conda deactivate”
mesa
Share
Improve this question
Follow
edited Mar 11 '20 at 1:32
asked Mar 11 '20 at 1:27

jss367
2,96744 gold badges4141 silver badges6262 bronze badges
Can you post your entire Dockerfile? – jakub Mar 11 '20 at 1:29
@jakub Yes, I edited my post to include it. – jss367 Mar 11 '20 at 1:33
Add a comment
1 Answer

10

Just add this command:

yum install mesa-libGL
Share

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值