ImportError: libgthread-2.0.so.0: cannot open shared object file: No such file or directory when importing cv2 using Docker container
ImportError: libgthread-2.0.so.0: cannot open shared object file: No such file or directory when importing cv2 using Docker container
我在本地机器上使用 streamlit、OpenCV 和 Torch 构建了一个网络应用程序。整个项目进展顺利,直到我构建了一个 Docker 文件并将其传输到我的 Google 云平台。谁能告诉我这里到底出了什么问题?
这是我的Docker文件:
FROM pytorch/pytorch:latest
RUN pip install virtualenv
ENV VIRTUAL_ENV=/venv
RUN virtualenv venv -p python3
ENV PATH="VIRTUAL_ENV/bin:$PATH"
WORKDIR /app
ADD . /app
# Install dependencies
RUN pip install -r requirements.txt
# copying all files over
COPY . /app
# Expose port
ENV PORT 8501
# cmd to launch app when container is run
CMD streamlit run app.py
# streamlit-specific commands for config
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
RUN mkdir -p /root/.streamlit
RUN bash -c 'echo -e "\
[general]\n\
email = \"\"\n\
" > /root/.streamlit/credentials.toml'
RUN bash -c 'echo -e "\
[server]\n\
enableCORS = false\n\
" > /root/.streamlit/config.toml'
和requirements.txt:
albumentations==0.4.5
matplotlib==3.2.2
numpy==1.19.0
opencv-python==4.1.0.25
# opencv-python-headless==4.2.0.34
pandas==1.0.5
Pillow==7.1.2
scipy==1.5.0
streamlit==0.62.0
也许,您应该 运行 在 pip
之前执行命令。
apt update
apt-get install -y libglib2.0-0 libsm6 libxrender1 libxext6
我在本地机器上使用 streamlit、OpenCV 和 Torch 构建了一个网络应用程序。整个项目进展顺利,直到我构建了一个 Docker 文件并将其传输到我的 Google 云平台。谁能告诉我这里到底出了什么问题?
这是我的Docker文件:
FROM pytorch/pytorch:latest
RUN pip install virtualenv
ENV VIRTUAL_ENV=/venv
RUN virtualenv venv -p python3
ENV PATH="VIRTUAL_ENV/bin:$PATH"
WORKDIR /app
ADD . /app
# Install dependencies
RUN pip install -r requirements.txt
# copying all files over
COPY . /app
# Expose port
ENV PORT 8501
# cmd to launch app when container is run
CMD streamlit run app.py
# streamlit-specific commands for config
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
RUN mkdir -p /root/.streamlit
RUN bash -c 'echo -e "\
[general]\n\
email = \"\"\n\
" > /root/.streamlit/credentials.toml'
RUN bash -c 'echo -e "\
[server]\n\
enableCORS = false\n\
" > /root/.streamlit/config.toml'
和requirements.txt:
albumentations==0.4.5
matplotlib==3.2.2
numpy==1.19.0
opencv-python==4.1.0.25
# opencv-python-headless==4.2.0.34
pandas==1.0.5
Pillow==7.1.2
scipy==1.5.0
streamlit==0.62.0
也许,您应该 运行 在 pip
之前执行命令。
apt update
apt-get install -y libglib2.0-0 libsm6 libxrender1 libxext6