Setting up Python, Visual Studio Code and Jupyter Notebooks
In this course will will use, Python, Visual Studio Code and Jupyter Notebooks to do our classroom work.
We selected these tools because they are the most popular development environments
in data science today. You are free to use other tools in this course, however
you may need to use generative AI to translate our code into other systems.
In addition, we strongly recommend each student create their own personal
GitHub repository to store their work. Because GitHub is backed up the
students only need to check their code into GitHub using either a command line
or Source Control section of Visual Studio Code.
We will be using the following tools for our desktop setup:
Jupyter Notebooks are essential for this course as they provide an interactive environment for data science work. There are several ways to install and use Jupyter Notebooks:
Method 1: Install via Conda (Recommended)
After activating your conda environment, install Jupyter:
12
condaactivateds
condainstalljupyter
Method 2: Install via Pip
Alternatively, you can install using pip:
1
pipinstalljupyter
Method 3: Install JupyterLab (Enhanced Interface)
For a more modern interface, you can install JupyterLab:
1
pipinstalljupyterlab
Running Jupyter Notebooks
Starting Jupyter Notebook Server
To start the Jupyter Notebook server:
12345
# Activate your environment first
condaactivateds
# Start Jupyter Notebook
jupyternotebook
This will:
1. Start a local server (usually at http://localhost:8888)
2. Automatically open your web browser to the Jupyter interface
3. Display your file system where you can create new notebooks or open existing ones
Starting JupyterLab
If you installed JupyterLab:
1
jupyterlab
Using Jupyter Notebooks in Visual Studio Code
Visual Studio Code provides excellent built-in support for Jupyter Notebooks, offering a seamless development experience.
Installing the Jupyter Extension
Open Visual Studio Code
Go to the Extensions view (Ctrl+Shift+X or Cmd+Shift+X)
Search for "Jupyter"
Install the official "Jupyter" extension by Microsoft
Working with Notebooks in VS Code
Creating a New Notebook:
1. Open VS Code
2. Create a new file with .ipynb extension (e.g., my_analysis.ipynb)
3. VS Code will automatically recognize it as a Jupyter notebook
Selecting Python Interpreter:
1. Open a notebook file
2. Click on "Select Kernel" in the top-right corner
3. Choose your conda environment (ds) as the Python interpreter
Running Code Cells:
- Run Single Cell: Click the play button next to a cell or press Shift+Enter
- Run All Cells: Use Ctrl+Shift+P (or Cmd+Shift+P) and search "Jupyter: Run All Cells"
- Add New Cell: Click the + Code or + Markdown buttons between cells
Advantages of Using Jupyter in VS Code
Integrated Development: Code editing, debugging, and notebook execution in one interface
Git Integration: Easy version control for notebook files
IntelliSense: Code completion and syntax highlighting
Variable Explorer: View variables and data structures in real-time
Debugging Support: Set breakpoints and debug notebook code
Extensions: Access to VS Code's rich extension ecosystem
Installing Essential Data Science Packages
Install the core packages you'll need for this course:
12345678
# Activate your environment
condaactivateds
# Install essential data science packages
pipinstallpandasnumpymatplotlibseabornscikit-learnjupyter
# Optional: Install additional useful packages
pipinstallplotlyipywidgets