我想从dockerfile创建一个图像。然而,当我在终端中键入代码时,会出现以下错误:
docker build -t image_nlp .
错误:
#9 16.23 WARNING: You are using pip version 19.1.1, however version 21.3.1 is available.
#9 16.23 You should consider upgrading via the 'pip install --upgrade pip' command.
#9 16.23 ----------------------------------------
#9 16.31 ERROR: Command "/usr/local/bin/python /usr/local/lib/python3.6/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-he6rp889/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'"'"''" failed with error code 1 in None
#9 16.33 WARNING: You are using pip version 19.1.1, however version 21.3.1 is available.
#9 16.33 You should consider upgrading via the 'pip install --upgrade pip' command.
------
executor failed running [/bin/sh -c pip install -r requirements.txt]: exit code: 1```
I installed the following libraries:
imblearn==0.0
nltk==3.6.7
openpyxl==3.0.10
openpyxl==3.0.10
pandas==1.1.5
scipy==1.5.4
tqdm==4.64.1
尝试将Dockerfile修改为:
FROM python:3.8-slim-buster
WORKDIR /app
COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt
使用纤薄的buster,它对我有效
或者,您可以安装构建numpy所需的依赖项:
FROM python:3.9
RUN apt-get update && apt-get install -y
libatlas-base-dev
libopenblas-dev
liblapack-dev
gfortran
&& rm -rf /var/lib/apt/lists/*
RUN pip install --no-cache-dir numpy
CMD ["python"]