Setting PyTorch Environment for CPU#
This page describes the process to setup a PyTorch environment in your machine.
Follow the steps to install Python and virtual environment tools for your OS:
Windows or Linux, then follow the steps to create a venv
where you will run the getting started examples.
Alternative, you can setup VS Code in any of the supported OSes.
Pre-requisites#
AMD EPYC™ Processors, AMD Ryzen™ Processors or AMD Ryzen™ AI Processors
Your platform is: Loading...
Windows#
Click here to download Python 3.12.8 or find the latest release of Python here python.org/downloads/windows/ select Windows installer (64-bit)
Note
Python 3.13 has not been verified.
Follow the steps in the Python documentation after executing the installer.
Once you complete the installation, open a Windows PowerShell.
Confirm that Python is installed by checking the version
python -c "import sys; print(sys.version)"
Continue by creating the venv.
Linux#
We will use a Python virtual environment (venv) to install the dependencies.
Open a new terminal and install python3-venv.
sudo apt install python3-pip python3-venv libgl1
Confirm that Python is installed by checking the version
python3 -c "import sys; print(sys.version)"
Continue by creating the venv.
Create venv#
Navigate to a directory where you would like to create the venv, then create the venv.
cd /path/to/directory/
mkdir aupai
python3 -m venv aupai
cd /path/to/directory/
mkdir aupai
python -m venv aupai
Activate the venv.
source aupai/bin/activate
./aupai/Scripts/Activate.ps1
./aupai/Scripts/activate.bat
Confirm that you are inside the venv.
python -c "import sys; print(f'Running on venv: {sys.prefix != sys.base_prefix}')"
Note
You can deactivate the venv with deactivate.
Continue by installing package dependencies.
Visual Studio Code#
If you prefer working from a code editing tool, you can setup VS Studio code.
Install Package Dependencies#
Inside the venv execute the following to install the necessary dependencies.
python -m pip install "torch>2.3" "numpy<2" torchvision fvcore
python -m pip install av validators matplotlib jupyterlab jupyter transformers SentencePiece accelerate ultralytics==8.0.196 wheel
python -m pip install tiktoken einops pytest Pillow Requests jupyterlab_myst torchinfo "onnx>=1.16.2" netron tqdm shap kaggle roboflow==1.1.47 pickleshare
python -m pip install jupyter-book sphinxcontrib-mermaid sphinx_design
Note
If you are using VS Code, you can open a new terminal by Ctrl+Shift+` or Terminal > New Terminal. For more information,
checkout Install and use packages.
This process can take a few minutes to download and install.
You are now all set to get started with pre-trained models in AMD CPUs.
Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved.
SPDX-License-Identifier: MIT