[英]JSONDecodeError Poetry (Python 3.10)
I've got a problem using poetry install
in my CI/CD pipeline (Github Actions), on any GitHub runner, since I migrated from Python 3.8 to Python 3.10.由于我从 Python 3.8 迁移到 Python 3.10,我在任何 GitHub 运行器上的 CI/CD 管道(Github Actions)中使用
poetry install
时遇到问题。
Installing dependencies from lock file
Package operations: 79 installs, 0 updates, 0 removals
• Installing pyparsing (3.0.9)
JSONDecodeError
Expecting value: line 1 column 1 (char 0)
at /opt/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/json/decoder.py:355 in raw_decode
351│ """
352│ try:
353│ obj, end = self.scan_once(s, idx)
354│ except StopIteration as err:
→ 355│ raise JSONDecodeError("Expecting value", s, err.value) from None
356│ return obj, end
357│
Error: Process completed with exit code 1.
I didn't change any lib configuration in my pyproject.toml
file, but as you can see above: Poetry hide most of the StackTrace.我没有更改
pyproject.toml
文件中的任何 lib 配置,但正如您在上面看到的: Poetry hide the most of the StackTrace.
poetry.lock
file. poetry.lock
文件。rm -r ~/.cache/pypoetry/cache/
(and rm -r ~/.cache/pypoetry/
).rm -r ~/.cache/pypoetry/cache/
(和rm -r ~/.cache/pypoetry/
)删除诗歌缓存。Any idea how to resolve this issue in my CI/CD pipeline?知道如何在我的 CI/CD 管道中解决这个问题吗?
After a few researches, I found this thread on the poetry GitHub repository from november 2021.经过一些研究,我在 2021 年 11 月的诗歌 GitHub 存储库中找到了这个线程。
Here, there were this workaround from hoefling GitHub user :在这里,从hoefling GitHub 用户那里得到了这个解决方法:
Disabling poetry's experimental new installer may be a workaround for now:
目前禁用诗歌的实验性新安装程序可能是一种解决方法:
poetry config experimental.new-installer false
Adding this line in the shell before running the poetry install
command resolved my problem!在运行
poetry install
命令之前在 shell 中添加这一行解决了我的问题!
Note that in the same thread, another comment from ddc67cd stated that:请注意,在同一线程中,来自ddc67cd的另一条评论指出:
the issue is resolved with the new version of cachecontrol==0.12.9 (it should be installed automatically).
新版本的cachecontrol==0.12.9解决了这个问题(应该自动安装)。
But running pip install -U cachecontrol
didn't resolve the issue in my specific case (might be worth testing otherwise?).但是在我的特定情况下运行
pip install -U cachecontrol
并没有解决问题(否则可能值得测试?)。
It also seems the problem came back recently (July 2022) and this comment suggested a possible root cause to the issue related to the setuptools library.问题似乎最近(2022 年 7 月)又回来了,并且此评论暗示了与 setuptools 库相关的问题的可能根本原因。
Anyway, disabling poetry's experimental new installer should resolve the problem for now, until a permanent solution is found.无论如何,禁用诗歌的实验性新安装程序现在应该可以解决问题,直到找到永久解决方案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.