Development machine setup

Run the following on your development machine from a terminal.

Install pyenv and the tools required to build Python. On macOS (Apple silicon), install Homebrew first if it is not already available.

    

        
        

brew update
brew install pyenv xz


    
    

        
        

sudo apt update
sudo apt install -y \
  git curl ca-certificates build-essential \
  libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev \
  libncurses-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev \
  libffi-dev liblzma-dev

curl -fsSL https://pyenv.run | bash


    

Clone the repository and enter the directory:

    

        
        
git clone https://github.com/ArmDeveloperEcosystem/arm-courses-code-executorch.git ~/executorch_on_arm
cd ~/executorch_on_arm

    

Create a Python 3.12 virtual environment with pyenv and activate it:

    

        
        
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"

pyenv install -s 3.12.14
pyenv shell 3.12.14
python --version

    

Install the pinned Module 1 Python dependencies. These include PyTorch, ExecuTorch, the Hugging Face transformers library, matplotlib and numpy for collecting data and plotting graphs, and huggingface_hub for interfacing with Hugging Face.

    

        
        
python -m venv .cpu_aot_venv
source .cpu_aot_venv/bin/activate
python --version
python -m pip install -r module-1-transformer-inference-with-xnnpack/requirements.txt

    

Keep this environment active while you work through the development-machine steps. If you open a new terminal, activate .cpu_aot_venv before continuing.

Use Python 3.12.14 through pyenv for this module. The ExecuTorch Python package includes native pybindings that must match the installed PyTorch build. A virtual environment created with another Python version can install different or incompatible wheels and fail later when loading a .pte artifact.

The pyenv shell 3.12.14 command selects the installed Python 3.12.14 interpreter for the current shell before you create the virtual environment.

Note

Troubleshooting

If pyenv install reports that the 3.12.14 definition was not found, update pyenv to the latest version and run the command again.

The Hugging Face models used in this module are public and do not require authentication. If you encounter download rate limits or substitute a private or gated model, follow the Hugging Face authentication guide . If you create a token only to download models, use a read token ; write access is not required.

Previous page Complete and continue