[Data Analysis Tools] First Launch: Configuring Visual Studio Code

Sam Taylor
5 min readSep 16, 2023

--

Learn how to set up Visual Studio Code (VS Code) for data analysis, from installing Python and selecting Jupyter Notebook kernels to adding essential extensions (Python, R, SQL, Jupyter). Your data journey begins here!

Key concepts:

Visual Studio Code · Python · Pandas · Data analysis

Photo by Joshua Aragon on Unsplash

Introduction

Are you ready to dive into the exciting world of data analysis but don’t know where to start? Well, you’re in the right place! In this beginner-friendly guide, we’ll walk you through the process of setting up Visual Studio Code for data analysis. We’ll cover everything from installing a Python environment to selecting a kernel and adding essential extensions like Python, R, SQL, and Jupyter Notebook. Let’s get started!

Step 1: Installing Visual Studio Code

If you haven’t already, the first step is to install Visual Studio Code. It’s a free, open-source code editor that’s incredibly versatile and widely used by data analysts and developers. Simply follow these steps:

  • Visit the Visual Studio Code website.
  • Click on the “Download for [your operating system]” button.
  • Once the download is complete, run the installer and follow the on-screen instructions.

If you need further instructions, check out our step-by-step guide.

Installing VS Code for macOS

Step 2: Installing VS Code Extensions

Extensions add functionality to VS Code, making it a versatile tool for data analysis. Some recommended extensions to install are: Python, R, SQL, and Jupyter Notebook.

To install extensions in VS Code:

  • Open VS Code.
  • Go to the Extensions view by clicking on the Extensions icon in the Activity Bar on the left side of the window.
    ◦ You can also press Ctrl+Shift+X on your keyboard.
  • In the extension search bar, search for and install the following extensions:
    ◦ Python
    ◦ R Language
    ◦ SQL Server (mssql)
    ◦ Jupyter
Installing extensions in VS Code

Step 3: Installing Required Programs and Packages on your Computer

In order to open our first file in VS Code, we need to install 2 more things on our computer: Python and Jupyter.

These will then allow us to select a ‘kernel’, which are essential for running code in VS Code. Kernels essentially determine which programming language your notebook will use (typically Python or R for data analysis).

To install Python

For Windows:

  • Visit the Python Download Page: Open your web browser and go to the Python download page: https://www.python.org/downloads/windows/
  • Choose the Python Version: You will see the latest versions of Python available for Windows. Choose the version that matches your system architecture (64-bit or 32-bit).
  • Download the Installer: Click on the download link for the version you selected. This will start the download of the Python installer executable (e.g., python-3.x.x.exe).
  • Run the Installer: Once the download is complete, locate the installer file and double-click it to run the installer.
  • Configure Python Installation: On the first installation screen, make sure to check the box that says “Add Python x.x to PATH.” This is important as it allows you to run Python from the command line easily.
  • Start the Installation: Click the “Install Now” button to start the installation. Python will be installed with the default settings.
  • Complete the Installation: Wait for the installation to complete. Once done, you should see a screen indicating that Python has been successfully installed.
  • Verify the Installation: Open a command prompt or PowerShell window and type python or python3. You should see the Python interpreter launch, displaying its version and prompt. You can exit the Python interpreter by typing exit().

For macOS:

  • Visit the Python Download Page: Open your web browser and go to the Python download page: https://www.python.org/downloads/mac-osx/
  • Choose the Python Version: You will see the latest versions of Python available for macOS. Download the macOS installer package (.dmg file) for the version you want.
  • Run the Installer: Open the downloaded .dmg file. You will typically see a Python installer package file. Double-click it to run the installer.
  • Install Python: Follow the on-screen instructions to install Python. Make sure to check the option that adds Python to your PATH during installation.
  • Verify Installation: Open Terminal and type python3. You should see the Python interpreter launch, displaying its version and prompt. You can exit the Python interpreter by typing exit().

For Linux:

Most Linux distributions come with Python pre-installed. You can check if Python is already installed by opening the terminal and typing python3.

If Python is not installed, you can typically install it using your system’s package manager.

For example, on Debian-based systems like Ubuntu, you can use:

sudo apt update
sudo apt install python3

On Red Hat-based systems like CentOS or Fedora, you can use:

sudo yum install python3

To install Jupyter:

Now that Python is installed, we can use the terminal to install Jupyter. To do so:

  • Open the terminal: In the terminal or command prompt, type the following command, followed by the Enter key:
pip install jupyter
Installing Jupyter on your computer via the terminal

Step 4: Opening a New File in VS Code

With the above done, we can finally open our first file in VS Code. To do so:

  • Open or Create a Jupyter Notebook File: In VS Code, either open an existing Jupyter Notebook file (with a .ipynb extension) or create a new one by going to the “File” menu and selecting “New Notebook.”
  • Select a Kernel: Once you have your notebook open, look at the top-right corner of the notebook interface. You’ll see a dropdown menu with the current kernel name (e.g., “Python 3”). Click on this dropdown menu.
  • Choose the Desired Kernel: A list of available kernels will appear. Select the one that corresponds to the programming language you want to use for your notebook.
    ◦ For data analysis, Python is the most common choice, so you’ll usually select “Python 3” or “Python 3.x” if multiple versions are listed.
  • Kernel Initialization: After selecting the kernel, VS Code will initialize it. This process may take a moment. Once the initialization is complete, you’ll be ready to start writing and executing code in your chosen language within the Jupyter Notebook.
Opening a new Jupyter notebook in VS Code & adding a kernel

And that’s it! You can now write and execute Python, R, and SQL code, create interactive Jupyter Notebooks, and enjoy a seamless experience tailored for data analysis.

You’re now set up to begin your data analysis journey.

--

--

Sam Taylor

Operations Analyst & Data Enthusiast. Sharing insights to support aspiring data analysts on their journey 🚀. Discover more at: https://samtaylor92.github.io