首页 > 解决方案 > pip 使用 alpine 映像在 docker 中安装 pandas

问题描述

FROM python:3.9-alpine
RUN pip3 install pandas
RUN pip3 install -U scikit-learn
RUN pip install sqlalchemy
RUN pip install PyMySQL
COPY Movie_Recommendation.py /Movie_Recommendation.py
RUN cat /Movie_Recommendation.py
RUN echo "* * * * * echo hello" | crontab - 

RUN echo "* * * * * python3 /Movie_Recommendation.py" | crontab -

CMD ["crond","-f"]

您好,我正在使用此 dockerfile 使用 cron 运行此文件当我使用另一个图像然后 alpine 它可以运行 python 文件但我不能执行 cron 所以,我正在使用 alpine 但如果我执行 RUN pip3 install pandas 或运行 pip3 安装 -U scikit-learn

当文件运行时,如果我在没有熊猫的情况下运行 dockerfile,它会为熊猫安装出错,它会要求我安装它

错误:

#5 88.03   ERROR: Command errored out with exit status 1: /usr/local/bin/python /usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpck96wudq Check the logs for full command output.
#5 88.03   ----------------------------------------
#5 88.03 ERROR: Command errored out with exit status 1: /usr/local/bin/python /usr/local/lib/python3.9/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-mfrnv78r/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel 'Cython>=0.29.21,<3' 'numpy==1.15.4; python_version=='"'"'3.6'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.15.4; python_version=='"'"'3.7'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.17.3; python_version=='"'"'3.8'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.16.0; python_version=='"'"'3.6'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.16.0; python_version=='"'"'3.7'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.17.3; python_version=='"'"'3.8'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy; python_version>='"'"'3.9'"'"'' Check the logs for full command output.
------
failed to solve with frontend dockerfile.v0: failed to build LLB: executor failed running [/bin/sh -c pip3 install pandas]: runc did not terminate sucessfully  

任何帮助将不胜感激!谢谢!

解决方案:使用此泊坞窗图像: https ://hub.docker.com/r/frolvlad/alpine-python-machinelearning

标签: pythonpandasdockerjupyter-notebookalpine

解决方案


推荐阅读