# [Set up ExecuTorch](https://learn.arm.com/learning-paths/embedded-and-microcontrollers/rpi-llama3/executorch/)

## In this learning path

- [Introduction](https://learn.arm.com/learning-paths/embedded-and-microcontrollers/rpi-llama3/)
- [Set up the development environment](https://learn.arm.com/learning-paths/embedded-and-microcontrollers/rpi-llama3/dev-env/)
- [Set up ExecuTorch](https://learn.arm.com/learning-paths/embedded-and-microcontrollers/rpi-llama3/executorch/)
- [Set up Llama 3](https://learn.arm.com/learning-paths/embedded-and-microcontrollers/rpi-llama3/llama3/)
- [Run the model on a Raspberry Pi 5](https://learn.arm.com/learning-paths/embedded-and-microcontrollers/rpi-llama3/run/)
- [Next Steps](https://learn.arm.com/learning-paths/embedded-and-microcontrollers/rpi-llama3/_next-steps/)

## Set up ExecuTorch
ExecuTorch is an end-to-end solution for enabling on-device inference capabilities across mobile and edge devices; including wearables, embedded devices, and microcontrollers. It is part of the PyTorch Edge ecosystem and enables efficient deployment of PyTorch models to edge devices. You can learn more by reading through the [ExecuTorch Overview](https://pytorch.org/executorch/stable/intro-overview.html).

The best practice is to create an isolated Python environment in which you install the ExecuTorch dependencies. Use one of these methods in the Raspberry Pi OS shell in your Docker container:

### Option 1: Create a Python virtual environment
Create a Python virtual environment using:
```bash
python -m venv executorch-venv
source executorch-venv/bin/activate
```
Your terminal displays `(executorch-venv)` in the prompt indicating the virtual environment is active.

### Option 2: Create a Conda virtual environment
Install Miniconda on your development machine by following the [Anaconda install guide](https://learn.arm.com/install-guides/anaconda/).

Once `conda` is installed create the environment:
```bash
conda create -yn executorch-venv
conda activate executorch-venv
```

## Install Clang
Install Clang, which is required to build ExecuTorch:
```bash
sudo apt install clang -y
```
Then, make clang the default C/C++ compiler:
```bash
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang 100
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++ 100
sudo update-alternatives --set cc /usr/bin/clang
sudo update-alternatives --set c++ /usr/bin/clang++
```

## Clone ExecuTorch and install the required dependencies
Continue in your Python virtual environment, and run the commands below to download the ExecuTorch repository and install the required packages.

After cloning the repository, the project’s submodules are updated, and two scripts install additional dependencies.
```bash
git clone https://github.com/pytorch/executorch.git
cd executorch
git checkout release/1.0
git submodule sync
git submodule update --init --recursive
./install_executorch.sh
./examples/models/llama/install_requirements.sh
```
When these scripts finish successfully, ExecuTorch is all set up. That means it’s time to dive into the world of Llama models!
