Skip to content

uv sync --active can recreate active venv #15603

Description

This is my usual workflow for setting up a Python project:

$ asdf set python 3.12.11 # or, whatever python version I want to use
$ python -m venv .venv
$ . .venv/bin/activate
$ python -m pip install --upgrade pip; python -m pip install --upgrade uv
$ uv sync

BUT it seems maybe some recent change to uv breaks this workflow as this is the output I get:

$ uv sync
Using CPython 3.12.11 interpreter at: /opt/homebrew/opt/python@3.12/bin/python3.12
Removed virtual environment at: .venv # WHYYYYY!?!?!?!
Creating virtual environment at: .venv
Resolved 14 packages in 3ms
Installed 13 packages in 19ms
 + annotated-types==0.7.0
 + anyio==4.10.0
 + certifi==2025.8.3
 + h11==0.16.0
 + httpcore==1.0.9
 + httpx==0.28.1
 + idna==3.10
 + ollama==0.5.3
 + pydantic==2.11.7
 + pydantic-core==2.33.2
 + sniffio==1.3.1
 + typing-extensions==4.15.0
 + typing-inspection==0.4.1
$ uv
bash: /Users/antony/tonybot/.venv/bin/uv: No such file or directory

I can't put into words how extremely frustrating this behaviour is. I already have a good workflow for setting up Python and a venv just how I like it!! For extra context, I am still reeling from having to change my usual venv location from venv to .venv (I hate having to type the extra character). I am pretty sure uv used to respect existing venvs so long as the name was the same but now it seems to just clobber whatever is there.

IIRC there's a command line flag (called like --existing or --inplace or something it's --active) that would make uv actually respect the existing venv that it's running in but it's a massive pain to have to remember to include that flag on every single invocation.

Questions:

  1. Is this expected behaviour from uv (to delete any existing venv?)
  2. How should I change my workflow so that uv actually helps me?

Related issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds-decisionUndecided if this should be done

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions