Tutorial
How to Setup a Windows Laptop for Data Science
powershell, WSL, Python, Cuda and more!
I’ve been a Mac user ever since I started my journey into data science and ML.
But as part of the Z by HP Global Ambassadors program, I was lucky enough to get my hands on powerful HP hardware, specifically the HP Z6 G5 Tower Workstation. Here’s the specs:
- Processor: AMD Ryzen Threadripper PRO 7965WX 24-Cores 4.20 GHz
- Installed RAM: 256 GB (255 GB usable)
- System type: 64-bit operating system, x64-based processor
- Graphics: NVIDIA RTX 6000 Ada 48 GB 4DP Graphics
I’ve never had compute power of this scale to train models so I’m super excited to get started.
To get everything setup, I did some research and reading and decided to write this article which outlines what I did to get my PC up and running for doing data science work.
Note: this is by no means the best way to setup your windows, it is just personal perference. Please leave your thoughts and suggestions in the comments!
Let’s dive in!
Step 1: Install PowerShell 7 Using Winget
First, we need to install PowerShell 7. This can be done easily using winget
, the Windows Package Manager.
winget install --id Microsoft.Powershell --source winget
winget install --id Microsoft.Powershell.Preview --source winget
Step 2: Install WSL
Windows Subsystem for Linux (WSL) allows you to run a Linux distribution alongside your Windows installation. Here’s how to set it up:
1. Enable the “Virtual Machine Platform” feature on Windows:
- Go to “Turn Windows features on or off”.
- Check the checkbox near “Virtual Machine Platform”.
2. Install WSL:
wsl --install
3. Set WSL2 version
wsl --set-default-version 2
4. Check the WSL version:
wsl -l -v
Install Ubuntu
1. Install Ubuntu:
wsl - install -d Ubuntu
2. Run Ubuntu:
wsl - distribution Ubuntu
3. Shut down Ubuntu:
wsl -t Ubuntu
4. Check OS status:
wsl - list - verbose
5. Exit WSL:
exit
In the Terminal app, set Ubuntu as default.
upgrade packages
sudo apt update && sudo apt upgrade
Find more linux commands
Step 4: Install ZSH and Oh My Zsh
ZSH offers smarter tab auto-completion, aliases, and other features that make it a great shell for development.
1. Install ZSH:
sudo apt-get install zsh
2. Install Oh My Zsh:
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Find themes and plugins to customize your ZSH setup.
Step 5: Setup Git
1. Generate a new SSH key and add it to the ssh-agent
ssh-keygen -t ed25519 -C "your_email@example.com"
2. Add a new SSH key to your GitHub account
3. Configure your username and email
git config --global user.name "Your Name"
git config --global user.email "your_email@example.com"
Step 6: Setup CUDA
CUDA allows you to leverage the power of NVIDIA GPUs for computational tasks.
Install the GCC compiler:
sudo apt install gcc --fix-missing
Install Nvidia CUDA toolkit:
sudo apt install nvidia-cuda-toolkit
check the Driver and CUDA versions:
nvidia-smi
nvcc -V
Step 7: Install Python with Mamba
Mamba is a package manager that’s a drop-in replacement for conda and is generally faster at resolving dependencies
Miniforge distribution >= Miniforge3-22.3.1-0
wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh
bash Miniforge3-Linux-x86_64.sh
Example usage: Create a new environment and install JupyterLab:
mamba create -n myjlabenv jupyterlab -c conda-forge
mamba activate myjlabenv # activate our environment
jupyter lab # this will start up jupyter lab and open a browser
Install Cursor (optional)
I’ve switched to Cursor from VSCode because of how well it integerates LLM into your entire codebase.
Get the WSL VSCode extension to connect your Linux distro.
Testing Cuda
Search nvidia control panel, and select “Allow access to GPU performance counters to all users”
pip install torch numpy
That’s all for this article.
I’ve heard that WSL is slow and now I’m considering dual booting my PC.
Let me know in the comments if you have any suggestions for what else I should install on my PC!
References
- Bea Stollnitz — Configuring your Windows development machine for data science
- How to Create a Perfect Machine Learning Development Environment With WSL2 on Windows 10/11
- How to Setup a Windows Machine for Machine Learning/Deep Learning Using an Nvidia Graphics Card (CUDA)
- Unlock Data Science Potential with Your Laptop
Thanks for reading
Be sure to follow the bitgrit Data Science Publication to keep updated!
Want to discuss the latest developments in Data Science and AI with other data scientists? Join our discord server!
Follow Bitgrit below to stay updated on workshops and upcoming competitions!
Discord | Website | Twitter | LinkedIn | Instagram | Facebook | YouTube