> For the complete documentation index, see [llms.txt](https://agenticai.kasinathanramesh.vip/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://agenticai.kasinathanramesh.vip/section-4-python-sdk-and-node-configuration/class-30thmay2026.md).

# Class 30thMay2026

venv  -  It's a workspace to run specific version of application.

**What is Virtual Environment?**

A **Python virtual environment** is an **isolated directory tree** that contains its own Python interpreter, standard libraries, and unique set of installed packages. It acts as a self-contained "sandbox," ensuring that third-party packages installed for one specific project **will not interfere with or break** the global system-wide Python installation or other projects running on the same compute

**Why You Need Virtual Environments**

By default, Python installs external libraries into a single shared, global location. This can quickly cause severe issues during development:

* **Dependency Conflicts:** If Project A requires version 1.5 of a library (like `pandas`) but Project B requires version 2.0, installing one will overwrite the other, breaking one of your applications.
* **System Stability:** On operating systems like Linux or macOS, the OS itself relies on the global Python installation. Installing or updating packages globally can break core system applications.&#x20;
* **Clean Project Control:** It creates a lightweight room for your project. When you no longer need the project, you can simply delete its folder, leaving your machine completely clean.

**How Virtual Environments Work**

```
Your Project Folder/
│
├── my_script.py
└── my_env/  <-- The Virtual Environment Folder
    ├── pyvenv.cfg  <-- Configuration file
    ├── bin/ (or Scripts/ on Windows)  <-- Local Python & Pip executables
    └── lib/site-packages/             <-- Local third-party libraries
```

When you create and "activate" a virtual environment, the system temporarily modifies your terminal's command path (`PATH`). Instead of pointing to the global Python, your terminal points directly to the `bin` (or `Scripts`) directory inside your local environment folder. Any package you download using `pip` is channeled straight into that local folder instead of the global system.

To set up a Python virtual environment in PowerShell, you must generate the environment using the `venv` module and call the specific `.ps1` activation script.&#x20;

**1. Enable Script Execution**

Windows PowerShell restricts running scripts by default, which blocks the virtual environment activation script. You need to allow local scripts to execute.

* Open your PowerShell terminal.
* Execute this command to update your execution policy for the current session:powershell

  ```
  Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process
  ```

  Use code with caution. (*Note: You can permanently apply this settings change to your user account by changing `-Scope Process` to `-Scope CurrentUser`).*

**2. Create the Virtual Environment**&#x20;

Navigate to your project directory and use Python's built-in `venv` tool to create the environment files.

* Navigate to your project folder:powershell

  ```
  cd path\to\your\project
  ```

* Run the creation command, replacing `myenv` with your preferred environment name:powershell

  ```
  python -m venv myenv
  ```

**3. Activate the Environment**

You must target the PowerShell-specific activation script located inside the generated folder.

* Run the activation script:powershell

  ```
  .\myenv\Scripts\Activate.ps1
  ```

  * **Windows (Command Prompt):** `myenv\Scripts\activate.bat`
  * **Windows (PowerShell):** `.\myenv\Scripts\Activate.ps1`
  * **macOS/Linux:** `source myenv/bin/activate`
* Look at your terminal prompt; it will now display `(myenv)` to verify the environment is active.

**Install Packages**

Now you can install libraries safely:

* `pip install requests`&#x20;

**4. Deactivate the Environment**&#x20;

When you finish working on your project, close the session or return to your global Python environment.

* Type this single command to exit the virtual environment:powershell

  ```
  deactivate
  ```

PS C:\\> python3 -m venv .venv\
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Apps > Advanced app settings > App execution aliases.\
PS C:\\> python --version\
Python 3.13.1\
PS C:\\> python --version\
Python 3.13.1\
PS C:\\> python3 -m venv .venv\
PS C:\\> source .venv/bin/activate\
source: The term 'source' is not recognized as a name of a cmdlet, function, script file, or executable program.\
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.\
PS C:\\> .venv\Scripts\Activate\
(.venv) PS C:\\>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://agenticai.kasinathanramesh.vip/section-4-python-sdk-and-node-configuration/class-30thmay2026.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
