Search code examples
pipelinegithub-actionspython-poetrycicd

Poetry fails whenever I try to run cicd in GitHub Actions


I'm facing a problem with Poetry and GitHub actions in the last days. Maybe because Poetry has an updated version.

Information

  • Poetry version 1.1.9

I'm using the following .yml file for the CICD

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
...

Whenever it runs, during the Dependencies job, it fails and I've got the following error

• 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.

Attempts

At first I was using the Gr1N/setup-poetry@v4 and I notice that it was outdated. I've tried to update it to Gr1N/setup-poetry@v7, but didn't work.

I also received this 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.. I've tried to delete poetry.lock and run poetry update to generate a new one, no success at all.

Could anyone try to help me?


Solution

  • I think you can pin the poetry version link to what you have in your local environment (use poetry --version) to fix that.

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

    It is always a good practice to pin down your libraries and make sure your local environment is as similar as possible to the deployment environment.