Author: Suyog Garg, Dated: 2025/11/18
This document is an introductory basics part for your tutorial series.
It covers three things:
You do not need Anaconda if you will only use Google Colab.
For local work on your own laptop or a lab machine, Anaconda is recommended.
Anaconda is a Python distribution that includes Python itself plus the conda package and environment manager.
We will use it to create a clean environment for the tutorial, without touching the system Python.
On any operating system:
The exact filenames change over time, but they look something like:
Anaconda3-202x.xx-Windows-x86_64.exeAnaconda3-202x.xx-MacOSX-x86_64.pkg or Anaconda3-202x.xx-MacOSX-arm64.pkgAnaconda3-202x.xx-Linux-x86_64.sh.exe file.C:\Users\yourname\anaconda3).Open the Anaconda Prompt from the Start menu and type:
conda --versionIf you see a version string, the install is working.
If you downloaded a .pkg installer:
.pkg file and follow the GUI steps./Users/yourname/anaconda3).If you downloaded a .sh installer:
Change directory to where you downloaded the installer, for example:
cd ~/Downloads
bash Anaconda3-202x.xx-MacOSX-x86_64.shPress Enter to scroll through the license, type yes to accept.
Press Enter to accept the default install location.
When the installer asks to run conda init, answer yes.
Close and reopen the Terminal window, then run:
conda --versionIf a version number appears, Anaconda is correctly installed.
Change directory to where you downloaded the .sh installer, for example:
cd ~/Downloads
bash Anaconda3-202x.xx-Linux-x86_64.shRead or scroll through the license and type yes to accept.
Accept the default install path (for example /home/yourname/anaconda3).
When asked whether to run conda init, answer yes.
Close and reopen the terminal, then run:
conda --versionIf you see a version number, everything is set.
We will create one environment and reuse it for all parts of the tutorial.
You can choose any name. In this guide we use gwml-env.
conda create -n gwml-env python=3.11 -yActivate it:
conda activate gwml-envFrom now on, whenever you work on the tutorial in a terminal, first activate this environment with conda activate gwml-env.
Part 1 of your tutorial may already describe basic
pip installsteps.
The important thing is that thosepipcommands are always run inside this environment.
Part 3 (CNN on MNIST with Keras, TensorFlow, PyTorch, scikit-learn) needs extra libraries that are listed in Part3_requirements.txt:
numpy
matplotlib
scikit-learn
scikeras
tensorflow
torch
torchvisionMake sure you have activated the environment first:
conda activate gwml-envThen, in the folder where your tutorial repository lives (and where part3_requirements.txt is stored), run:
pip install -r Part3_requirements.txtThis installs all the Part 3 dependencies into the same environment.
You only need to run this once per environment.
If you prefer conda for some packages (for example to get GPU builds of PyTorch or TensorFlow), you can mix and match:
# Example: CPU baseline from conda-forge
conda install -c conda-forge numpy matplotlib scikit-learn scikeras -y
# Then use pip only for framework builds you want
pip install tensorflow
pip install torch torchvisionThe exact commands for GPU enabled frameworks depend on your GPU and drivers, but the basic idea is the same: install everything while gwml-env is active.
If Jupyter Notebook is not already installed in your environment:
conda activate gwml-env
pip install notebookOr via conda:
conda activate gwml-env
conda install notebook -yActivate the environment:
conda activate gwml-envStart Jupyter Notebook:
jupyter notebookA browser window will open. Navigate to the folder where your Part 1, Part 2, and Part 3 .ipynb files live.
Open the notebook you want to run.
Ensure the kernel is the one for gwml-env:
If you do not see a separate kernel, you can add one with:
python -m ipykernel install --user --name gwml-env --display-name "Python (gwml-env)"after which it will appear in the kernel list.
Once the right kernel is selected, you can run all cells, including the ones that use TensorFlow, PyTorch, Keras, and scikit-learn.
The steps are almost the same as for Notebook.
Inside the environment:
conda activate gwml-env
pip install jupyterlab
# or
conda install jupyterlab -yconda activate gwml-env
jupyter labJupyterLab will open in your browser. From there:
Since the same environment is used for both Notebook and Lab, the libraries installed by pip install -r part3_requirements.txt are available in both.
Google Colab is a free cloud based environment provided by Google.
It runs Jupyter style notebooks in your browser on a remote machine. You do not need to install Python or Anaconda locally to use it.
.ipynb file directly.Shift+Enter.Colab comes with many libraries preinstalled (NumPy, matplotlib, TensorFlow, etc.), but not always the exact versions you want.
You can install extra packages at the top of the notebook with a special cell:
# Colab only: install or upgrade tutorial dependencies
!pip install -q scikeras torch torchvisionUse !pip install only in Colab notebooks. For local Anaconda environments, install with pip or conda in your terminal instead.
If you want to accelerate training in Part 3:
Your code can then check for GPU devices using the normal TensorFlow or PyTorch APIs.
gwml-env.Part3_requirements.txt) inside that environment.!pip install cell at the top).