我正在尝试构建一个Docker映像,它应该运行python脚本,它需要numpy
、scipy
、pandas
和google-cloud-bigquery
由于此映像是为armv7
体系结构构建的,因此直接安装numpy、scipy和pandas是一件痛苦的事情(它花费的时间太长,最终会中断)。所以我决定用Miniconda和树莓皮包装。这很好(安装可以在映像构建期间完成)
现在我正在尝试安装google软件包google-crc32c==1.1.2
和google-cloud-bigquery
。有了pip,这是可能的,并且图像是正确构建的。但是,如果我使用此映像运行容器,它将始终重新启动,并显示以下错误日志:
File "/usr/src/app/bigquery.py", line 1, in <module>
from google.cloud import bigquery
ImportError: No module named 'google'
我想我必须安装带有conda
的google软件包,但是没有适用于armv7
体系结构的软件包:
Anaconda.org上的google-cloud-bigquery
包:https://anaconda.org/search?q=google+bigquery
Anaconda.org上的google-crc32c
包:https://anaconda.org/search?q=google-crc32c
是否有可能使用Miniconda for armv7架构安装这些google软件包? 或者,是否有另一种方法可以在不使用miniconda的情况下安装numpy、scipy和pandas(但不直接安装)
谢谢你的帮助
Dockerfile:
FROM python:3.7-buster
WORKDIR /usr/src/app
ENV PATH="/root/miniconda3/bin:${PATH}"
ARG PATH="/root/miniconda3/bin:${PATH}"
COPY main_prog.py bigquery.py requirements.txt ./
RUN wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-armv7l.sh
RUN mkdir /root/.conda
RUN /bin/bash Miniconda3-latest-Linux-armv7l.sh -b
RUN rm -f Miniconda3-latest-Linux-armv7l.sh \
&& echo "Running $(conda --version)"
RUN wget https://github.com/jjhelmus/berryconda/releases/download/v2.0.0/Berryconda3-2.0.0-Linux-armv7l.sh
RUN chmod +x Berryconda3-2.0.0-Linux-armv7l.sh ./Berryconda3-2.0.0-Linux-armv7l.sh
RUN conda list \
&& conda config --add channels rpi \
&& conda install python=3.6 -y\
&& conda install openblas blas -y\
&& conda install numpy -y\
&& conda install pandas -y\
&& conda install scipy -y
RUN pip install --upgrade pip
RUN pip install "google-crc32c==1.1.2"
RUN pip install google-cloud-bigquery
CMD ["python", "main_prog.py"]
我找不到使用Miniconda安装所有软件包的方法
但是,我可以直接从piwheels用轮子安装它们。 因此,我不得不在“/etc”目录中添加一个
pip.conf
文件{}的内容:
此外,我还必须安装
libatlas-base-dev
。 我只能通过向“/etc/apt/”目录中的我的sources.list添加一个URLdeb http://ftp.de.debian.org/debian buster main
(如推荐的here)来实现这一点{}的内容:
Dockerfile:
相关问题 更多 >
编程相关推荐