Skip to content

Python: [Samples][Python] python -m venv hangs on Windows — READMEs should recommend uv or document workaround #5401

@leestott

Description

@leestott

Description

Several sample READMEs (notably azure_functions/README.md and durabletask/README.md) recommend python -m venv .venv for creating virtual environments. On Windows with Microsoft Store Python 3.13, this command hangs indefinitely during the ensurepip step.

This is a known Python/Windows issue, but beginners following the README get stuck at the first step with no guidance on alternatives.

Steps to Reproduce

cd python/samples/04-hosting
python -m venv .venv   # ❌ Hangs indefinitely at ensurepip

Error

Traceback (most recent call last):
  File "...\venv\__init__.py", line 446, in _setup_pip
    self._call_new_python(context, '-m', 'ensurepip', '--upgrade', ...)
  ...
  File "...\subprocess.py", line 1209, in communicate
    stdout = self.stdout.read()
KeyboardInterrupt

Workarounds

  • uv venv .venv — works instantly (requires uv installation)
  • python -m venv .venv --without-pip — creates venv without pip, then bootstrap with uv pip

Suggested Fix

  1. Add uv as a listed prerequisite in the READMEs, or
  2. Update venv creation instructions to recommend uv venv .venv as the primary approach, or
  3. At minimum, add a note about the Windows ensurepip hang with workaround

The a2a/README.md already uses uv run exclusively, so there's precedent for recommending uv.

Environment

  • Python 3.13.13, Windows 11 (Microsoft Store Python), uv 0.9.27

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationpython

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions