Skip to content

Set Up Your AI Agent Project: Virtual Environment Guide for Beginners

Creating Your Project Folder

Start by organizing your workspace from day one:

  • Create a folder named AI Agent Development
  • Open it in Visual Studio Code:
    • Go to File → Open Folder
    • Select your AI Agent Development folder
    • Confirm it appears in the Explorer panel on the left

For a complete guide on installing VS Code and other essential tools from scratch, check out Free AI Development Setup: Install Python, VS Code & Ollama Tools.

Why You Need a Virtual Environment

Without a virtual environment, all your Python projects share the same global library folder. This causes conflicts:

  • Example: Project A uses library version 1; Project B updates it to version 2
  • Result: Project A breaks because its code wasn't designed for the update

A virtual environment solves this by:

  • Creating a fresh, isolated Python installation inside your project folder
  • Storing a separate copy of libraries in that project folder
  • Preventing libraries from different projects from interfering with each other

Beginner note: You don't need to fully understand this now, just follow the steps, and it will make sense as you code more.

How to Create and Activate the Virtual Environment

Step 1: Open the Integrated Terminal

In VS Code, open the terminal from the menu or use the shortcut `Ctrl + `` (backtick).

Step 2: Create the Environment

Run this command in the terminal:

python -m venv .venv

This creates a hidden folder named .venv inside your project.

Step 3: Activate the Virtual Environment

  • On Windows:
    .venv\Scripts\activate
    
  • On Linux/macOS:
    source .venv/bin/activate
    

When activated, you'll see a prompt change, something like (.venv) at the beginning of your terminal line. This shows you're now using the isolated environment.

Troubleshooting Activation Errors

If activation fails on Windows:

  • Run the command from Windows Command Prompt or PowerShell (outside VS Code)
  • Close that window, reopen VS Code, and try again

What Happens Next?

  • Any libraries you install now go into your project's .venv folder, not the system-wide Python folder
  • Your project stays self-contained and portable
  • You can have different library versions for different projects without conflicts

Once your environment is ready, you can start building projects like your own AI assistant. Learn how in Build Your Own ChatGPT: Python AI Assistant Explained.

Run the activation command every time you open a new terminal in this project.

Keep this summary

Save it to LunaNotes and it becomes a real note in your library — editable, searchable, and ready to turn into flashcards or a diagram. Free to start.

Save to LunaNotes

Or summarise for another video.

32K+ people have turned 65K+ videos into notes

“Very useful tool. I'm using it for the last couple weeks and I'm loving it so far. Makes learning on YouTube a great experience.”
Bhai Chrome Web Store review

This summary and transcript were automatically generated using AI with the Free YouTube transcript summary tool by LunaNotes.

Related summaries

Install Python, VS Code, and Ollama for AI Agent Development

Install Python, VS Code, and Ollama for AI Agent Development

This video provides a step-by-step guide to setting up your development environment for building AI agents. Learn how to install Python, download and configure Visual Studio Code, and set up Ollama with large language models.

Free AI Development Setup: Install Python, VS Code & Ollama Tools

Free AI Development Setup: Install Python, VS Code & Ollama Tools

Learn how to set up a complete local AI development environment using three free tools. This guide covers Python installation, Visual Studio Code setup, and Ollama for running AI models on your own computer — no GPU or cloud costs required.

How to Configure AI Model Settings for Your First Python Program

How to Configure AI Model Settings for Your First Python Program

Learn to set up a configuration file (.env) for your AI program, including base URL, API key, and model name. This tutorial shows how to configure Ollama locally so your Python code can communicate with an AI model without hardcoding settings.

How to Write Your First AI Program in Python with Ollama

How to Write Your First AI Program in Python with Ollama

Learn to write a simple AI-powered Python program that communicates with a local AI model (Ollama). This step-by-step tutorial covers importing libraries, loading environment variables, connecting to the AI, sending a question, and displaying the response.

Getting Started with Java: Writing Your First Code in VS Code

Getting Started with Java: Writing Your First Code in VS Code

In this tutorial, we explore how to set up Visual Studio Code for Java development and write your first Java program. We cover the basics of creating a project, using the terminal, and writing a simple 'Hello World' program.

Found this summary useful?

Take it with you. One click puts it in your own LunaNotes library.

Save to LunaNotes

Start taking better notes today with LunaNotes