【问题标题】:Mac: libGL.so.1: cannot open shared object file: No such file or directoryMac:libGL.so.1:无法打开共享对象文件:没有这样的文件或目录
【发布时间】:2021-08-18 06:53:36
【问题描述】:

我正在尝试使用以下 Dockerfile 构建映像:

FROM public.ecr.aws/lambda/python:3.8

COPY app.py requirements.txt __init__.py ./
ADD models models
Add utils utils

RUN python3.8 -m pip install -r requirements.txt -t .

# Command can be overwritten by providing a different command in the template directly.
CMD ["app.lambda_handler"]

要求如下:

-f https://download.pytorch.org/whl/torch_stable.html
torch==1.8.0+cpu

appnope==0.1.0
backcall==0.2.0
certifi==2020.12.5
chardet==4.0.0
colorama==0.4.3
cycler==0.10.0
decorator==4.4.2
docutils==0.15.2
dotmap==1.3.23
idna==2.10
ipython==7.18.1
ipython-genutils==0.2.0
jedi==0.18.0
jmespath==0.10.0
jupyter-client==6.1.7
jupyter-core==4.6.3
kiwisolver==1.3.1
matplotlib==3.4.2
numpy==1.20.3
opencv-python==4.5.2.52
pandas==1.2.4
parso==0.8.0
pexpect==4.8.0
pickleshare==0.7.5
Pillow==8.2.0
pip==21.1.2
prompt-toolkit==3.0.8
ptyprocess==0.6.0
pyasn1==0.4.8
Pygments==2.7.1
pyparsing==2.4.7
python-dateutil==2.8.1
pytz==2021.1
pyzmq==19.0.2
requests==2.25.1
rsa==4.5
scipy==1.6.3
seaborn==0.11.1
setuptools==57.0.0
six==1.16.0
smart-open==5.1.0
tornado==6.0.4
tqdm==4.61.0
traitlets==5.0.5
typing-extensions==3.10.0.0
urllib3==1.26.4
wcwidth==0.2.5
wheel==0.36.2

当我尝试在本地调用时,这会导致标题中提到的错误:

Unable to import module 'app': libGL.so.1: cannot open shared object file: No such file or directory

例如,我在this 线程中找到了有关此问题的帮助,但我找到的所有内容都对应于 linux。在 Mac 上是否有解决此问题的方法?

非常感谢!

【问题讨论】:

  • 我建议你也用docker 标记它。另外,您确定 Linux 的解决方案不适用于您的情况吗?我不确定MacOS上的Docker是如何实现的,但我可以想象它是一个运行Linux代码的适配层。
  • @UlrichEckhardt Docker 是如何实现的并不重要,重要的是映像中的操作系统是什么。 AWS Lambda images for Python 在 Linux 上运行,所以任何 Linux 解决方案都应该这样做,

标签: python macos docker pip


【解决方案1】:

我的问题的解决方法是改用opencv-python-headless headless。

【讨论】:

    猜你喜欢
    • 2021-04-05
    • 2019-08-14
    • 2016-11-23
    • 1970-01-01
    • 2021-07-19
    • 2021-07-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多