Describe the bug
The Python init template README documents virtualenv activation on Windows as:
% .venv\Scripts\activate.bat
Running a .bat file from PowerShell spawns a separate cmd process, so the
environment changes do not persist in the calling shell. The virtualenv silently
stays inactive — no error is shown.
PowerShell is the default shell on Windows 11 and in the VS Code integrated
terminal, so this affects most Windows users following the template instructions.
Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
The README documents the PowerShell activation command alongside the cmd one.
Current Behavior
Only activate.bat is documented. Users get no error at activation time, then
hit confusing failures later — for example Subprocess exited with error 9009
on cdk synth or cdk deploy, because python is not resolved from the venv.
Reproduction Steps
- On Windows, in PowerShell:
cdk init app --language python
- Run
.venv\Scripts\activate.bat as documented in the generated README
- Run
python -c "import sys; print(sys.prefix)" — it points to the system
Python, not to the project venv
Possible Solution
Replace the Windows section of the template README with:
# PowerShell
.\.venv\Scripts\Activate.ps1
# cmd.exe
.venv\Scripts\activate.bat
A note that Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned
may be required before Activate.ps1 can run would also help, since it is the
default blocker on a standard Windows setup.
Related: aws/aws-cdk#20156 — another Windows/PowerShell friction point with the
same template.
I'm happy to open a PR for this.
Additional Information/Context
No response
CDK CLI Version
2.1142.0
Framework Version
No response
Node.js Version
v24.21.0
OS
Windows 11
Language
Python
Language Version
No response
Other information
No response
Describe the bug
The Python init template README documents virtualenv activation on Windows as:
Running a
.batfile from PowerShell spawns a separatecmdprocess, so theenvironment changes do not persist in the calling shell. The virtualenv silently
stays inactive — no error is shown.
PowerShell is the default shell on Windows 11 and in the VS Code integrated
terminal, so this affects most Windows users following the template instructions.
Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
The README documents the PowerShell activation command alongside the cmd one.
Current Behavior
Only
activate.batis documented. Users get no error at activation time, thenhit confusing failures later — for example
Subprocess exited with error 9009on
cdk synthorcdk deploy, becausepythonis not resolved from the venv.Reproduction Steps
cdk init app --language python.venv\Scripts\activate.batas documented in the generated READMEpython -c "import sys; print(sys.prefix)"— it points to the systemPython, not to the project venv
Possible Solution
Replace the Windows section of the template README with:
A note that
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSignedmay be required before
Activate.ps1can run would also help, since it is thedefault blocker on a standard Windows setup.
Related: aws/aws-cdk#20156 — another Windows/PowerShell friction point with the
same template.
I'm happy to open a PR for this.
Additional Information/Context
No response
CDK CLI Version
2.1142.0
Framework Version
No response
Node.js Version
v24.21.0
OS
Windows 11
Language
Python
Language Version
No response
Other information
No response