“It works on my machine” is usually a dependency problem wearing a disguise. One project needs pandas 2.x, another is pinned to something older, and a global pip install quietly breaks both.
A virtual environment fixes that by giving each project its own isolated set of packages. The question in 2027 isn’t whether to use one. It’s which tool to use to create and manage it. Three names come up again and again: venv, Conda and uv.
They overlap, but they were built for different jobs. Here’s how they actually differ.
The 20-second version
| venv + pip | Conda | uv | |
|---|---|---|---|
| Comes with Python | Yes | No | No (single binary) |
| Installs Python itself | No | Yes | Yes |
| Non-Python libraries (CUDA, GDAL, MKL) | No | Yes | No |
| Lock file out of the box | No | Partial (environment.yml) | Yes (uv.lock) |
| Speed | Moderate | Slower solves | Very fast |
| Best fit | Simple scripts, locked-down servers | Data science, GPU, scientific stacks | Most new application projects |
If you only read this far: use uv for new projects, Conda when you need compiled non-Python dependencies, and plain venv when you can’t install anything extra.
Now the details.
venv: the one that’s always there
venv has shipped with Python since 3.3. No downloads, no accounts, no extra tooling. That makes it the safest choice on a locked-down Windows Server where you can’t install new software.
python -m venv .venv
Activate it:
# Windows (PowerShell)
.venv\Scripts\Activate.ps1
# Linux / macOS
source .venv/bin/activate
Then install packages and freeze them:
pip install requests fastapi
pip freeze > requirements.txt
Where venv falls short
- It uses whatever Python you ran it with. Need 3.12 on one project and 3.13 on another? You install both versions yourself.
pip freezecaptures everything installed, including sub-dependencies, with no separation between “packages I asked for” and “packages they pulled in”. Over timerequirements.txtbecomes hard to reason about.- No real lock file. Two installs from the same
requirements.txton different days can resolve differently if you didn’t pin every version.
Windows tip: If
Activate.ps1fails with “running scripts is disabled”, runSet-ExecutionPolicy -Scope CurrentUser RemoteSignedonce. Or skip activation entirely and call.venv\Scripts\python.exedirectly. That’s also the most reliable way to run a venv from Task Scheduler.
Conda: for when Python isn’t the hard part
Conda manages environments and binary packages, and those packages don’t have to be Python. That is its real superpower.
If your project depends on CUDA toolkits, GDAL for geospatial work, MKL-optimised NumPy, or R alongside Python, Conda can install all of it into one environment with compatible builds. With pip, many of those require system-level installs or manual compiling, which is painful on Windows.
conda create -n analytics python=3.12 pandas scikit-learn
conda activate analytics
conda env export > environment.yml
Recreate it elsewhere:
conda env create -f environment.yml
Things to know before you commit to Conda
- Licensing. Anaconda’s default channel has commercial terms for larger organisations. Many teams use Miniforge, which defaults to the community
conda-forgechannel, to stay clear of that. Check the current terms for your company size rather than assuming. - Mixing pip and conda inside one environment works, but do the conda installs first and pip last. Going back and forth is a common source of broken environments.
- Environments are large. A data science environment can easily run into gigabytes.
- mamba (and
micromamba) is a faster drop-in solver for Conda environments if solving speed bothers you.
uv: the fast, all-in-one newcomer that grew up
uv comes from Astral, the team behind the Ruff linter. It’s written in Rust and aims to replace a pile of tools at once: pip, venv, pip-tools, pipx and pyenv. Most people notice the speed first. What makes them stay is the workflow.
Install it (one time):
# Windows
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
# Linux / macOS
curl -LsSf https://astral.sh/uv/install.sh | sh
Start a project:
uv init invoice-service
cd invoice-service
uv add fastapi "sqlalchemy>=2"
uv add --dev pytest ruff
uv run python main.py
Notice what’s missing: you never created or activated an environment. uv add updates pyproject.toml, creates .venv if needed and writes a uv.lock file. uv run makes sure the environment matches the lock file before running your command.
Need a specific Python version?
uv python install 3.12
uv python pin 3.12
On a CI server or production box, install exactly what the lock file says:
uv sync --locked
--locked fails loudly if pyproject.toml and uv.lock disagree, instead of quietly resolving something new. That one flag prevents a whole class of “but it passed in CI” surprises.
Small scripts get a nice trick too. You can declare dependencies inside a single file:
uv add --script cleanup.py requests
uv run cleanup.py
uv writes the dependency list into a comment block at the top of the script, and anyone with uv can run it without setting anything up.
Limitations worth knowing
- uv installs from PyPI-style indexes. It doesn’t replace Conda for non-Python binaries.
- It’s a newer tool. If your organisation needs every tool approved, plain venv may be the path of least resistance.
- Teams switching from
requirements.txtwill need to agree onpyproject.toml+uv.lockas the source of truth. (uv can still export arequirements.txtif a deployment tool needs one.)
Which one should you use?
Ask these questions in order:
- Do you need non-Python binary libraries like CUDA, GDAL, or a specific BLAS build? → Conda (via Miniforge).
- Are you on a server where you can’t install new tools? → venv + pip, and pin every version in
requirements.txt. - Everything else, including web APIs, automation scripts, Django or FastAPI apps and internal tools → uv.
There’s no rule against mixing approaches across projects. Plenty of developers use uv for application code and keep a Conda environment for one GPU-heavy notebook project.
Habits that matter more than the tool
Whatever you pick, these habits prevent most dependency pain:
- Never install packages into the system Python. On modern Linux distributions, pip will often refuse anyway.
- Keep
.venvout of Git. Commit the recipe (pyproject.toml,uv.lock,requirements.txtorenvironment.yml), not the environment itself. - One environment per project. A shared “tools” environment for five projects is just a global install with extra steps.
- Rebuild from scratch occasionally. Delete
.venvand recreate it. If that fails, your lock file or requirements are lying to you, and it’s better to find out on a quiet Tuesday than during a deployment. - Point schedulers at the environment’s Python. Use
C:\apps\report\.venv\Scripts\python.exe, notpython. (We cover this in detail in our Task Scheduler guide.)
Choosing well
venv is the dependable baseline that’s always available. Conda solves a different problem, compiled scientific dependencies, and solves it well. uv has become the most practical default for new application projects because it combines Python installs, environments, locking and running into one quick tool.
Pick based on the problem in front of you, write the lock file down, and “it works on my machine” becomes “it works on every machine”.
Leave a Comment