Introduction
Hello tech enthusiasts! Pradeep here, your trusted source for all things related to machine learning, deep learning, and Python. As you know, I’ve previously covered setting up TensorFlow on Windows. Today, I’m excited to bring you a detailed guide on setting up another popular deep learning framework, PyTorch, with GPU support on Windows 11.
In this modern era of AI and ML, PyTorch has emerged as a go-to framework for researchers and developers alike, thanks to its dynamic computation graph, ease of use, and a thriving community. Whether you are a seasoned deep learning practitioner or a curious beginner, PyTorch has something for everyone.

In this article, I will walk you through the process of installing and configuring PyTorch with GPU support on your Windows 11 machine, specifically tailored for an AMD Ryzen 2970WX CPU and NVIDIA RTX 2070 GPU. By the end of this tutorial, you will have a fully functional PyTorch environment, ready to power your next AI project.
So, let’s dive right in and set up PyTorch with GPU support on Windows 11, ensuring you can harness the full potential of your hardware to accelerate your deep learning experiments!
My Setup – A High-Performance Environment for Deep Learning
In this tutorial, I will be using a powerful hardware configuration designed for optimal deep learning performance. The components I’ve chosen provide an excellent balance between computing power, speed, and affordability. Here’s a quick overview of my setup:
- Operating System: Windows 11 Windows 11 is the latest and most advanced version of the popular Windows operating system. With improved performance, better security, and enhanced compatibility, Windows 11 offers a great foundation for our deep learning setup.
- CPU: AMD Ryzen 2970WX The AMD Ryzen Threadripper 2970WX is a 24-core, 48-thread processor that delivers outstanding multitasking capabilities and exceptional performance for complex workloads. With a base clock speed of 3.0 GHz and a max boost clock speed of 4.2 GHz, this CPU ensures that our PyTorch installation runs smoothly and efficiently.
- Motherboard: ASUS ROG X399 The ASUS ROG X399 motherboard is built to handle the power of AMD’s Ryzen Threadripper processors. With support for quad-channel DDR4 memory, multiple PCIe slots, and extensive connectivity options, this motherboard provides a solid foundation for our high-performance setup.
- GPU: NVIDIA RTX 2070 The NVIDIA GeForce RTX 2070 is a powerful graphics card that accelerates deep learning tasks using its Turing architecture and 8 GB of GDDR6 memory. With 2304 CUDA cores and Tensor Cores for AI workloads, the RTX 2070 enables faster training times and smoother experimentation with PyTorch.
- Python and Environment Management: Miniconda Miniconda is a minimal distribution of the popular Anaconda Python distribution. It provides a lightweight yet powerful environment for managing Python packages and virtual environments. In this tutorial, we will be using Miniconda to install and manage our PyTorch environment, ensuring that all dependencies are properly isolated and maintained.
With this high-performance setup in place, we are now ready to dive into the process of installing and configuring PyTorch with GPU support on Windows 11. In the following sections, we’ll go step by step through the installation process, ensuring that you can harness the full potential of your hardware for accelerated deep learning experiments.

Summary of Installation Steps
In this blog post, we will guide you through the process of setting up PyTorch with GPU support on Windows 11. Here’s a summary of the installation steps we will cover:
- System Prerequisites:
- Update your system to the latest version of Windows 11.
- Ensure that your GPU drivers are up to date.
- Install Miniconda:
- Download the latest version of Miniconda for Windows.
- Follow the installation instructions to set up Miniconda on your system.
- Create a Conda Environment:
- Create a new Conda environment to manage the PyTorch installation and its dependencies separately from your base Python installation.
- Setup CUDA Toolkit (11.7) for Windows 11
- Install the CUDA Toolkit by visiting the Nvidia Downloads page
- Install PyTorch with GPU Support:
- Use the official PyTorch installation command to install the appropriate version of PyTorch with GPU support in your new Conda environment.
- Install Additional Packages (Optional):
- Install any additional Python packages that you may need for your deep learning projects, such as NumPy, Pandas, or Matplotlib.
- Verify the Installation:
- Test your PyTorch installation by running a simple script to ensure that it is functioning correctly and utilizing your GPU.
By following these steps, you will have a fully functional PyTorch environment with GPU support on your Windows 11 machine, ready to power your next AI project.

Step 1 – System Prerequisites
Before we begin the installation process, it is crucial to ensure that your system meets the necessary requirements and prerequisites. This will help avoid any compatibility issues or performance bottlenecks during the installation and usage of PyTorch. Here’s what you need to do:
- Update Windows 11: To start, make sure your system is running the latest version of Windows 11. Microsoft regularly releases updates to improve performance, stability, and security. To check for updates, follow these steps:
- Click on the “Start” button and select “Settings.”
- Choose “Windows Update” from the left sidebar.
- Click on “Check for updates” and install any available updates.
- Restart your system if required.
- Update GPU Drivers: Having up-to-date GPU drivers is essential for optimal performance and compatibility with PyTorch. To update your NVIDIA RTX 2070 GPU drivers, follow these steps:
- Visit the NVIDIA Driver Downloads page (https://www.nvidia.com/Download/index.aspx).
- Select your GPU model (GeForce), series (RTX 20 Series), and specific model (RTX 2070).
- Choose “Windows 11 64-bit” as your operating system and click on “Search.”
- Download the latest driver version and run the installer.
- Follow the on-screen instructions to complete the installation.
- Restart your system if required.
By completing these two prerequisites, you ensure that your Windows 11 system and NVIDIA GPU are ready for a smooth PyTorch installation. In the next section, we will install Miniconda to manage our Python environment and dependencies.
Step 2 – Install Miniconda
Miniconda is a lightweight distribution of the popular Anaconda Python distribution, which provides an efficient way to manage Python packages and virtual environments. In this step, we will guide you through the process of installing Miniconda on your Windows 11 system.
- Download Miniconda Installer: Visit the Miniconda Downloads page (https://docs.conda.io/en/latest/miniconda.html) and download the latest version of the Miniconda installer for Windows. Make sure to choose the Python 3.x version (64-bit) suitable for your system.
- Run the Miniconda Installer: Locate the downloaded Miniconda installer (usually in your “Downloads” folder) and double-click on the executable file (.exe) to start the installation process.
- Follow the Installation Steps: During the installation, follow these recommendations:
- Choose “Just Me (recommended)” when asked to select the installation type.
- Accept the default installation location or choose a custom path if you prefer.
- Check the box to “Add Miniconda3 to my PATH environment variable.” Although not recommended by the installer, this step will simplify the usage of Conda commands in the command prompt.
- Click on “Install” to start the installation.
- Complete the Installation: Once the installation is complete, click on the “Finish” button to close the installer.
- Verify the Installation: To verify that Miniconda has been installed correctly, open a new command prompt by pressing
Win + X
and selecting “Windows Terminal” or “Command Prompt.” Typeconda --version
and press Enter. If the installation was successful, you should see the Conda version displayed in the terminal.
Now that Miniconda is installed, you can use it to create and manage Python environments and packages. In the next section, we will create a new Conda environment specifically for our PyTorch installation.

Step 3 – Create a Conda Environment
Creating a separate Conda environment for our PyTorch installation allows us to manage its dependencies independently from the base Python installation. This ensures a clean and isolated workspace for our deep learning projects. In this section, we will guide you through the process of creating a new Conda environment.
- Open the Command Prompt: Press
Win + X
and select “Windows Terminal” or “Command Prompt” to open a new terminal window. - Create a New Conda Environment: To create a new Conda environment, use the following command, replacing
<env_name>
with a descriptive name for your environment (e.g.,pytorch-gpu
):
conda create --name pytorch-gpu-python-3-10 python=3.10
In this example, we’re creating an environment with Python 3.8. You can choose a different Python version if you prefer, but make sure it’s compatible with the PyTorch version you plan to install.

Press Enter and wait for the environment creation process to complete. Conda will automatically install the specified Python version and its essential packages in the new environment. Please make sure to replace with the environment name that woould like to have, example I am using pytorch-gpu-python-3-10 as the name but you could call it something like pytorch-gpu only.
- Activate the Conda Environment: Before you can use the newly created Conda environment, you need to activate it. To do this, run the following command, replacing
<env_name>
with the name of your environment:
conda activate pytorch-gpu-python-3-10
Once the environment is activated, you will see the environment name in parentheses at the beginning of the command prompt, indicating that you are currently working in the new environment.
With the Conda environment set up and activated, we can now proceed to install PyTorch with GPU support in the next section.
Step 4 – CUDA Toolkit for Windows 11
You can download and install the CUDA toolkit by visiting this link https://developer.nvidia.com/cuda-11-7-0-download-archive (we are using CUDA toolkit 11.7 – as of this writing pytorch 2.0 works with CUDA 11.7). As of this writing I am using CUDA Toolkit version 11.4. Download the installer (steps shown below – but they could change over time due to changes on Nvidia Website) and just click next until finished โ itโs simple.

Step 5 – Install PyTorch with GPU Support

In this step, we will guide you through the process of installing PyTorch with GPU support in your newly created Conda environment. By the end of this section, you will have a fully functional PyTorch installation, ready for GPU-accelerated deep learning.
- Visit the PyTorch Official Website: Go to the PyTorch official website (https://pytorch.org/get-started/locally/) and navigate to the “Install” page. Here, you will find a helpful installation command generator that provides the appropriate command based on your preferences and system specifications.
- Select the Installation Preferences: Choose the following options in the installation command generator:
- Package: Select “PyTorch.”
- Language: Choose “Python.”
- CUDA: Select the version compatible with your NVIDIA GPU and installed CUDA toolkit. For the NVIDIA RTX 2070, a common choice would be “CUDA 11.7” (if you have the corresponding version of the CUDA toolkit installed).
- Platform: Pick “Windows.”
The generator will produce an installation command that looks like this:
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117

Please note that the generated command may vary based on the selected options.
- Install PyTorch in the Conda Environment: Make sure your desired Conda environment is activated (you should see the environment name in parentheses at the beginning of the command prompt). Copy and paste the generated installation command into the terminal and press Enter.
Wait for the installation process to complete. Conda will automatically download and install PyTorch and its dependencies, including the appropriate GPU-accelerated version of the PyTorch library.

Once the installation is complete, you will have successfully set up PyTorch with GPU support in your Conda environment. In the next section, we will discuss installing additional packages, and then we will verify that the installation is functioning correctly.
Step 6 – Install Additional Packages (Optional)
While PyTorch provides the core functionality required for deep learning, you may want to install additional Python packages to enhance your workflow and improve productivity. In this section, we will discuss installing some popular packages often used alongside PyTorch, including Jupyter Notebook for interactive coding and visualization.
- Install Jupyter Notebook: To install Jupyter Notebook in your Conda environment, run the following command:
conda install -c conda-forge notebook
Wait for the installation process to complete. Conda will automatically download and install Jupyter Notebook and its dependencies.
- Add Conda Environment Kernel to Jupyter: To use the current Conda environment as a kernel in Jupyter Notebook, you first need to install the
ipykernel
package by running:
conda install -c conda-forge ipykernel
Once the ipykernel
package is installed, add the Conda environment as a new kernel by running:
python -m ipykernel install --user --name pytorch-gpu-python-3-10 --display-name "Pytorch GPU (Python 3.10)"
Replace "pytorch-gpu-python-3-10"
with the name of your Conda environment (e.g., pytorch-gpu
) and "Pytorch GPU (Python 3.10)"
with a descriptive name that you like that will appear in the Jupyter Notebook interface (e.g., “PyTorch GPU”).
- Install Additional Deep Learning Packages: You can install other popular deep learning packages, such as NumPy, Pandas, Matplotlib, or scikit-learn, by running the following command:
conda install -c conda-forge numpy pandas matplotlib scikit-learn
Feel free to customize this command to include any other packages you may need for your projects.

After completing these steps, you will have a comprehensive deep learning environment equipped with PyTorch, Jupyter Notebook, and various additional packages. In the next section, we will verify that the PyTorch installation is functioning correctly and utilizing the GPU.
Step 6 – Verify the Installation
In this final step, we will verify that our PyTorch installation is functioning correctly and utilizing the GPU. We will create a simple script in a Jupyter Notebook to ensure that everything is set up as intended.
- Activate the Conda Environment (if not already active): If you haven’t already, activate your Conda environment by running the following command in the terminal, replacing
<env_name>
with the name of your environment:
conda activate pytorch-gpu-python-3-10
- Launch Jupyter Notebook: With the Conda environment activated, start the Jupyter Notebook by running:
jupyter notebook
Your default web browser should automatically open, displaying the Jupyter Notebook interface. If it does not open automatically, copy the URL displayed in the terminal (e.g., http://localhost:8888/?token=...
) and paste it into your browser’s address bar.
- Create a New Notebook: In the Jupyter Notebook interface, click the “New” button in the top right corner and select the kernel corresponding to your Conda environment (e.g., “PyTorch GPU”). A new notebook will open with the selected kernel.
- Verify the PyTorch Installation and GPU Support: In the first cell of the new notebook, enter the following code:
import torch
# Check if PyTorch is using the GPU
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
print(f"PyTorch is using: {device}")
# Print PyTorch version
print(f"PyTorch version: {torch.__version__}")
# Test a simple PyTorch tensor operation on the GPU
x = torch.tensor([2.0, 3.0], device=device)
y = torch.tensor([4.0, 5.0], device=device)
result = x * y
print(f"Result of tensor operation: {result}")
Press Shift + Enter
to run the cell. If the installation is successful and the GPU is being utilized, you should see output similar to the following:
PyTorch is using: cuda
PyTorch version: x.y.z
Result of tensor operation: tensor([ 8., 15.], device='cuda:0')
The output confirms that PyTorch is installed correctly, using the GPU for computations, and performing basic tensor operations without any issues.

With these verification steps complete, you now have a fully functional PyTorch environment with GPU support on your Windows 11 system, ready to power your next deep learning project. Happy coding!
Conclusion
In this tutorial, we have walked you through the process of setting up PyTorch with GPU support on a Windows 11 system. We covered the necessary system prerequisites, such as updating Windows 11 and GPU drivers, and installing Miniconda to manage Python environments and dependencies. We then demonstrated how to create a Conda environment, install PyTorch with GPU support, and set up additional packages like Jupyter Notebook.
By following these steps, you have successfully configured a dedicated deep learning environment, complete with the powerful PyTorch library and GPU acceleration. This will enable you to harness the full potential of your hardware for faster model training and experimentation. I hope that this tutorial has provided you with a solid foundation for your future deep learning projects using PyTorch on Windows 11.
Happy coding, and best of luck with your AI endeavors!

Leave a Reply