Python 新docker映像上pip安装的Sha256不匹配
我试图用一堆python库创建一个docker映像 在执行Python 新docker映像上pip安装的Sha256不匹配,python,docker,caching,pip,requirements,Python,Docker,Caching,Pip,Requirements,我试图用一堆python库创建一个docker映像 在执行pip安装时--no cache dir-r requirements.txt,由于库的哈希不匹配,尤其是pyspark,它一直失败 失败消息如下所示- ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Ot
pip安装时--no cache dir-r requirements.txt
,由于库的哈希不匹配,尤其是pyspark,它一直失败
失败消息如下所示-
ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
pyspark==2.4.6 from https://files.pythonhosted.org/packages/e9/e4/5c15ab8d354c4e3528510821865e6748209a9b0ff6a1788f4cd36cc2a5dc/pyspark-2.4.6.tar.gz#sha256=b4b319a3ffd187a3019f654ae1c8ac38048bcec2940f8cecdef829302d166feb (from -r requirements.txt (line 4)):
Expected sha256 b4b319a3ffd187a3019f654ae1c8ac38048bcec2940f8cecdef829302d166feb
Got e15b72fe55a366df7329932882c56328874152cf618950c7ce45e11f1c9dc5d1
一些我已经尝试过的东西,参考了其他堆栈溢出线程-
\uuu pycache\uu
和~/.cache/
目录--no cache dir
docker Build--no cache在不缓存的情况下构建docker映像-t标签锁图像
FROM python:3.7.7-stretch
USER root
RUN apt-get update && apt-get install -y --no-install-recommends openjdk-8-jdk
WORKDIR /labyrinth
COPY ./dodo.py .
COPY ./requirements.txt .
RUN pip install pip==20.0.2
RUN rm -rf ~/.cache
RUN rm -rf __pycache__
RUN pip install --no-cache-dir -r requirements.txt
mockito==1.2.1
py4j==0.10.7
pypandoc==1.5
pyspark==2.4.6
pytest
pandas
doit
koalas
requests
presto-client
mysql-connector-python
相应的requirements.txt文件如下所示-
FROM python:3.7.7-stretch
USER root
RUN apt-get update && apt-get install -y --no-install-recommends openjdk-8-jdk
WORKDIR /labyrinth
COPY ./dodo.py .
COPY ./requirements.txt .
RUN pip install pip==20.0.2
RUN rm -rf ~/.cache
RUN rm -rf __pycache__
RUN pip install --no-cache-dir -r requirements.txt
mockito==1.2.1
py4j==0.10.7
pypandoc==1.5
pyspark==2.4.6
pytest
pandas
doit
koalas
requests
presto-client
mysql-connector-python
任何帮助都将不胜感激。如果您需要更多详细信息,请告诉我。经过深思熟虑,我可以在同事的帮助下解决这个问题 我们的根本原因分析如下-当我们下载库时,服务器本身会在下载后发送一个SHA进行验证,以防止篡改库。现在,由于糟糕的互联网连接,库在下载时被损坏,因此发生了sha不匹配。这听起来不可思议,因为我认为pip会检测到这个故障,并提示库下载失败
不管怎样,我们在虚拟机上运行了相同的docker映像,它工作起来很有魅力。您从继承了哪个docker映像?你的
requirements.txt
文件是什么样子的?@Omer添加了这些细节。有趣的是,Dockerfile成功地构建在我的machineTrydocker build——无缓存上。
,可能中间层之一被破坏了。你可以尝试使用docker build-t——无缓存我的图像。