Skip to content

Commit 6582926

Browse files
moonbox3CopilotCopilot
authored
Python: docs(python/samples): recommend uv venv and document Windows ensurepip hang workaround (microsoft#5508)
* docs(samples): recommend uv venv to avoid Windows ensurepip hang Replace bare 'python -m venv .venv' with 'uv venv .venv' as the recommended approach in azure_functions and foundry-hosted-agents READMEs. Add a note explaining that python -m venv can hang indefinitely on Windows with Microsoft Store Python due to a known ensurepip issue. This matches the pattern already used in a2a/README.md which uses uv run exclusively. Co-authored-by: Copilot <[email protected]> * Python: docs(python/samples): recommend `uv venv` and document Windows ensurepip hang workaround Fixes microsoft#5401 * fix: correct Windows venv activation commands in foundry-hosted-agents README (microsoft#5401) Split the Windows activation section into separate PowerShell (.venv\Scripts\Activate.ps1) and Command Prompt (.venv\Scripts\activate.bat) instructions, replacing the incorrect extensionless `Activate` path. Co-authored-by: Copilot <[email protected]> * Address review feedback for microsoft#5401: Python: [Samples][Python] `python -m venv` hangs on Windows — READMEs should recommend uv or document workaround --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent 0507179 commit 6582926

2 files changed

Lines changed: 17 additions & 6 deletions

File tree

python/samples/04-hosting/azure_functions/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,22 @@ All of these samples are set up to run in Azure Functions. Azure Functions has a
1919

2020
### 2. Create and activate a virtual environment
2121

22+
Using [uv](https://docs.astral.sh/uv/) (recommended):
23+
2224
**Windows (PowerShell):**
2325
```powershell
24-
python -m venv .venv
26+
uv venv .venv
2527
.venv\Scripts\Activate.ps1
2628
```
2729

2830
**Linux/macOS:**
2931
```bash
30-
python -m venv .venv
32+
uv venv .venv
3133
source .venv/bin/activate
3234
```
3335

36+
> **Note:** `python -m venv .venv` also works, but can hang indefinitely on Windows with Microsoft Store Python due to a known `ensurepip` issue. Use `uv venv .venv` to avoid this.
37+
3438
### 3. Running the samples
3539

3640
- [Start the Azurite emulator](https://learn.microsoft.com/en-us/azure/storage/common/storage-install-azurite?tabs=npm%2Cblob-storage#run-azurite)

python/samples/04-hosting/foundry-hosted-agents/README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,18 +134,25 @@ cd agent-framework/python/samples/04-hosting/foundry-hosted-agents/responses
134134

135135
#### Environment setup
136136

137-
1. Navigate to the sample directory you want to explore. Create a virtual environment:
137+
1. Navigate to the sample directory you want to explore. Create and activate a virtual environment using [uv](https://docs.astral.sh/uv/) (recommended):
138138

139139
```bash
140-
python -m venv .venv
140+
uv venv .venv
141+
```
142+
143+
```bash
144+
# Windows (PowerShell)
145+
.venv\Scripts\Activate.ps1
141146

142-
# Windows
143-
.venv\Scripts\Activate
147+
# Windows (Command Prompt)
148+
.venv\Scripts\activate.bat
144149

145150
# macOS/Linux
146151
source .venv/bin/activate
147152
```
148153

154+
> **Note:** `python -m venv .venv` also works, but can hang indefinitely on Windows with Microsoft Store Python due to a known `ensurepip` issue. Use `uv venv .venv` to avoid this.
155+
149156
2. Install dependencies:
150157

151158
```bash

0 commit comments

Comments
 (0)