Independent of the kind of Arm machine you use, the instructions for this learning paths are going to be the same. You need to login via SSH to your remote server or open a terminal on your local machine. The instructions for this learning path are for Ubuntu 22.04 LTS.
Ubuntu 22.04 offers pre-installed Python 3.10 binaries. You can use the default
version or you can install the latest version of Python. If you use the default version
you will still need to install the python3-pip
and python3-venv
packages and substitute
python3
where python3.11
is used below.
A quick way to install the most recent version of Python is via Deadsnakes PPA .
Add the Deadsnakes repository:
sudo add-apt-repository -y ppa:deadsnakes/ppa
sudo apt update
Install Python 3.11:
sudo apt install python3.11 python3.11-venv -y
Check that Python 3.11 works as expected.
Run Python:
python3.11
The output will be similar to:
Python 3.11.6 (main, Oct 23 2023, 22:48:54) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
Use Control-D or type exit()
to exit Python.
At the time of writing the latest version of Python is 3.12. Before using the latest version of Python, please check if the dependencies that you need are supported. For example, TensorFlow and PyTorch don’t provide packages for Python 3.12 yet.
It is good practice to use a virtual environment when dealing with Python code. Virtual environments allow you to run multiple applications with different dependencies on the same machine without conflicts.
Create and activate the virtual environment:
python3.11 -m venv venv
source venv/bin/activate
The prompt of your terminal has (venv)
as a prefix and this means that the virtual
environment is now active. From this point on, you will run all the commands inside your virtual environment.
With the active virtual environment, you can now install the Python dependencies:
pip install keras-core tensorflow torch jax[cpu]
When installing you will see that pip is downloading aarch64 packages like
torch-2.1.0-cp311-cp311-manylinux2014_aarch64.whl
or
jaxlib-0.4.20-cp311-cp311-manylinux2014_aarch64.whl
. This means that there is
no need for any compilation as their providers will do it for you. This is also where you
can see what version of Python they support: cp311
means CPython 3.11.
After the installation, verify that you have the right packages installed:
pip list
The output should look similar to (versions might change, some dependencies may be omitted):
Package Version
---------------------------- ---------
...
jax 0.4.20
jaxlib 0.4.20
...
keras 2.15.0
keras-core 0.1.7
...
numpy 1.26.2
...
scipy 1.11.3
...
tensorboard 2.15.1
tensorboard-data-server 0.7.2
tensorflow 2.15.0
tensorflow-cpu-aws 2.15.0
tensorflow-estimator 2.15.0
tensorflow-io-gcs-filesystem 0.34.0
...
torch 2.1.0
wrapt 1.14.1
...
Whenever you are in the virtual environment, it is ok to just type
python
(without appending any version) as it always points to the Python binary used
to create the virtual environment.