诗歌失败,并显示“检索到的包摘要不在诗歌中。锁定元数据”
我们正在尝试合并项目中的旧分支,当尝试构建 docker 映像时,诗歌似乎由于某种我不明白的原因而失败。
我对诗歌不太熟悉,因为到目前为止我只使用requirements.txt作为依赖项,所以我对正在发生的事情有点摸索。
我收到的错误(在服务器上构建图像的剧本的一部分)是这样的:
"Installing dependencies from lock file",
"",
"Package operations: 16 installs, 14 updates, 0 removals",
"",
" • Updating importlib-metadata (4.8.3 -> 2.0.0)",
" • Updating pyparsing (3.0.6 -> 2.4.7)",
" • Updating six (1.16.0 -> 1.15.0)",
"",
" RuntimeError",
"",
" Retrieved digest for link six-1.15.0.tar.gz(sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259) not in poetry.lock metadata ['30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259', '8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced']",
"",
" at /usr/local/lib/python3.7/dist-packages/poetry/installation/chooser.py:115 in _get_links",
" 111│ ",
" 112│ if links and not selected_links:",
" 113│ raise RuntimeError(",
" 114│ \"Retrieved digest for link {}({}) not in poetry.lock metadata {}\".format(",
" → 115│ link.filename, h, hashes",
" 116│ )",
" 117│ )",
" 118│ ",
" 119│ return selected_links",
"",
"",
" RuntimeError",
"",
" Retrieved digest for link pyparsing-2.4.7.tar.gz(sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1) not in poetry.lock metadata ['c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1', 'ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b']",
"",
" at /usr/local/lib/python3.7/dist-packages/poetry/installation/chooser.py:115 in _get_links",
" 111│ ",
" 112│ if links and not selected_links:",
" 113│ raise RuntimeError(",
" 114│ \"Retrieved digest for link {}({}) not in poetry.lock metadata {}\".format(",
" → 115│ link.filename, h, hashes",
" 116│ )",
" 117│ )",
" 118│ ",
" 119│ return selected_links",
"",
"",
" RuntimeError",
"",
" Retrieved digest for link importlib_metadata-2.0.0.tar.gz(sha256:77a540690e24b0305878c37ffd421785a6f7e53c8b5720d211b211de8d0e95da) not in poetry.lock metadata ['77a540690e24b0305878c37ffd421785a6f7e53c8b5720d211b211de8d0e95da', 'cefa1a2f919b866c5beb7c9f7b0ebb4061f30a8a9bf16d609b000e2dfaceb9c3']",
"",
" at /usr/local/lib/python3.7/dist-packages/poetry/installation/chooser.py:115 in _get_links",
" 111│ ",
" 112│ if links and not selected_links:",
" 113│ raise RuntimeError(",
" 114│ \"Retrieved digest for link {}({}) not in poetry.lock metadata {}\".format(",
" → 115│ link.filename, h, hashes",
" 116│ )",
" 117│ )",
" 118│ ",
" 119│ return selected_links"
]
}
如果您注意到,对于所有 3 个包,检索到的摘要实际上位于诗歌锁的元数据部分的摘要列表中文件。 我们的猜测是,这个锁定文件可能是由旧版本的诗歌生成的,并且不再有效。也许应该提到哈希方法(例如检索到的摘要是 sha256,但没有指定与之比较的摘要的方法)? 另一个奇怪的事情是,诗歌没有安装在 dockerfile 中,但似乎已经达到了这一点,尽管如此,我真的很好奇这是如何发生的。
任何见解将不胜感激(甚至任何包含更多信息的链接)!
非常感谢您抽出时间! (如果这对您来说还不够,请随时询问更多信息!)
干杯!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我使用的是诗歌 v1.2.2,修复方法是将配置更改为不使用新的实验安装程序,如下所示
poetry configexperimental.new-installer false
然后
poetry install
TOML 文件以重新创建新锁。
虽然我的问题并不完全相同,但它是完全相同的运行时错误,并且可能存在 md5-sha256 不匹配的情况。
I was using poetry v1.2.2 and the fix was changing the config to not using the new experimental installer like so
poetry config experimental.new-installer false
and then
poetry install
from the TOML file to recreate a new lock.
While my issue was not exactly the same, it was the exact same RunTime error, and there was potential for md5-sha256 mismatch.
当我自己遇到这个问题时,它已通过使用较新版本的诗歌重新创建锁定文件来解决。如果您能够查看 .toml 文件,我建议删除此锁定文件,然后运行
poetry install
创建一个新的锁定文件。When I've had this issue myself it has been fixed by recreating the lock file using a newer version of poetry. If you are able to view the .toml file I suggest deleting this lock file and then running
poetry install
to create a new lock file.就我而言,我使用
pypi-server
。它默认使用摘要方法
md5
。您可以通过CMD参数更改它。
例如,我使用docker镜像,我的Dockerfile是这样的:
希望可以帮助搜索这个问题的其他人。
In my case, I use
pypi-server
.It uses the digest method
md5
by default.You can change it by the CMD parameter.
For example, I use the docker image, and my Dockerfile is like:
Hope to help others who searched for this problem.
我在尝试将个人 package-xxx 替换为同一包的另一个源而不更改版本时遇到了同样的问题。 sha256 则不同。
在poetry 1.2.2中,您可以使用
poetry cache list
来检查包是否缓存在poetry中。如果是,请使用
poetry cache package-xxxclear --all
并尝试使用poetry add package=xxx
安装package-xxxI had the same issue trying to replace a personal package-xxx with another source of the same package without changing the version. The sha256 is different.
with poetry 1.2.2, you can use
poetry cache list
to check whether or not the package is cached in poetry.if yes, use
poetry cache package-xxx clear --all
and try to install package-xxx withpoetry add package=xxx
当我使用诗歌==1.5.1时,上述解决方案都没有帮助我。尝试了较低的诗歌版本(1.4、1.3、1.2),但仅将其设置为 1.1.8 有帮助:(
在这里发现问题:https://github.com/python-poetry/poetry/issues/4523)
在此工作之前,我还清除了缓存(但使用清除缓存其他版本没有帮助):
None of the solutions above helped me when I was using poetry==1.5.1. Tried lower poetry versions (1.4, 1.3, 1.2), but only setting it to 1.1.8 helped:
(found the issue here: https://github.com/python-poetry/poetry/issues/4523)
Before this worked I also cleared the cache (but clearing cache with other versions didn't help):