【发布时间】:2021-07-24 16:43:03
【问题描述】:
我正在尝试使用 alpine 在 docker 映像中安装 apache-airflow,docker 文件如下:
FROM python:3.9.5-alpine3.13
WORKDIR /usr/app
RUN pip install pipenv
COPY Pipfile* ./
RUN apk add --no-cache libressl-dev musl-dev libffi-dev libressl-dev musl-dev libffi-dev gcc build-base
RUN apk add gcc musl-dev libffi-dev openssl-dev python3-dev
RUN apk update && apk add libressl-dev postgresql-dev libffi-dev gcc musl-dev python3-dev
RUN pipenv install --system --deploy --ignore-pipfile
RUN airflow db init
RUN airflow users create --username admin --password admin --firstname Anonymous --lastname Admin --role Admin --email admin@example.org
RUN cp dags ~/airflow/dags/
RUN airflow webserver
RUN airflow scheduler
COPY ./src ./src
COPY ./src/.env.docker ./src/.env
CMD ["python3", "src/main.py"]
但是当我执行时出现以下错误:
安装密码学时出错==3.4.7; python_version >= '3.6' --hash=sha256:3d10de8116d25649631977cb37da6c
我尝试解决安装另外很多库但我仍然无法安装任何想法?
编辑
alpine需要安装rust,但是那个alpine有旧版本。
编辑 2
像这样更新 docker 文件后:
FROM python:3.9.6-alpine3.14
WORKDIR /usr/app
RUN pip install pipenv
COPY Pipfile* ./
RUN apk add --no-cache gcc musl-dev python3-dev libffi-dev openssl-dev cargo
RUN pipenv install --system --deploy --ignore-pipfile
RUN airflow db init
RUN airflow users create --username admin --password admin --firstname Anonymous --lastname Admin --role Admin --email admin@example.org
RUN cp dags ~/airflow/dags/
RUN airflow webserver
RUN airflow scheduler
COPY ./src ./src
COPY ./src/.env.docker ./src/.env
CMD ["python3", "src/main.py"]
我收到以下错误:
[pipenv.exceptions.InstallError]:收集熊猫==1.3.0 [pipenv.exceptions.InstallError]:使用缓存的 pandas-1.3.0.tar.gz (4.7 MB) [pipenv.exceptions.InstallError]:错误:命令错误 退出状态为 1:[pipenv.exceptions.InstallError]:
命令:/usr/local/bin/python -c 'import io, os, sys, setuptools, 标记化; sys.argv[0] = '"'"'/tmp/pip-install-lfncf2u8/pandas_6f9f84af90264ff59c98fca45e89ed74/setup.py'"'"'; 文件='"'"'/tmp/pip-install-lfncf2u8/pandas_6f9f84af90264ff59c98fca45e89ed74/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO( '"'"'从 setuptools 导入 设置; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-s8ljky3j [pipenv.exceptions.InstallError]:cwd: /tmp/pip-install-lfncf2u8/pandas_6f9f84af90264ff59c98fca45e89ed74/ [pipenv.exceptions.InstallError]:完整输出(7 行): [pipenv.exceptions.InstallError]:回溯(最近调用 最后):[pipenv.exceptions.InstallError]:文件“”,行 1、在[pipenv.exceptions.InstallError]:文件中 "/tmp/pip-install-lfncf2u8/pandas_6f9f84af90264ff59c98fca45e89ed74/setup.py", 第 650 行,在 [pipenv.exceptions.InstallError]:
ext_modules=maybe_cythonize(扩展, compiler_directives=directives), [pipenv.exceptions.InstallError]:
文件 "/tmp/pip-install-lfncf2u8/pandas_6f9f84af90264ff59c98fca45e89ed74/setup.py", 第 414 行,在 maybe_cythonize [pipenv.exceptions.InstallError] 中:
raise RuntimeError("Cannot cythonize without Cython installed.") [pipenv.exceptions.InstallError]:RuntimeError:无法 cythonize 没有安装 Cython。
谢谢
【问题讨论】:
标签: python airflow alpine pipenv