Skip to content

Conversation

@rahuldevikar
Copy link
Contributor

@rahuldevikar rahuldevikar commented Jan 10, 2026

When Python is installed in a path containing spaces (e.g., C:\Program Files\Python39) on Windows, and a file named C:\Program exists on the filesystem, virtualenv's pydoc command fails with the error:

Unable to create process using 'c:\program files\python39\python.exe'
This happens because Windows command interpreter splits unquoted paths at spaces, interpreting C:\Program Files\Python39\python.exe as two separate arguments:

C:\Program (which exists as a file)
Files\Python39\python.exe
When Windows tries to execute C:\Program as if it were an executable, the command fails.

The issue stems from unquoted Python executable paths in activation scripts.

Solution:
Quotes ensure Windows treats the entire path as a single argument, even with spaces, and the call operator in PowerShell properly handles commands with spaces in their paths.

Fixes: #2985

  • ran the linter to address style issues (tox -e fix)
  • wrote descriptive pull request text
  • ensured there are test(s) validating the fix
  • added news fragment in docs/changelog folder
  • updated/extended the documentation

@gaborbernat gaborbernat enabled auto-merge January 10, 2026 06:49
@gaborbernat gaborbernat merged commit fb651b0 into pypa:main Jan 10, 2026
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

virtualenv dont work if file "C:\Program" was created

2 participants