诗歌失败,并显示“检索到的包摘要不在诗歌中。锁定元数据”

发布于 2025-01-15 16:43:46 字数 3626 浏览 1 评论 0 原文

我们正在尝试合并项目中的旧分支,当尝试构建 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 中,但似乎已经达到了这一点,尽管如此,我真的很好奇这是如何发生的。

任何见解将不胜感激(甚至任何包含更多信息的链接)!

非常感谢您抽出时间! (如果这对您来说还不够,请随时询问更多信息!)

干杯!

We're trying to merge and old branch in a project and when trying to build a docker image, poetry seems to fail for some reason that I don't understand.

I'm not very familiar with poetry, as I've only used requirements.txt for dependencies up to now, so I'm fumbling a bit on what's going on.

The error that I'm getting (part of the playbook that builds the image on the server) is this:

       "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"
    ]
}

If you notice, for all 3 packages, the retrieved digest is actually in the list of digests of the metadata section of the poetry lock file.
Our guess is that maybe this lock file was generated by an older version of poetry and is no longer valid. Maybe a hashing method should be mentioned (for example the retrieved digest is sha256, but no method is specified on the ones that are compared with it)?
Another curious thing is that poetry is not installed inside the dockerfile, but seems to reach that point, nevetheless, and I'm really curious how this can happen.

Any insight would be greatly appreciated (and any link with more information, even)!

Thanks a lot for your time! (Feel free to ask for more information if this seems inadequate to you!)

Cheers!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

浊酒尽余欢 2025-01-22 16:43:46

我使用的是诗歌 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.

后eg是否自 2025-01-22 16:43:46

当我自己遇到这个问题时,它已通过使用较新版本的诗歌重新创建锁定文件来解决。如果您能够查看 .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.

唐婉 2025-01-22 16:43:46

就我而言,我使用pypi-server
它默认使用摘要方法md5
您可以通过CMD参数更改它。
例如,我使用docker镜像,我的Dockerfile是这样的:

FROM pypiserver/pypiserver:latest
ENTRYPOINT ["/entrypoint.sh", "run", "--hash-algo", "sha256"]

希望可以帮助搜索这个问题的其他人。

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:

FROM pypiserver/pypiserver:latest
ENTRYPOINT ["/entrypoint.sh", "run", "--hash-algo", "sha256"]

Hope to help others who searched for this problem.

野生奥特曼 2025-01-22 16:43:46

我在尝试将个人 package-xxx 替换为同一包的另一个源而不更改版本时遇到了同样的问题。 sha256 则不同。

在poetry 1.2.2中,您可以使用poetry cache list来检查包是否缓存在poetry中。

如果是,请使用poetry cache package-xxxclear --all并尝试使用poetry add package=xxx安装package-xxx

I 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 with poetry add package=xxx

×眷恋的温暖 2025-01-22 16:43:46

当我使用诗歌==1.5.1时,上述解决方案都没有帮助我。尝试了较低的诗歌版本(1.4、1.3、1.2),但仅将其设置为 1.1.8 有帮助:(

pip3 install pip==21.0.1 poetry==1.1.8 poetry-core==1.0.4

在这里发现问题:https://github.com/python-poetry/poetry/issues/4523

在此工作之前,我还清除了缓存(但使用清除缓存其他版本没有帮助):

poetry cache clear --all .

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:

pip3 install pip==21.0.1 poetry==1.1.8 poetry-core==1.0.4

(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):

poetry cache clear --all .
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文