If you’re working on a project and want to isolate your Python environment (without using Conda), this guide will walk you through setting it up in VS Code using native venv
.
✅ Pre-requisite: Python must be installed on your system.
🔧 Step-by-Step Setup
✅ STEP 1: Open VS Code and Terminal
- Open VS Code
- Press
command + `
to launch the terminal
📁 STEP 2: Create Your Project Directory
mkdir LLMEngg
cd LLMEngg
🛠️ STEP 3: Create a Virtual Environment
python -m venv LLMEngg
⚙️ STEP 4: Activate Virtual Environment in VS Code
- Open the Command Palette (⇧ + ⌘ + P or
Ctrl + Shift + P
) - Search for and select: Python: Select Interpreter
- Choose:
Python 3.12.4 ('LLMEngg')
📦 STEP 5: Create requirements.txt
vi requirements.txt
Add the following:
numpy
pandas
scikit-learn
♻️ STEP 6: Reopen VS Code (Important!)
🧪 STEP 7: Verify the Environment
In the terminal, check the Python path:
which python
Example output:
/Users/vamsi/Desktop/PREP/LLMEngg/LLMEngg/bin/python
Now install dependencies:
pip install -r requirements.txt
🧠 STEP 8 (Optional): Install PyTorch
pip3 install torch torchvision
Validate:
import torch
x = torch.rand(5, 3)
print(x)
🚀 Bonus: Speed Up Your Workflow
1️⃣ Set Alias in .zshrc
(macOS)
alias llm="cd /Users/vamsi/Desktop/PREP/LLMEngg"
🔁 Reusing the Environment (Next Time)
- In terminal:
llm
- Launch VS Code:
code .
- Repeat interpreter selection:
- Open Command Palette
- Choose Python: Select Interpreter
- Select:
Python 3.12.4 ('LLMEngg')
🎉 You’re all set! This lightweight setup gives you a clean, isolated Python environment in just a few minutes — no Conda required.