Warn when `venv` target directory already contains an environment
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
Feature or enhancement
Proposal:
When a user runs:
python -m venv myenv
and the directory already contains a virtual environment, Python silently performs no action. This behavior can be confusing, as the user receives no indication that the command had no effect.
I propose that venv should display a simple warning when it detects an existing virtual environment so the user knows the operation didn’t make any changes.
Example of the suggested output:
$ python -m venv myenv
Existing virtual environment found at 'myenv'.
No changes were made.
Use '--clear' to recreate this environment.
This provides clarity while keeping behavior backward-compatible. Users who want to recreate the environment can explicitly use --clear.
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the python -m venv entry point and compare its behavior when the target directory already contains an environment. Verify how the existing --clear option changes that behavior. Done means an existing environment produces the proposed warning and reports that no changes were made, while explicit clearing remains available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100