每当我尝试在 GitHub 操作中 运行 cicd 时,诗歌都会失败

Poetry fails whenever I try to run cicd in GitHub Actions

我在过去几天遇到了诗歌和 GitHub 行动的问题。可能是因为诗歌有更新版本。

信息

我正在为 CICD 使用以下 .yml 文件

jobs:
  execute-linters:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Pyton 3.9
        uses: actions/setup-python@v2
        with:
          python-version: 3.9

      - name: Poetry
        uses: Gr1N/setup-poetry@v7
      
      - name: Dependencies
        run: poetry install
...

Dependencies 作业期间,每当它 运行s 时,它就会失败,并且出现以下错误

• Installing py (1.10.0)

  EnvCommandError

  Command ['/home/runner/work/ds-gdem-pvso/ds-gdem-pvso/.venv/bin/pip', 'install', '--no-deps', '/home/runner/.cache/pypoetry/artifacts/c8/3a/b1/6d8182aff6a688801f32ca473f2ba55ecb83446a84cf3d1afad18800e0/ibm_db-3.0.4.tar.gz'] errored with the following return code 1, and output: 
  Processing /home/runner/.cache/pypoetry/artifacts/c8/3a/b1/6d8182aff6a688801f32ca473f2ba55ecb83446a84cf3d1afad18800e0/ibm_db-3.0.4.tar.gz
      ERROR: Command errored out with exit status 1:
       command: /home/runner/work/ds-gdem-pvso/ds-gdem-pvso/.venv/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-c_nfk704/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-c_nfk704/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-9hi5cw5y
           cwd: /tmp/pip-req-build-c_nfk704/
      Complete output (3 lines):
      Detected 64-bit Python
      Downloading https://public.dhe.ibm.com/ibmdl/export/pub/software/data/db2/drivers/odbc_cli/linuxx64_odbc_cli.tar.gz
      error in ibm_db setup command: use_2to3 is invalid.
      ----------------------------------------
  WARNING: Discarding file:///home/runner/.cache/pypoetry/artifacts/c8/3a/b1/6d8182aff6a688801f32ca473f2ba55ecb83446a84cf3d1afad18800e0/ibm_db-3.0.4.tar.gz. Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  

  at ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/utils/env.py:1180 in _run
      1176│                 output = subprocess.check_output(
      1177│                     cmd, stderr=subprocess.STDOUT, **kwargs
      1178│                 )
      1179│         except CalledProcessError as e:
    → 1180│             raise EnvCommandError(e, input=input_)
      1181│ 
      1182│         return decode(output)
      1183│ 
      1184│     def execute(self, bin, *args, **kwargs):

  • Installing pyarrow (4.0.1)
  • Installing regex (2021.8.28)
  • Installing scikit-learn (0.24.2)
  • Installing toml (0.10.2)
  • Installing tomli (1.2.1)
  • Installing tqdm (4.62.3)
  • Installing typing-inspect (0.7.1)
  • Installing wrapt (1.12.1)
Error: Process completed with exit code 1.

尝试次数

起初我使用的是 Gr1N/setup-poetry@v4,我发现它已经过时了。我尝试将其更新为 Gr1N/setup-poetry@v7,但没有成功。

我也收到了这个Warning: The lock file is not up to date with the latest changes in pyproject.toml. You may be getting outdated dependencies. Run update to update them.。我试图删除 poetry.lock 和 运行 poetry update 来生成一个新的,根本没有成功。

有人可以帮我吗?

我认为您可以将 poetry 版本 link 固定到您本地环境中的版本(使用 poetry --version)来解决这个问题。

  - uses: Gr1N/setup-poetry@v7
    with:
      poetry-version: 1.1.7

确定您的库并确保您的本地环境与部署环境尽可能相似始终是一个好习惯。