Skip to content

Bug: Hatch does not work with virtualenv 21.0.0 #2193

@epmog

Description

@epmog

Problem

As of 40ish minutes ago (at time of posting), virtualenv performed a release of version 21.0.0, hatch's pinning of this dependency means that any automation that leverages hatch will consume the latest version since it's anything equal or newer than 20.26.6.

Running any hatch script with this new version will fail with a non-zero exit code and the following message:

Environment `hatch-build` is incompatible: module 'virtualenv.discovery.builtin' has no attribute 'propose_interpreters'

Reproduction

python3 -m venv testenv
source testenv/bin/activate
pip install hatch
pip list # results below
hatch new "testproj"
cd testproj
hatch build
# hatch build output: 
# Environment `hatch-build` is incompatible: module 'virtualenv.discovery.builtin' has no attribute 'propose_interpreters'

output from pip list

---------------- ------------
anyio             4.12.1
backports.zstd    1.3.0
certifi           2026.2.25
click             8.3.1
distlib           0.4.0
filelock          3.24.3
h11               0.16.0
hatch             1.16.4
hatchling         1.29.0
httpcore          1.0.9
httpx             0.28.1
hyperlink         21.0.0
idna              3.11
jaraco.classes    3.4.0
jaraco.context    6.1.0
jaraco.functools  4.4.0
keyring           25.7.0
markdown-it-py    4.0.0
mdurl             0.1.2
more-itertools    10.8.0
packaging         26.0
pathspec          1.0.4
pexpect           4.9.0
pip               25.0.1
platformdirs      4.9.2
pluggy            1.6.0
ptyprocess        0.7.0
Pygments          2.19.2
pyproject_hooks   1.2.0
python-discovery  1.0.0
rich              14.3.3
shellingham       1.5.4
tomli_w           1.2.0
tomlkit           0.14.0
trove-classifiers 2026.1.14.14
typing_extensions 4.15.0
userpath          1.9.2
uv                0.10.6
virtualenv        21.0.0

If you downgrade virtualenv to below 21, it works:

$ pip install 'virtualenv<21'
Collecting virtualenv<21
  Downloading virtualenv-20.39.1-py3-none-any.whl.metadata (3.5 kB)
Requirement already satisfied: distlib<1,>=0.3.7 in testenv/lib/python3.12/site-packages (from virtualenv<21) (0.4.0)
Requirement already satisfied: filelock<4,>=3.24.2 in testenv/lib/python3.12/site-packages (from virtualenv<21) (3.24.3)
Requirement already satisfied: platformdirs<5,>=3.9.1 in testenv/lib/python3.12/site-packages (from virtualenv<21) (4.9.2)
Downloading virtualenv-20.39.1-py3-none-any.whl (5.8 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.8/5.8 MB 14.0 MB/s eta 0:00:00
Installing collected packages: virtualenv
  Attempting uninstall: virtualenv
    Found existing installation: virtualenv 21.0.0
    Uninstalling virtualenv-21.0.0:
      Successfully uninstalled virtualenv-21.0.0
Successfully installed virtualenv-20.39.1

[notice] A new release of pip is available: 25.0.1 -> 26.0.1
[notice] To update, run: pip install --upgrade pip

$ hatch build
─ sdist ─
dist/testproj-0.0.1.tar.gz
─ wheel ─
dist/testproj-0.0.1-py3-none-any.whl

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions