Getting started - Build your data science lab environment
This guide explains how to set up a complete data science environment for the udemy program. A proper setup ensures compatibility and avoids recurring environment issues.
1. Overview
-
Goal: Create a full-featured environment with sufficient resources for all course exercises.
-
Recommendation: Use Anaconda for the most reliable setup.
-
Alternative: Use a Python virtual environment with
pipif Anaconda isn’t working.
2. Setup Options
Primary (Recommended)
-
Create a dedicated Anaconda environment (isolated, compatible).
Alternative
-
Use a standard Python virtualenv + pip (faster but less reliable).
3. Windows Setup Steps
Clone Course Repository
git clone https://github.com/ed-donner/llm_engineering/
Follow the repository’s README.md instructions for additional setup details.
Create Anaconda Environment
Inside the llm_engineering folder:
conda env create -f environment.yml
⏳ This may take several minutes.
Activate the environment:
conda activate llms
Deactivate when finished:
conda deactivate
Fix Activation Issues
If you see:
Run 'conda init' before 'conda activate'
Initialize Conda for PowerShell (one-time):
conda init powershell
Close and reopen PowerShell.
Allow Script Execution (Windows only):
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
Press Y to confirm.
Optional Immediate Fix (No Restart)
& "C:\Users\<YourUsername>\anaconda3\shell\condabin\conda-hook.ps1"
conda activate llms
4. Configure PowerShell Profile
Edit this file:
C:\Users\<YourUsername>\OneDrive\Documents\WindowsPowerShell\profile.ps1
Replace contents with:
#region conda initialize
# !! Contents within this block are managed by 'conda init' !!
If (Test-Path "C:\Users\<YourUsername>\anaconda3\Scripts\conda.exe") {
(& "C:\Users\<YourUsername>\anaconda3\Scripts\conda.exe" "shell.powershell" "hook") | Out-String | ?{$_} | Invoke-Expression
}
#endregion
Save and restart PowerShell.
5. Set Up API Keys
Create OpenAI API Key
-
Visit OpenAI API Keys.
-
Generate a new key and copy it (starts with
sk-...). -
You won’t see it again, so store it securely.
Create .env File
In your project root directory, create a file named .env:
OPENAI_API_KEY=sk-your-key-here
Make sure the file is named exactly
.env(not.env.txt).
6. Launch JupyterLab
Activate your environment:
conda activate llms
jupyter lab
JupyterLab will open in your browser.
Comments
Post a Comment