简体   繁体   English

JSONDecodeError 诗歌 (Python 3.10)

[英]JSONDecodeError Poetry (Python 3.10)

Issue问题

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.

What I tried我试过的

  • Recreating the poetry.lock file. poetry.lock文件。
  • Removing the Poetry cache using rm -r ~/.cache/pypoetry/cache/ (and rm -r ~/.cache/pypoetry/ ).使用rm -r ~/.cache/pypoetry/cache/ (和rm -r ~/.cache/pypoetry/ )删除诗歌缓存。
  • Removing the lib that what returning an error (actually, the issue seems to happen with any lib, so that's the reason why I understand it's probably related to poetry and python)删除返回错误的库(实际上,这个问题似乎发生在任何库中,所以这就是我理解它可能与诗歌和python有关的原因)

Question问题

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:目前禁用诗歌的实验性新安装程序可能是一种解决方法:

Solution解决方案

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.

相关问题 在 monorepo 中使用 actions/setup-python 和诗歌缓存 - Using actions/setup-python with poetry cache in monorepo 使用 Github 操作安装诗歌,找不到诗歌命令。 无法将诗歌添加到路径中 - Install Poetry with Github Actions, poetry command not found. Cannot add Poetry into Path 如何为 GitHub 操作缓存诗歌安装 - How to cache poetry install for GitHub Actions Github Actions: poetry 安装黑了但是CI workflow找不到 - Github Actions: poetry installs black but CI workflow does not find it 安装 package with poetry in github actions 安装依赖但不是我的项目 - Installing package with poetry in github actions installs dependencies but not my project 每当我尝试在 GitHub 操作中运行 cicd 时,诗歌都会失败 - Poetry fails whenever I try to run cicd in GitHub Actions 在使用 github 操作构建期间执行诗歌安装时,使用预编译的 numpy package 而不是构建它 - Use precompiled numpy package instead of building it when performing poetry install during build with github actions 为什么 python 依赖项没有安装? - why python dependencies are not installing? Python 使用 Github 测试 Windows 上的操作 - Python testing with Github Actions on Windows 无法在 github 操作中创建(python)QApplication - Can't create (python) QApplication in github action
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM