- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我正在尝试创建一个 Docker 镜像。Dockerfile 如下:
# Use the official Python 3.6.5 image
FROM python:3.6.5-alpine3.7
# Set the working directory to /app
WORKDIR /app
# Get the
COPY requirements.txt /app
RUN pip3 install --no-cache-dir -r requirements.txt
# Configuring access to Jupyter
RUN mkdir /notebooks
RUN jupyter notebook --no-browser --ip 0.0.0.0 --port 8888 /notebooks
requirements.txt 文件是:
jupyter
numpy==1.14.3
pandas==0.23.0rc2
scipy==1.0.1
scikit-learn==0.19.1
pillow==5.1.1
matplotlib==2.2.2
seaborn==0.8.1
运行命令 docker build -t standard .
在 docker 尝试安装 pandas 时给我一个错误。错误如下:
Collecting pandas==0.23.0rc2 (from -r requirements.txt (line 3))
Downloading https://files.pythonhosted.org/packages/46/5c/a883712dad8484ef907a2f42992b122acf2bcecbb5c2aa751d1033908502/pandas-0.23.0rc2.tar.gz (12.5MB)
Complete output from command python setup.py egg_info:
/bin/sh: svnversion: not found
/bin/sh: svnversion: not found
non-existing path in 'numpy/distutils': 'site.cfg'
Could not locate executable gfortran
... (loads of other stuff)
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-xb6f6a5o/pandas/
The command '/bin/sh -c pip3 install --no-cache-dir -r requirements.txt' returned a non-zero code: 1
当我尝试安装较低版本的 pandas==0.22.0 时,出现此错误:
Step 5/7 : RUN pip3 install --no-cache-dir -r requirements.txt
---> Running in 5810ea896689
Collecting jupyter (from -r requirements.txt (line 1))
Downloading https://files.pythonhosted.org/packages/83/df/0f5dd132200728a86190397e1ea87cd76244e42d39ec5e88efd25b2abd7e/jupyter-1.0.0-py2.py3-none-any.whl
Collecting numpy==1.14.3 (from -r requirements.txt (line 2))
Downloading https://files.pythonhosted.org/packages/b0/2b/497c2bb7c660b2606d4a96e2035e92554429e139c6c71cdff67af66b58d2/numpy-1.14.3.zip (4.9MB)
Collecting pandas==0.22.0 (from -r requirements.txt (line 3))
Downloading https://files.pythonhosted.org/packages/08/01/803834bc8a4e708aedebb133095a88a4dad9f45bbaf5ad777d2bea543c7e/pandas-0.22.0.tar.gz (11.3MB)
Could not find a version that satisfies the requirement Cython (from versions: )
No matching distribution found for Cython
The command '/bin/sh -c pip3 install --no-cache-dir -r requirements.txt' returned a non-zero code: 1
我还尝试在 pandas 之前安装 Cyphon 和 setuptools,但它在 pip3 install pandas 行给出了相同的 No matching distribution found for Cython
错误。
我怎样才能安装 pandas。
最佳答案
我意识到这个问题已经得到解答,但我最近遇到了一个类似的问题,即 numpy 和 pandas 依赖于一个 dockerized 项目。话虽这么说,但我希望这对将来的某个人有所帮助。
我的解决方案:
正如 Aviv Sela 指出的那样, Alpine 默认不包含构建工具,需要通过 Dockerfile 添加。因此,请参阅下面我的 Dockerfile,其中包含 numpy 和 pandas 成功安装在容器的 Alpine 上所需的构建包。
FROM python:3.6-alpine3.7
RUN apk add --no-cache --update \
python3 python3-dev gcc \
gfortran musl-dev g++ \
libffi-dev openssl-dev \
libxml2 libxml2-dev \
libxslt libxslt-dev \
libjpeg-turbo-dev zlib-dev
RUN pip install --upgrade pip
ADD requirements.txt .
RUN pip install -r requirements.txt
需求.txt
numpy==1.17.1
pandas==0.25.1
编辑:
在升级 pip RUN 命令之前,将以下内容(下面的代码片段)添加到 Dockerfile。正如 Bishwas Mishra 所指出的,这对成功安装 pandas 至关重要。在评论中。
RUN pip install --upgrade cython
关于python - 在 Dockerfile 中安装 pandas,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50190676/
我正在尝试使用谷歌云构建触发器来构建我的 docker 容器。不幸的是,构建没有找到我的 docker 文件。它不在我的存储库的根目录中,但我认为我可以指定一个相对路径。显然我配置错误了。下面是我的
我可以像这样构建一个 Dockerfile docker build -t deepak/ruby . 但是对于一个不名为Dockerfile的Dockerfile # DOCKER-VERSION
是否可以命名构建阶段?我正在搜索类似以下示例的内容: ARG NAME FROM python:3.7-alpine as modul-${NAME} # ... 如果我尝试这个例子,就会发生这个错误
在我的 Dockerfile 中,我需要使用命令替换来添加一些环境变量。我想设置 ENV PYTHONPATH /usr/local/$(python3 -c 'from distutils impo
以下Dockerfile包含四个COPY层: COPY README.md ./ COPY package.json ./ COPY gulpfile.js ./ COPY __BUILD_NUMBE
我正在尝试从我创建的 Dockerfile 中拉取 tomcat,并使用以下命令拉取 centos: FROM centos RUN docker run -it tomcat 然后现在我正在创建一个
我不确定是否应该为我的 Node.js 应用程序创建不同的 Dockerfile 文件。一种用于没有开发依赖项的生产,另一种用于包含开发依赖项的测试。 或者一个基本上是开发Dockerfile.dev
我拥有的是多个相似且简单的dockerfile 但我想要的是有一个单一的基础 dockerfile 和我的 dockerfile将他们的变量传递给它。 在我的例子中,dockerfile 之间的唯一区
我有一个应用程序有两个 Dockerfile ,说 Dockerfile.foo和 Dockerfile.bar ,预计将为 docker-compose.yml 的两个不同服务生成两个不同的图像.
我是一个 docker maven 插件新手。 如果我理解得很好,根据Spotify's Dockerfile Maven documentation ,应该将 Dockerfile 放在我的项目的根
我正在设置一个docker容器,将在this article之后在nginx服务器上为我的Angular 5应用程序提供服务。 本文提出了这个Dockerfile: # Stage 0, based
大家好, 我是 docker 的新手,我想容器化我的 ASP.NET Core 应用程序,但出现错误,我无法继续构建我的图像 这是我的示例 Dockerfile FROM microsoft/dotn
我想在不使用注册表的情况下链接 Dockerfiles,这可以通过 FROM 实现吗?陈述? 以两个 Dockerfile 为例: Dockerfile /some/other/dir/Dockerf
我尝试在公共(public) dockerhub 上通过我自己的镜像安装 Airflow,但它在本地运行完美,但当我尝试在 Openshift 上使用它时。我在下面收到此错误。 `ERROR: Cou
此 dockerfile 工作正常。但是如何在 dockerfile 中执行命令? FROM alpine RUN apk add --update sqlite && rm -rf /var/cac
当我尝试设置自动构建时,我的 Docker Hub 存储库中的 Dockerfile 为空。如果我触发构建:- Build failed: Dockerfile not found at ./Dock
关闭。这个问题需要details or clarity .它目前不接受答案。 想改进这个问题?通过 editing this post 添加详细信息并澄清问题. 1年前关闭。 Improve this
我目前正在将一个巨大的 DockerFile 拆分为单独的 DockerFile,但是在巨大的 DockerFile 中定义的一些变量需要在单独的 DockerFile 中使用。 Docker 是否有
我有一个 Dockerfile 可以创建我想在这里使用的构建镜像:~/build/Dockerfile 然后我使用一个标准镜像来部署 从 ~/build/Dockerfile 构建的图像没有在任何地方
我运行这个: ➜ frontend git:(master) ✗ docker-compose up Building web ERROR: Cannot locate specified Dock
我是一名优秀的程序员,十分优秀!