0Pricing
MLOps Academy · Lesson

Isolate Projects with Virtual Environments

Use venv and conda to keep projects from colliding.

Isolate Projects with Virtual Environments is a free MLOps Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the MLOps Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

One Python, Many Projects

Install everything into one global Python and projects start fighting over versions. A virtual environment gives each project its own private space. 🧪

What venv Actually Does

A venv is just a folder holding its own Python and packages. Activate it and pip installs land there, not system-wide.

Create One

The built-in venv module makes an environment in a folder you name. Here it lands in a folder called .venv.

python -m venv .venv

Activate It

Activating puts that environment first on your path, so python and pip now point inside it instead of the system.

source .venv/bin/activate

Confirm You Are Inside

Run which python and you should see the path to your .venv folder. That proves installs will stay isolated.

which python

Leave When Done

The deactivate command drops you back to the system Python. Your project packages stay safely tucked in the folder.

deactivate

Never Commit the Folder

The .venv folder is large and machine-specific, so add it to .gitignore. Commit requirements.txt instead and rebuild anywhere.

.venv/

Conda Joins the Party

conda creates environments too, and it can manage non-Python tools like CUDA. That makes it popular for heavy ML and GPU work.

conda create -n mlops python=3.11

Pin the Python Version

Different Python versions can change behavior, so pin one per environment. Conda makes the Python version part of the create command.

One Env Per Project

Give each project its own environment. Then upgrading a library for one project can never silently break another.

Share It Reproducibly

Export your conda env to a YAML file so a teammate rebuilds the exact same setup with one command.

conda env export > environment.yml

Quick Check

What is the main reason to use a separate virtual environment per project?

Recap

You can now create a venv or conda env, activate it, gitignore the folder, pin Python, and export the setup so it rebuilds anywhere. 🧰

Frequently asked questions

Is the “Isolate Projects with Virtual Environments” lesson free?

Yes — the full text of “Isolate Projects with Virtual Environments” is free to read here on the web, and the MLOps Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the MLOps Academy course, upgrade to CoddyKit PRO.

What will I learn in “Isolate Projects with Virtual Environments”?

Use venv and conda to keep projects from colliding. You practise MLOps Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start MLOps Academy?

No prior experience is required. MLOps Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Isolate Projects with Virtual Environments” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this MLOps Academy lesson?

Yes. Every MLOps Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Pin Dependencies with requirements.txt
  2. Isolate Projects with Virtual Environments
  3. Seed Randomness for Repeatable Runs
  4. Capture the Full Run Config
← Back to MLOps Academy