Skip to content

Poetry 1.8.5 -- virtualenv: error: unrecognized arguments: --wheel=bundle #10378

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
TillaTheHun0 opened this issue May 5, 2025 · 18 comments
Closed
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged

Comments

@TillaTheHun0
Copy link

Description

Running poetry run poetry lock --no-update, as part of a GitHub Workflow, recently started producing this error:

Creating virtualenv [REDACTED] in /home/runner/work/[REDACTED]/.venv
Resolving dependencies...
usage: virtualenv [--version] [--with-traceback] [-v | -q] [--read-only-app-data] [--app-data APP_DATA] [--reset-app-data] [--upgrade-embed-wheels] [--discovery {builtin}] [-p py] [--try-first-with py_exe]
                  [--creator {builtin,cpython3-posix,venv}] [--seeder {app-data,pip}] [--no-seed] [--activators comma_sep_list] [--clear] [--no-vcs-ignore] [--system-site-packages] [--symlinks | --copies] [--no-download | --download]
                  [--extra-search-dir d [d ...]] [--pip version] [--setuptools version] [--no-pip] [--no-setuptools] [--no-periodic-update] [--symlink-app-data] [--prompt prompt] [-h]
                  dest
virtualenv: error: unrecognized arguments: --wheel=bundle

This seems related to virtualenv recently No longer bundling wheel wheels

Workarounds

We haven't been able to find a workaround for this

Poetry Installation Method

install.python-poetry.org

Operating System

GitHub Runner: ubuntu-24.04 version 20250427.1.0

Poetry Version

Poetry (version 1.8.5)

Poetry Configuration

cache-dir = "/home/runner/.cache/pypoetry"
experimental.system-git-client = false
installer.max-workers = null
installer.modern-installation = true
installer.no-binary = null
installer.parallel = true
keyring.enabled = true
solver.lazy-wheel = true
virtualenvs.create = true
virtualenvs.in-project = true
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.no-setuptools = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}/virtualenvs"  # /home/runner/.cache/pypoetry/virtualenvs
virtualenvs.prefer-active-python = false
virtualenvs.prompt = "{project_name}-py{python_version}"
warnings.export = true

Python Sysconfig

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

Example pyproject.toml

Poetry Runtime Logs

poetry-runtime.log
Paste the output of 'poetry -vvv <command>', over this line.
@TillaTheHun0 TillaTheHun0 added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels May 5, 2025
@dimbleby
Copy link
Contributor

dimbleby commented May 5, 2025

poetry has not provided this setting since #9331, you should upgrade

@TillaTheHun0
Copy link
Author

Thanks @dimbleby . I figured this might be the case, but wasn't sure if there was a workaround while we made a switch.

I'll close this.

@viceice
Copy link

viceice commented May 6, 2025

Hi, I'm getting the same error for this simple project

[tool.poetry]
name = "containerbase-test"
version = "0.2.1"
description = "Testing"
authors = []
license = "MIT"

[tool.poetry.dependencies]
python = ">3.9"
numpy = "^1.21.3"
PyYAML = "^6.0.1"
pampy = "^0.2.1"

[tool.poetry.dev-dependencies]
pytest = "^4.4"
mock = "^3.0"

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
$ poetry update --lock --no-interaction
Creating virtualenv containerbase-test-9TtSrW0h-py3.12 in /home/ubuntu/.cache/pypoetry/virtualenvs
Updating dependencies
Resolving dependencies... (0.2s)usage: virtualenv [--version] [--with-traceback] [-v | -q] [--read-only-app-data] [--app-data APP_DATA] [--reset-app-data] [--upgrade-embed-wheels] [--discovery {builtin}] [-p py] [--try-first-with py_exe]
                  [--creator {builtin,cpython3-posix,venv}] [--seeder {app-data,pip}] [--no-seed] [--activators comma_sep_list] [--clear] [--no-vcs-ignore] [--system-site-packages] [--symlinks | --copies] [--no-download | --download]
                  [--extra-search-dir d [d ...]] [--pip version] [--setuptools version] [--no-pip] [--no-setuptools] [--no-periodic-update] [--symlink-app-data] [--prompt prompt] [-h]
                  dest
virtualenv: error: unrecognized arguments: --wheel=bundle
Resolving dependencies... (334.4s)^CException ignored in: <module 'threading' from '/opt/containerbase/tools/python/3.12.10/lib/python3.12/threading.py'>
Traceback (most recent call last):
  File "/opt/containerbase/tools/python/3.12.10/lib/python3.12/threading.py", line 1624, in _shutdown
    lock.acquire()
KeyboardInterrupt:

$ poetry config --list
cache-dir = "/home/ubuntu/.cache/pypoetry"
experimental.system-git-client = false
installer.max-workers = null
installer.modern-installation = true
installer.no-binary = null
installer.parallel = true
keyring.enabled = true
solver.lazy-wheel = true
virtualenvs.create = true
virtualenvs.in-project = null
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.no-setuptools = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}/virtualenvs"  # /home/ubuntu/.cache/pypoetry/virtualenvs
virtualenvs.prefer-active-python = false
virtualenvs.prompt = "{project_name}-py{python_version}"
warnings.export = true

we did not change any settings, those are the defaults.

@viceice
Copy link

viceice commented May 6, 2025

Does it mean poetry v1 can no longer be used?

@viceice
Copy link

viceice commented May 6, 2025

oh, found it when using verbose args. needed to upgrade pythest to get rid of atomicwrite

- pytest = "^4.4"
+ pytest = "^7.1"

@allanlewis
Copy link
Contributor

Related: pypa/virtualenv#2883

@allanlewis
Copy link
Contributor

Why has this been closed? I'm not clear what the proposed workaround is, other than restricting virtualenv to <20.31.0.

@viceice
Copy link

viceice commented May 6, 2025

@allanlewis for me it was the atomicwrite package with failed to install. I then found i can update pytest to ^7.1 to get atomicwrite removed. So this isn't a poetry issue directly

@allanlewis
Copy link
Contributor

@allanlewis for me it was the atomicwrite package with failed to install. I then found i can update pytest to ^7.1 to get atomicwrite removed. So this isn't a poetry issue directly

I don't have either of those dependencies, that seems to be specific to your situation.

@viceice
Copy link

viceice commented May 6, 2025

@allanlewis for me it was the atomicwrite package with failed to install. I then found i can update pytest to ^7.1 to get atomicwrite removed. So this isn't a poetry issue directly

I don't have either of those dependencies, that seems to be specific to your situation.

run poetry update --lock --no-interaction -vvv then you see which dependency is causing your issue. maybe you can then force an update of it.

@allanlewis
Copy link
Contributor

run poetry update --lock --no-interaction -vvv then you see which dependency is causing your issue. maybe you can then force an update of it.

Updating a dependency might fix this but that isn't the root cause: I think it's building any dependency from source. In my case I have a few dependencies without wheels on PyPI, including assertpy: we're already on the latest version so upgrading is moot.

I'd therefore expect the error reported here to occur in any project with at least one dependency without a platform-compatible wheel on PyPI. A workaround could be to build wheels manually for those dependencies and use --find-links or some other solution to avoid building them on-the-fly.

@dimbleby
Copy link
Contributor

dimbleby commented May 6, 2025

The only way that this could be fixed from this repository is by a new release: but that is already done - you can upgrade to a more recent poetry and this will go away.

If y'all insist on using older poetry you will need to go over to virtualenv and convince the maintainer that they have made a breaking change in a minor release and that they ought to undo that. I've no idea how likely they are to be open to that.

@smk4664
Copy link

smk4664 commented May 6, 2025

A workaround is to inject an older version of virtualenv into the poetry environment. If using pipx to install, you can do a pipx inject poetry virtualenv==20.30.0 --force to install a compatible virtualenv version. If using the installer script, you will need to use the pip of the created virtualenv for poetry. This can either be found in $POETRY_HOME if providing that in the env, otherwise the install script lists the default location depending on your OS.

Here is an example I used:

~/.local/share/pypoetry/venv/bin/pip install virtualenv==20.30.0

@gsnider2195
Copy link

Is the only fix to update to Poetry v2 or pin the virtualenv dependency? The upgrade to Poetry v2 is a major breaking change and will require significant changes to tooling. Right now all of our CI is completely broken due to this issue.

@allanlewis
Copy link
Contributor

A workaround is to inject an older version of virtualenv into the poetry environment. If using pipx to install, you can do a pipx inject poetry virtualenv==20.30.0 --force...

For PipX you can also do:

pipx install 'poetry==1.8.*' --preinstall='virtualenv<20.31.0'

That doesn't pin virtualenv to a "safe" version forever more but it should suffice until there's a sustainable resolution to this issue.

If you already have a PipX virtualenv then the inject approach should work.

@Heatszy
Copy link

Heatszy commented May 6, 2025

virtualenv maintainers actually nailed it with this breaking change, all our pipelines were down then I saw their release notes and it left me speechless

Anyways pinning to a clean version of virtualenv (ex 20.30.0) worked perfectly for us (just with a pip install). Looking forward to see how they will be fixing this

@smk4664
Copy link

smk4664 commented May 7, 2025

@gsnider2195 pointed out that a better solution is to use poetry self add [email protected] instead of using pip.

robin-nitrokey added a commit to Nitrokey/nitrokey-sdk-py that referenced this issue May 7, 2025
This fixes an issue with virtualenv 20.31.0 and Poetry 1, see:
python-poetry/poetry#10378
@FlurinArner
Copy link

FlurinArner commented May 8, 2025

Starting with poetry == 2.0.0 (the next one after 1.8.5) only Python 3.9+ is supported.

Looks like we'll be dropping Python 3.8 support (which is anyway EOL by now), so we can move to poetry v2..

kadler added a commit to IBM/python-itoolkit that referenced this issue May 8, 2025
Virtualenv change breaks older Poetry versions. For more background:
python-poetry/poetry#10378
pypa/virtualenv#2883

Using fix mentioned here:
python-poetry/poetry#10378 (comment)
bkeryan added a commit to ni/python-actions that referenced this issue May 12, 2025
Create the `setup-python` and `setup-poetry` actions. Providing our own actions for these allows us to:
- Single-source the default versions
- Cache the Poetry installation
- Isolate the Poetry installation/caching from other software on the runner (e.g. apps installed with pipx)
- Single-source workarounds for Poetry installation issues (e.g. python-poetry/poetry#10378 )
- In the future, we could update the `setup-poetry` action to pin Poetry's dependencies

Fill in the documentation.

Create GitHub issue templates and copy the workflow for syncing GitHub issues to AzDO.
@radoering radoering marked this as a duplicate of #10384 May 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

8 participants