poetry icon indicating copy to clipboard operation
poetry copied to clipboard

virtualenvs.create=false && virtualenvs.use-poetry-python=false config not working on GitHub actions

Open ecs-jnguyen opened this issue 9 months ago • 5 comments

Description

In GitHub actions I am using pipx to install poetry. I am setting the POETRY_VIRTUALENVS_CREATE=false and POETRY_VIRTUALENVS_USE_POETRY_PYTHON=false environment variables in the GitHub action job. I am also using actions/setup-python to install my desired version of python.

When I try to run poetry env info or poetry install, I see that poetry is using the global python (not the one from actions/setup-python).

My goal is to use poetry to install my project into the site-packages from actions/setup-python so that I don't have to prefix commands with poetry run ... or activate the poetry env.

Here's my GitHub Action job:

name: Poetry with pipx

on:
  push:
  workflow_dispatch:

jobs:
  demo:
    runs-on: ubuntu-latest
    env:
      POETRY_VIRTUALENVS_CREATE: "false"
      POETRY_VIRTUALENVS_USE_POETRY_PYTHON: "false"
    steps:
      - uses: actions/checkout@v4

      - name: Install poetry with pipx
        run: pipx install poetry

      # Installing with pip has the same effect
      # - name: Install poetry with pip
      #   run: pip install poetry

      - uses: actions/setup-python@v5
        with:
          python-version: '3.10'

      - name: Get poetry env info
        run: poetry -vvv env info

      - name: Poetry Config
        run: poetry config --list

      - name: poetry install
        run: poetry -vvv install --no-root

Workarounds

Run actions/setup-python first, then use pip install poetry.

This works because we install python using setup-actions. Then we use that python environment to install poetry. So when poetry runs it uses the correct python environment.

However this is not desirable because we can't specify the cache: "poetry" input on actions/setup-python. The setup action will fail if poetry is not installed first.

Poetry Installation Method

pipx

Operating System

ubuntu 24.04.2

Poetry Version

2.1.1

Poetry Configuration

cache-dir = "/home/runner/.cache/pypoetry"
data-dir = "/home/runner/.local/share/pypoetry"
installer.max-workers = null
installer.no-binary = null
installer.only-binary = null
installer.parallel = true
installer.re-resolve = true
keyring.enabled = true
python.installation-dir = "{data-dir}/python"  # /home/runner/.local/share/pypoetry/python
requests.max-retries = 0
solver.lazy-wheel = true
system-git-client = false
virtualenvs.create = false
virtualenvs.in-project = null
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}/virtualenvs"  # /home/runner/.cache/pypoetry/virtualenvs
virtualenvs.prompt = "{project_name}-py{python_version}"
virtualenvs.use-poetry-python = false

Python Sysconfig

sysconfig.log
Paste the output of 'python -m sysconfig', over this line.

Example pyproject.toml

[project]
name = "poetry-github-actions"
version = "0.1.0"
description = ""
authors = [
    {name = "Your Name",email = "[email protected]"}
]
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
    "requests (>=2.32.3,<3.0.0)",
    "certifi (>=2025.1.31,<2026.0.0)"
]

[build-system]
requires = ["poetry-core>=2.0.0,<3.0.0"]
build-backend = "poetry.core.masonry.api"

Poetry Runtime Logs

poetry-runtime.log
Loading configuration file /home/runner/.config/pypoetry/config.toml
[findpython:findpython] Running script: ['/opt/hostedtoolcache/Python/3.10.16/x64/bin/python', '-EsSc', 'import sys; print(sys.executable)']
Found: /opt/hostedtoolcache/Python/3.10.16/x64/bin/python
[findpython:findpython] Running script: ['/opt/hostedtoolcache/Python/3.10.16/x64/bin/python', '-EsSc', 'import platform; print(platform.python_version())']
Skipping virtualenv creation, as specified in config file.
Checking keyring availability: Checking if keyring is available
[keyring:keyring.backend] Loading KWallet
[keyring:keyring.backend] Loading SecretService
[keyring:keyring.backend] Loading Windows
[keyring:keyring.backend] Loading chainer
[keyring:keyring.backend] Loading libsecret
[keyring:keyring.backend] Loading macOS
Backend 'fail Keyring' is not suitable
No valid keyring backend was found
Unavailable
Installing dependencies from lock file

Finding the necessary packages for the current system

Package operations: 1 install, 4 updates, 0 removals

- Updating certifi (2023.11.17 -> 2025.1.31)
Creating new session for pypi.org
[urllib3:urllib3.connectionpool] Starting new HTTPS connection (1): pypi.org:443
- Installing charset-normalizer (3.4.1)
- Updating idna (3.6 -> 3.10)
[urllib3:urllib3.connectionpool] Starting new HTTPS connection (2): pypi.org:443
- Updating urllib3 (2.0.7 -> 2.3.0)
[urllib3:urllib3.connectionpool] Starting new HTTPS connection (3): pypi.org:443
[urllib3:urllib3.connectionpool] Starting new HTTPS connection (4): pypi.org:443
[urllib3:urllib3.connectionpool] https://pypi.org:443 "GET /pypi/certifi/2025.1.31/json HTTP/1.1" 200 1731
[filelock:filelock] Attempting to acquire lock 139789290375120 on /home/runner/.cache/pypoetry/cache/repositories/PyPI/_http/f/7/b/5/2/f7b520d8734e4e369b28e0324bcdf9f273e547c575cf469170f3a627.lock
[urllib3:urllib3.connectionpool] https://pypi.org:443 "GET /pypi/idna/3.10/json HTTP/1.1" 200 4710
[filelock:filelock] Lock 139789290375120 acquired on /home/runner/.cache/pypoetry/cache/repositories/PyPI/_http/f/7/b/5/2/f7b520d8734e4e369b28e0324bcdf9f273e547c575cf469170f3a627.lock
[filelock:filelock] Attempting to release lock 139789290375120 on /home/runner/.cache/pypoetry/cache/repositories/PyPI/_http/f/7/b/5/2/f7b520d8734e4e369b28e0324bcdf9f273e547c575cf469170f3a627.lock
[urllib3:urllib3.connectionpool] https://pypi.org:443 "GET /pypi/charset-normalizer/3.4.1/json HTTP/1.1" 200 26475
[urllib3:urllib3.connectionpool] https://pypi.org:443 "GET /pypi/urllib3/2.3.0/json HTTP/1.1" 200 3255
[filelock:filelock] Attempting to acquire lock 139789290056080 on /home/runner/.cache/pypoetry/cache/repositories/PyPI/_http/2/d/8/0/1/2d8012d5f080918089ce99b60fe6c262bcbb196423500b956db8be28.lock
[filelock:filelock] Attempting to acquire lock 139789290000448 on /home/runner/.cache/pypoetry/cache/repositories/PyPI/_http/8/8/f/0/3/88f0362ee289b5db54ee7a5bd4c28ca2e87b4addef4f678ec8f92638.lock
[filelock:filelock] Lock 139789290375120 released on /home/runner/.cache/pypoetry/cache/repositories/PyPI/_http/f/7/b/5/2/f7b520d8734e4e369b28e0324bcdf9f273e547c575cf469170f3a627.lock
[filelock:filelock] Attempting to acquire lock 139789290049120 on /home/runner/.cache/pypoetry/cache/repositories/PyPI/_http/3/5/7/a/f/357af64e90923ea260f670309231e9[14](https://github.com/experian-test-security-org/jon-test-github-actions/actions/runs/14047438867/job/39331183183#step:9:15)276b01da458a21508179dcab.lock
[filelock:filelock] Lock 139789290049120 acquired on /home/runner/.cache/pypoetry/cache/repositories/PyPI/_http/3/5/7/a/f/357af64e90923ea260f670309231e914276b01da458a2[15](https://github.com/experian-test-security-org/jon-test-github-actions/actions/runs/14047438867/job/39331183183#step:9:16)08179dcab.lock
[filelock:filelock] Attempting to release lock 139789290049120 on /home/runner/.cache/pypoetry/cache/repositories/PyPI/_http/3/5/7/a/f/357af64e90923ea260f670309231e914276b01da458a21508179dcab.lock
[filelock:filelock] Lock 139789290049120 released on /home/runner/.cache/pypoetry/cache/repositories/PyPI/_http/3/5/7/a/f/357af64e90923ea260f670309231e914276b01da458a21508179dcab.lock
[filelock:filelock] Lock 139789290056080 acquired on /home/runner/.cache/pypoetry/cache/repositories/PyPI/_http/2/d/8/0/1/2d8012d5f080918089ce99b60fe6c262bcbb196423500b956db8be28.lock
[filelock:filelock] Lock 139789290000448 acquired on /home/runner/.cache/pypoetry/cache/repositories/PyPI/_http/8/8/f/0/3/88f0362ee289b5db54ee7a5bd4c28ca2e87b4addef4f678ec8f92638.lock
[filelock:filelock] Attempting to release lock 139789290000448 on /home/runner/.cache/pypoetry/cache/repositories/PyPI/_http/8/8/f/0/3/88f0362ee289b5db54ee7a5bd4c28ca2e87b4addef4f678ec8f92638.lock
[filelock:filelock] Lock 139789290000448 released on /home/runner/.cache/pypoetry/cache/repositories/PyPI/_http/8/8/f/0/3/88f0362ee289b5db54ee7a5bd4c28ca2e87b4addef4f678ec8f92638.lock
[filelock:filelock] Attempting to release lock 139789290056080 on /home/runner/.cache/pypoetry/cache/repositories/PyPI/_http/2/d/8/0/1/2d8012d5f080918089ce99b60fe6c262bcbb196423500b956db8be28.lock
[filelock:filelock] Lock 139789290056080 released on /home/runner/.cache/pypoetry/cache/repositories/PyPI/_http/2/d/8/0/1/2d8012d5f080918089ce99b60fe6c262bcbb196423500b956db8be28.lock
Creating new session for files.pythonhosted.org
[urllib3:urllib3.connectionpool] Starting new HTTPS connection (1): files.pythonhosted.org:443
Skipping wheel charset_normalizer-3.4.1-cp310-cp310-macosx_10_9_universal2.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp310-cp310-musllinux_1_2_aarch64.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp310-cp310-musllinux_1_2_i686.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp310-cp310-musllinux_1_2_ppc64le.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp310-cp310-musllinux_1_2_s390x.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp310-cp310-musllinux_1_2_x86_64.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp310-cp310-win32.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp310-cp310-win_amd64.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp311-cp311-macosx_10_9_universal2.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp311-cp311-musllinux_1_2_aarch64.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp311-cp311-musllinux_1_2_i686.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp311-cp311-musllinux_1_2_ppc64le.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp311-cp311-musllinux_1_2_s390x.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp311-cp311-musllinux_1_2_x86_64.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp311-cp311-win32.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp311-cp311-win_amd64.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp312-cp312-macosx_10_13_universal2.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp312-cp312-musllinux_1_2_aarch64.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp312-cp312-musllinux_1_2_i686.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp312-cp312-musllinux_1_2_ppc64le.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp312-cp312-musllinux_1_2_s390x.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp312-cp312-musllinux_1_2_x86_64.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp312-cp312-win32.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp312-cp312-win_amd64.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp313-cp313-macosx_10_13_universal2.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp313-cp313-musllinux_1_2_aarch64.whl as this is not supported by the current environment
[urllib3:urllib3.connectionpool] https://files.pythonhosted.org:443 "GET /packages/76/c6/c88e154df9c4e1a2a66ccf0005a88dfb2650c1dffb6f5ce603dfbd452ce3/idna-3.10-py3-none-any.whl HTTP/1.1" 200 70442
Skipping wheel charset_normalizer-3.4.1-cp313-cp313-musllinux_1_2_i686.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp313-cp313-musllinux_1_2_ppc64le.whl as this is not supported by the current environment
[urllib3:urllib3.connectionpool] Starting new HTTPS connection (2): files.pythonhosted.org:443
Skipping wheel charset_normalizer-3.4.1-cp313-cp313-musllinux_1_2_s390x.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp313-cp313-musllinux_1_2_x86_64.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp313-cp313-win32.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp313-cp313-win_amd64.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp37-cp37m-musllinux_1_2_aarch64.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp37-cp37m-musllinux_1_2_i686.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp37-cp37m-musllinux_1_2_ppc64le.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp37-cp37m-musllinux_1_2_s390x.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp37-cp37m-musllinux_1_2_x86_64.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp37-cp37m-win32.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp37-cp37m-win_amd64.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp38-cp38-macosx_10_9_universal2.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp38-cp38-musllinux_1_2_aarch64.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp38-cp38-musllinux_1_2_i686.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp38-cp38-musllinux_1_2_ppc64le.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp38-cp38-musllinux_1_2_s390x.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp38-cp38-musllinux_1_2_x86_64.whl as this is not supported by the current environment
[filelock:filelock] Attempting to acquire lock 139789277013600 on /home/runner/.cache/pypoetry/cache/repositories/_default_cache/_http/8/8/0/f/1/880f1582dd670fc7bb7231974c67fd946d7[16](https://github.com/experian-test-security-org/jon-test-github-actions/actions/runs/14047438867/job/39331183183#step:9:17)85651b47a71086ce5a2.lock
[filelock:filelock] Lock 139789277013600 acquired on /home/runner/.cache/pypoetry/cache/repositories/_default_cache/_http/8/8/0/f/1/880f1582dd670fc7bb7231974c67fd946d71685651b47a71086ce5a2.lock
Skipping wheel charset_normalizer-3.4.1-cp38-cp38-win32.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp38-cp38-win_amd64.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp39-cp39-macosx_10_9_universal2.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp39-cp39-manylinux_2_[17](https://github.com/experian-test-security-org/jon-test-github-actions/actions/runs/14047438867/job/39331183183#step:9:18)_aarch64.manylinux2014_aarch64.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp39-cp39-musllinux_1_2_aarch64.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp39-cp39-musllinux_1_2_i686.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp39-cp39-musllinux_1_2_ppc64le.whl as this is not supported by the current environment
[filelock:filelock] Attempting to release lock 139789277013600 on /home/runner/.cache/pypoetry/cache/repositories/_default_cache/_http/8/8/0/f/1/880f1582dd670fc7bb7231974c67fd946d71685651b47a71086ce5a2.lock
[urllib3:urllib3.connectionpool] https://files.pythonhosted.org:443 "GET /packages/38/fc/bce832fd4fd99766c04d1ee0eead6b0ec6486fb100ae5e74c1d91292b982/certifi-2025.1.31-py3-none-any.whl HTTP/1.1" 200 166393
Skipping wheel charset_normalizer-3.4.1-cp39-cp39-musllinux_1_2_s390x.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp39-cp39-musllinux_1_2_x86_64.whl as this is not supported by the current environment
Skipping wheel charset_normalizer-3.4.1-cp39-cp39-win32.whl as this is not supported by the current environment
[filelock:filelock] Lock 139789277013600 released on /home/runner/.cache/pypoetry/cache/repositories/_default_cache/_http/8/8/0/f/1/880f1582dd670fc7bb7231974c67fd946d71685651b47a71086ce5a2.lock
Skipping wheel charset_normalizer-3.4.1-cp39-cp39-win_amd64.whl as this is not supported by the current environment
[urllib3:urllib3.connectionpool] Starting new HTTPS connection (3): files.pythonhosted.org:443
[urllib3:urllib3.connectionpool] https://files.pythonhosted.org:443 "GET /packages/c8/19/4ec628951a74043532ca2cf5d97b7b14863931476d117c471e8e2b1eb39f/urllib3-2.3.0-py3-none-any.whl HTTP/1.1" 200 128369
[filelock:filelock] Attempting to acquire lock 139789277469232 on /home/runner/.cache/pypoetry/cache/repositories/_default_cache/_http/b/9/b/f/6/b9bf667dd758080da4c37b4d8022991a332c09abde75bab1f469[18](https://github.com/experian-test-security-org/jon-test-github-actions/actions/runs/14047438867/job/39331183183#step:9:19)ac.lock
[filelock:filelock] Attempting to acquire lock 139789277467456 on /home/runner/.cache/pypoetry/cache/repositories/_default_cache/_http/1/d/7/e/a/1d7ea1d874ab2fc4aebdaa4b33e3992c69a31e2bad4b1fd25431c4b5.lock
[filelock:filelock] Lock 139789277467456 acquired on /home/runner/.cache/pypoetry/cache/repositories/_default_cache/_http/1/d/7/e/a/1d7ea1d874ab2fc4aebdaa4b33e3992c69a31e2bad4b1fd25431c4b5.lock
[filelock:filelock] Attempting to release lock 139789277467456 on /home/runner/.cache/pypoetry/cache/repositories/_default_cache/_http/1/d/7/e/a/1d7ea1d874ab2fc4aebdaa4b33e3992c69a31e2bad4b1fd25431c4b5.lock
[urllib3:urllib3.connectionpool] https://files.pythonhosted.org:443 "GET /packages/3e/a2/513f6cbe752421f16d969e32f3583762bfd583848b763913ddab8d9bfd4f/charset_normalizer-3.4.1-cp312-cp312-manylinux_2_17_x86_64.manylinux[20](https://github.com/experian-test-security-org/jon-test-github-actions/actions/runs/14047438867/job/39331183183#step:9:21)14_x86_64.whl HTTP/1.1" 200 145268
[filelock:filelock] Lock 139789277469232 acquired on /home/runner/.cache/pypoetry/cache/repositories/_default_cache/_http/b/9/b/f/6/b9bf667dd758080da4c37b4d80[22](https://github.com/experian-test-security-org/jon-test-github-actions/actions/runs/14047438867/job/39331183183#step:9:23)991a332c09abde75bab1f46918ac.lock
[filelock:filelock] Attempting to release lock 139789277469[23](https://github.com/experian-test-security-org/jon-test-github-actions/actions/runs/14047438867/job/39331183183#step:9:24)2 on /home/runner/.cache/pypoetry/cache/repositories/_default_cache/_http/b/9/b/f/6/b9bf667dd758080da4c37b4d8022991a332c09abde75bab1f46918ac.lock
[filelock:filelock] Lock 139789277469232 released on /home/runner/.cache/pypoetry/cache/repositories/_default_cache/_http/b/9/b/f/6/b9bf667dd758080da4c37b4d8022991a332c09abde75bab1f46918ac.lock
[filelock:filelock] Attempting to acquire lock 139789277466544 on /home/runner/.cache/pypoetry/cache/repositories/_default_cache/_http/d/a/b/3/4/dab34ed03eb5a0fe4599b06edc981517c200cdfc[25](https://github.com/experian-test-security-org/jon-test-github-actions/actions/runs/14047438867/job/39331183183#step:9:26)c05949ab08a5aa.lock
[filelock:filelock] Lock 139789277467456 released on /home/runner/.cache/pypoetry/cache/repositories/_default_cache/_http/1/d/7/e/a/1d7ea1d874ab2fc4aebdaa4b33e3992c69a31e2bad4b1fd25431c4b5.lock
[filelock:filelock] Lock 139789[27](https://github.com/experian-test-security-org/jon-test-github-actions/actions/runs/14047438867/job/39331183183#step:9:28)7466544 acquired on /home/runner/.cache/pypoetry/cache/repositories/_default_cache/_http/d/a/b/3/4/dab34ed03eb5a0fe4599b06edc981517c200cdfc25c05949ab08a5aa.lock
[filelock:filelock] Attempting to release lock 139789277466544 on /home/runner/.cache/pypoetry/cache/repositories/_default_cache/_http/d/a/b/3/4/dab34ed03eb5a0fe4599b06edc981517c200cdfc25c05949ab08a5aa.lock
[filelock:filelock] Lock 139789277466544 released on /home/runner/.cache/pypoetry/cache/repositories/_default_cache/_http/d/a/b/3/4/dab34ed03eb5a0fe4599b06edc981517c200cdfc25c05949ab08a5aa.lock

Stack trace:

2  /opt/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/utils/env/base_env.py:430 in _run
    4[28](https://github.com/experian-test-security-org/jon-test-github-actions/actions/runs/14047438867/job/39331183183#step:9:29)│             else:
    429│                 encoding = "locale" if sys.version_info >= (3, 10) else None
  → 430│                 output = subprocess.check_output(
    431│                     cmd, stderr=stderr, env=env, text=True, encoding=encoding, **kwargs
    432│                 )

1  /usr/lib/python3.12/subprocess.py:466 in check_output
     464│         kwargs['input'] = empty
     465│ 
  →  466│     return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
     467│                **kwargs).stdout
     468│ 

CalledProcessError

Command '['/usr/bin/python3.12', '-m', 'pip', 'uninstall', 'idna', '-y']' returned non-zero exit status 1.

at /usr/lib/python3.12/subprocess.py:571 in run
     567│             # We don't call process.wait() as .__exit__ does that for us.
     568│             raise
     569│         retcode = process.poll()
     570│         if check and retcode:
  →  571│             raise CalledProcessError(retcode, process.args,
     572│                                      output=stdout, stderr=stderr)
     573│     return CompletedProcess(process.args, retcode, stdout, stderr)
     574│ 
     575│ 

The following error occurred when trying to handle this error:


Stack trace:

9  /opt/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/installation/executor.py:[29](https://github.com/experian-test-security-org/jon-test-github-actions/actions/runs/14047438867/job/39331183183#step:9:30)2 in _execute_operation
    290│ 
    291│             try:
  → 292│                 result = self._do_execute_operation(operation)
    293│             except EnvCommandError as e:
    294│                 if e.e.returncode == -2:

8  /opt/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/installation/executor.py:413 in _do_execute_operation
    411│             return 0
    412│ 
  → 413│         result: int = getattr(self, f"_execute_{method}")(operation)
    414│ 
    415│         if result != 0:

7  /opt/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/installation/executor.py:544 in _execute_update
    542│ 
    543│     def _execute_update(self, operation: Install | Update) -> int:
  → 544│         status_code = self._update(operation)
    545│ 
    546│         self._save_url_reference(operation)

6  /opt/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/installation/executor.py:598 in _update
    596│ 
    597│     def _update(self, operation: Install | Update) -> int:
  → 598│         return self._install(operation)
    599│ 
    600│     def _remove(self, package: Package) -> int:

5  /opt/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/installation/executor.py:588 in _install
    586│                 # the new package can't be installed
    587│                 assert isinstance(operation, Update)
  → 588│                 self._remove(operation.initial_package)
    589│ 
    590│             self._wheel_installer.install(archive)

4  /opt/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/installation/executor.py:608 in _remove
    606│ 
    607│         try:
  → 608│             return self.run_pip("uninstall", package.name, "-y")
    609│         except CalledProcessError as e:
    610│             if "not installed" in str(e):

3  /opt/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/installation/executor.py:435 in run_pip
    433│     def run_pip(self, *args: Any, **kwargs: Any) -> int:
    434│         try:
  → 435│             self._env.run_pip(*args, **kwargs)
    436│         except EnvCommandError as e:
    437│             output = decode(e.e.output)

2  /opt/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/utils/env/base_env.py:394 in run_pip
    392│         pip = self.get_pip_command()
    393│         cmd = pip + list(args)
  → 394│         return self._run(cmd, **kwargs)
    395│ 
    396│     def run_python_script(self, content: str, **kwargs: Any) -> str:

1  /opt/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/utils/env/generic_env.py:99 in _run
     97│ 
     98│     def _run(self, cmd: list[str], **kwargs: Any) -> str:
  →  99│         return super(VirtualEnv, self)._run(cmd, **kwargs)
    100│ 
    101│     def is_venv(self) -> bool:

EnvCommandError

Command ['/usr/bin/python3.12', '-m', 'pip', 'uninstall', 'idna', '-y'] errored with the following return code 1

Output:
Found existing installation: idna 3.6
ERROR: Cannot uninstall idna 3.6, RECORD file not found. Hint: The package was installed by debian.


at /opt/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/utils/env/base_env.py:434 in _run
    4[30](https://github.com/experian-test-security-org/jon-test-github-actions/actions/runs/14047438867/job/39331183183#step:9:31)│                 output = subprocess.check_output(
    4[31](https://github.com/experian-test-security-org/jon-test-github-actions/actions/runs/14047438867/job/39331183183#step:9:32)│                     cmd, stderr=stderr, env=env, text=True, encoding=encoding, **kwargs
    4[32](https://github.com/experian-test-security-org/jon-test-github-actions/actions/runs/14047438867/job/39331183183#step:9:33)│                 )
    433│         except CalledProcessError as e:
  → 434│             raise EnvCommandError(e)
    435│ 
    436│         return output
    437│ 
    438│     def execute(self, bin: str, *args: str, **kwargs: Any) -> int:

Cannot install idna.


Stack trace:

2  /opt/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/utils/env/base_env.py:430 in _run
    428│             else:
    429│                 encoding = "locale" if sys.version_info >= (3, 10) else None
  → 430│                 output = subprocess.check_output(
    431│                     cmd, stderr=stderr, env=env, text=True, encoding=encoding, **kwargs
    432│                 )

1  /usr/lib/python3.12/subprocess.py:466 in check_output
     464│         kwargs['input'] = empty
     465│ 
  →  466│     return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
     467│                **kwargs).stdout
     468│ 

CalledProcessError

Command '['/usr/bin/python3.12', '-m', 'pip', 'uninstall', 'urllib3', '-y']' returned non-zero exit status 1.

at /usr/lib/python3.12/subprocess.py:571 in run
     567│             # We don't call process.wait() as .__exit__ does that for us.
     568│             raise
     569│         retcode = process.poll()
     570│         if check and retcode:
  →  571│             raise CalledProcessError(retcode, process.args,
     572│                                      output=stdout, stderr=stderr)
     573│     return CompletedProcess(process.args, retcode, stdout, stderr)
     574│ 
     575│ 

The following error occurred when trying to handle this error:


Stack trace:

9  /opt/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/installation/executor.py:292 in _execute_operation
    290│ 
    291│             try:
  → 292│                 result = self._do_execute_operation(operation)
    293│             except EnvCommandError as e:
    294│                 if e.e.returncode == -2:

8  /opt/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/installation/executor.py:413 in _do_execute_operation
    411│             return 0
    412│ 
  → 413│         result: int = getattr(self, f"_execute_{method}")(operation)
    414│ 
    415│         if result != 0:

7  /opt/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/installation/executor.py:544 in _execute_update
    542│ 
    543│     def _execute_update(self, operation: Install | Update) -> int:
  → 544│         status_code = self._update(operation)
    545│ 
    546│         self._save_url_reference(operation)

6  /opt/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/installation/executor.py:598 in _update
    596│ 
    597│     def _update(self, operation: Install | Update) -> int:
  → 598│         return self._install(operation)
    599│ 
    600│     def _remove(self, package: Package) -> int:

5  /opt/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/installation/executor.py:588 in _install
    586│                 # the new package can't be installed
    587│                 assert isinstance(operation, Update)
  → 588│                 self._remove(operation.initial_package)
    589│ 
    590│             self._wheel_installer.install(archive)

4  /opt/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/installation/executor.py:608 in _remove
    606│ 
    607│         try:
  → 608│             return self.run_pip("uninstall", package.name, "-y")
    609│         except CalledProcessError as e:
    610│             if "not installed" in str(e):

3  /opt/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/installation/executor.py:435 in run_pip
    4[33](https://github.com/experian-test-security-org/jon-test-github-actions/actions/runs/14047438867/job/39331183183#step:9:34)│     def run_pip(self, *args: Any, **kwargs: Any) -> int:
    4[34](https://github.com/experian-test-security-org/jon-test-github-actions/actions/runs/14047438867/job/39331183183#step:9:35)│         try:
  → 435│             self._env.run_pip(*args, **kwargs)
    436│         except EnvCommandError as e:
    437│             output = decode(e.e.output)

2  /opt/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/utils/env/base_env.py:394 in run_pip
    392│         pip = self.get_pip_command()
    393│         cmd = pip + list(args)
  → 394│         return self._run(cmd, **kwargs)
    395│ 
    396│     def run_python_script(self, content: str, **kwargs: Any) -> str:

1  /opt/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/utils/env/generic_env.py:99 in _run
     97│ 
     98│     def _run(self, cmd: list[str], **kwargs: Any) -> str:
  →  99│         return super(VirtualEnv, self)._run(cmd, **kwargs)
    100│ 
    101│     def is_venv(self) -> bool:

EnvCommandError

Command ['/usr/bin/python3.12', '-m', 'pip', 'uninstall', 'urllib3', '-y'] errored with the following return code 1

Output:
Found existing installation: urllib3 2.0.7
ERROR: Cannot uninstall urllib3 2.0.7, RECORD file not found. Hint: The package was installed by debian.


at /opt/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/utils/env/base_env.py:434 in _run
    430│                 output = subprocess.check_output(
    431│                     cmd, stderr=stderr, env=env, text=True, encoding=encoding, **kwargs
    432│                 )
    433│         except CalledProcessError as e:
  → 434│             raise EnvCommandError(e)
    4[35](https://github.com/experian-test-security-org/jon-test-github-actions/actions/runs/14047438867/job/39331183183#step:9:36)│ 
    436│         return output
    437│ 
    438│     def execute(self, bin: str, *args: str, **kwargs: Any) -> int:

Cannot install urllib3.


Stack trace:

2  /opt/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/utils/env/base_env.py:430 in _run
    428│             else:
    429│                 encoding = "locale" if sys.version_info >= (3, 10) else None
  → 430│                 output = subprocess.check_output(
    431│                     cmd, stderr=stderr, env=env, text=True, encoding=encoding, **kwargs
    432│                 )

1  /usr/lib/python3.12/subprocess.py:466 in check_output
     464│         kwargs['input'] = empty
     465│ 
  →  466│     return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
     467│                **kwargs).stdout
     468│ 

CalledProcessError

Command '['/usr/bin/python3.12', '-m', 'pip', 'uninstall', 'certifi', '-y']' returned non-zero exit status 2.

at /usr/lib/python3.12/subprocess.py:571 in run
     567│             # We don't call process.wait() as .__exit__ does that for us.
     568│             raise
     569│         retcode = process.poll()
     570│         if check and retcode:
  →  571│             raise CalledProcessError(retcode, process.args,
     572│                                      output=stdout, stderr=stderr)
     573│     return CompletedProcess(process.args, retcode, stdout, stderr)
     574│ 
     575│ 

The following error occurred when trying to handle this error:


Stack trace:

9  /opt/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/installation/executor.py:292 in _execute_operation
    290│ 
    291│             try:
  → 292│                 result = self._do_execute_operation(operation)
    293│             except EnvCommandError as e:
    294│                 if e.e.returncode == -2:

8  /opt/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/installation/executor.py:413 in _do_execute_operation
    411│             return 0
    412│ 
  → 413│         result: int = getattr(self, f"_execute_{method}")(operation)
    414│ 
    415│         if result != 0:

7  /opt/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/installation/executor.py:544 in _execute_update
    542│ 
    543│     def _execute_update(self, operation: Install | Update) -> int:
  → 544│         status_code = self._update(operation)
    545│ 
    546│         self._save_url_reference(operation)

6  /opt/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/installation/executor.py:598 in _update
    596│ 
    597│     def _update(self, operation: Install | Update) -> int:
  → 598│         return self._install(operation)
    599│ 
    600│     def _remove(self, package: Package) -> int:

5  /opt/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/installation/executor.py:588 in _install
    586│                 # the new package can't be installed
    587│                 assert isinstance(operation, Update)
  → 588│                 self._remove(operation.initial_package)
    589│ 
    590│             self._wheel_installer.install(archive)

4  /opt/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/installation/executor.py:608 in _remove
    606│ 
    607│         try:
  → 608│             return self.run_pip("uninstall", package.name, "-y")
    609│         except CalledProcessError as e:
    610│             if "not installed" in str(e):

3  /opt/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/installation/executor.py:435 in run_pip
    433│     def run_pip(self, *args: Any, **kwargs: Any) -> int:
    434│         try:
  → 435│             self._env.run_pip(*args, **kwargs)
    4[36](https://github.com/experian-test-security-org/jon-test-github-actions/actions/runs/14047438867/job/39331183183#step:9:37)│         except EnvCommandError as e:
    437│             output = decode(e.e.output)

2  /opt/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/utils/env/base_env.py:394 in run_pip
    392│         pip = self.get_pip_command()
    393│         cmd = pip + list(args)
  → 394│         return self._run(cmd, **kwargs)
    395│ 
    396│     def run_python_script(self, content: str, **kwargs: Any) -> str:

1  /opt/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/utils/env/generic_env.py:99 in _run
     97│ 
     98│     def _run(self, cmd: list[str], **kwargs: Any) -> str:
  →  99│         return super(VirtualEnv, self)._run(cmd, **kwargs)
    100│ 
    101│     def is_venv(self) -> bool:

EnvCommandError

Command ['/usr/bin/python3.12', '-m', 'pip', 'uninstall', 'certifi', '-y'] errored with the following return code 2

Output:
Found existing installation: certifi 2023.11.17
Uninstalling certifi-2023.11.17:
ERROR: Exception:
Traceback (most recent call last):
  File "/usr/lib/python3.12/shutil.py", line 886, in move
    os.rename(src, real_dst)
PermissionError: [Errno 13] Permission denied: '/usr/lib/python3/dist-packages/certifi' -> '/tmp/pip-uninstall-0cec4zzx'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/base_command.py", line 180, in exc_logging_wrapper
    status = run_func(*args)
             ^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pip/_internal/commands/uninstall.py", line 105, in run
    uninstall_pathset = req.uninstall(
                        ^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pip/_internal/req/req_install.py", line 727, in uninstall
    uninstalled_pathset.remove(auto_confirm, verbose)
  File "/usr/lib/python3/dist-packages/pip/_internal/req/req_uninstall.py", line 380, in remove
    moved.stash(path)
  File "/usr/lib/python3/dist-packages/pip/_internal/req/req_uninstall.py", line 271, in stash
    renames(path, new_path)
  File "/usr/lib/python3/dist-packages/pip/_internal/utils/misc.py", line 358, in renames
    shutil.move(old, new)
  File "/usr/lib/python3.12/shutil.py", line 904, in move
    rmtree(src)
  File "/usr/lib/python3.12/shutil.py", line 785, in rmtree
    _rmtree_safe_fd(fd, path, onexc)
  File "/usr/lib/python3.12/shutil.py", line 686, in _rmtree_safe_fd
    _rmtree_safe_fd(dirfd, fullname, onexc)
  File "/usr/lib/python3.12/shutil.py", line 717, in _rmtree_safe_fd
    onexc(os.unlink, fullname, err)
  File "/usr/lib/python3.12/shutil.py", line 715, in _rmtree_safe_fd
    os.unlink(entry.name, dir_fd=topfd)
PermissionError: [Errno 13] Permission denied: '__main__.cpython-312.pyc'


at /opt/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/utils/env/base_env.py:434 in _run
    430│                 output = subprocess.check_output(
    431│                     cmd, stderr=stderr, env=env, text=True, encoding=encoding, **kwargs
    432│                 )
    433│         except CalledProcessError as e:
  → 434│             raise EnvCommandError(e)
    435│ 
    436│         return output
    4[37](https://github.com/experian-test-security-org/jon-test-github-actions/actions/runs/14047438867/job/39331183183#step:9:38)│ 
    438│     def execute(self, bin: str, *args: str, **kwargs: Any) -> int:

Cannot install certifi.

ecs-jnguyen avatar Mar 24 '25 23:03 ecs-jnguyen

POETRY_VIRTUALENVS_CREATE=false

Don't do that.

dimbleby avatar Mar 24 '25 23:03 dimbleby

@dimbleby I can see how that is harmful. In GitHub Actions when we run actions/setup-python we are no longer using the original site-packages. I'm trying to use the site-packages that was created from actions/setup-python.

In my project I have a couple of scripts ([project.scripts] in pyproject.toml, I want to run them in different steps of my job without having to prefix poetry run xyz to the command.

ecs-jnguyen avatar Mar 25 '25 01:03 ecs-jnguyen

Create and activate a virtualenv

dimbleby avatar Mar 25 '25 07:03 dimbleby

Asking for a friend... does the virtualenvs.use-poetry-python=false setting not matter if we have virtualenvs.create=false?

~~I~~ My friend would assume that use-poetry-python=false would use the python environment that's specified in the PATH (aka the one installed by actions/setup-python)

ecs-jnguyen avatar Mar 25 '25 17:03 ecs-jnguyen

https://python-poetry.org/docs/configuration/#virtualenvsuse-poetry-python

If you are not creating a virtual environment then of course a setting that is about creating a virtual environment is meaningless

dimbleby avatar Mar 25 '25 20:03 dimbleby