π DS202 β Python Environment Setup
2025/26 Winter Term
In this course, you are all expected to use VS Code for running notebooks and working with Python.
We use Conda environments to ensure everyone runs the same software, regardless of operating system.
You will create two environments during the course:
| Environment | Python | When used |
|---|---|---|
py313-core |
3.13 | Weeks 01β04 (core ML, pandas, evaluation, pipelines) |
py312-full |
3.12 | Weeks 05+ (tree-based models, NLP, autoencoders) |
β οΈ Important
Starting in Week 05, you must switch to the Python 3.12 environment.
Tree-based models such as XGBoost, LightGBM, and CatBoost are not reliably supported on Python 3.13.
π½ Configuration files (download first)
Before you start, download the configuration files from the course repository.
Save all three files in the same folder on your computer.
β¬οΈ Python 3.13 β core environment
Download py313-core.yml
β¬οΈ Python 3.12 β full environment
Download py312-base.yml
β¬οΈ Extra pip packages (Python 3.12)
Download requirements-py312.txt
1. Install Anaconda
If you havenβt done so already, install Anaconda (latest version) for your operating system:
https://www.anaconda.com/download
During installation:
- accept the default options (on Windows, try and make sure you install Anaconda for all users and you check the option to add Anaconda to PATH in the installer)
- do not install another Python distribution separately
2. Open a terminal (inside VS Code)
All commands below should be run inside VS Code.
- Open VS Code
- Open the course folder
- Open a terminal via
View β Terminal
On different systems, the terminal may be:
- Windows: Command Prompt or PowerShell
- macOS: zsh
π‘ On Windows, CMD or PowerShell is fine as long as
condaandpythonwork when you type them.
If they donβt, open Anaconda Prompt, then start VS Code from there.
Check that Conda and Python are available:
conda --version
python --version3. One-time Conda configuration
Run the following once:
conda config --set channel_priority strict
conda config --set solver libmamba
conda config --add channels conda-forge
conda config --add channels pytorchThis makes installations faster and avoids conflicts.
4. Create the core environment (Python 3.13 β Weeks 01β04)
Navigate to the folder where you saved the downloaded files:
cd path/to/your/folder(obviously replace path/to/your/folder by the actual path to the folder in your computer where you saved the downloaded files!)
Create the environment:
conda env create -f py313-core.ymlActivate it:
conda activate py313-coreQuick check
python -c "import pandas, sklearn; print('py313-core is working')"5. Register the Python 3.13 kernel for VS Code
python -m ipykernel install \
--name py313-core \
--display-name "Python 3.13 (core)"It could well be that this command canβt run on your system as is (likely on Windows). If that is the case, simply remove the \ characters in this command and make sure the command is all in one line i.e something like bash python -m ipykernel install --name py313-core --display-name "Python 3.13 (core)"
π‘ In VS Code: Open a notebook (
.ipynb), click the kernel selector (top right), and choose Python 3.13 (core).
6. Create the full environment (Python 3.12 β from Week 05)
Starting in Week 05, you will switch to a second environment that supports tree-based models and more advanced libraries.
conda env create -f py312-base.yml
conda activate py312-full7. Install additional packages (pip step β Python 3.12 only)
Some packages are only available via pip.
With py312-full activated:
pip install -r requirements-py312.txtβ οΈ Only run the commands in this section once the py312-full environment is activated!
8. Download NLP resources (important)
These datasets are not installed automatically.
Run once in py312-full:
python -m nltk.downloader punkt stopwords
python -m spacy download en_core_web_smβ οΈ Only run the commands in this section in the activated py312-full environment!
9. Register the Python 3.12 kernel for VS Code
python -m ipykernel install \
--name py312-full \
--display-name "Python 3.12 (full)"ποΈ Same remark as in section 5 regarding multiline commands.
π‘ In VS Code: Open a notebook and select Python 3.12 (full) as the kernel.
10. Final checks
Activate the environment:
conda activate py312-fullOption A β One-line check
python -c "import numpy, spacy; from bertopic import BERTopic; print('py312-full is working')"Option B β Interactive check
pythonThen type:
import numpy
import spacy
from bertopic import BERTopic
print("py312-full is working")Exit Python with:
- Windows:
Ctrl+ZthenEnter - macOS:
Ctrl+D
11. Important rules
- Use VS Code for all labs and assignments
- Do not install packages in
base - Always activate the correct environment
- Do not mix
pipandcondaunless instructed.condahandles dependencies much better than pip does, so packages should be installed withcondaunless they are only available viapip(installing other packages withpipcan break your environment). - If something breaks badly: delete and recreate the environment
12. Getting help
If you are stuck:
- copy the exact error message
- note which environment you are using
- ask on Slack or during drop-in sessions
Environment issues are much easier to fix early π
