The code presented in this book can be executed on any platform running Python. However, to translate the programs into applications that can be installed and executed on Android, the developing operating system must be Ubuntu. We briefly describe the preliminary steps to run Python along with the required applications in Ubuntu. In this case, we are using Ubuntu 20.04.1 LTS.
Although Python3 is already installed in Ubuntu, we need to install pip3 and IDLE. We cover how to use pip3 later, which is necessary to install the additional packages and libraries that the programs will require. IDLE is the shell that allows you to write and execute the code.
1.1 Installing pip3 and IDLE
To install pip3, open a Terminal window by using Ctrl+Alt+T. It will be convenient to add the Terminal to the favorites bar. From this point on, your computer will require Internet access.
sudo apt update. At this step, you need an administrator password.
sudo apt install python3-pip. This command installs pip3.
sudo apt install idle3. This command installs Python-Shell.
pip3 and IDLE 3 should now be installed on your computer. To verify that IDLE 3 has been installed properly, click Ubuntu’s Show Applications icon and look for the IDLE icon. Now is also a good time to right-click the icon and select the Add to Favorites option.
To check for the pip3 installation, you can type pip3 list in the Terminal window. In response, you will obtain a list of packages installed for the Python3 environment.
For the programs in this book, you need mathematical and graphical capabilities. For this, we will use two powerful Python libraries: NumPy and Kivy.
To install NumPy, type pip3 install numpy in the Terminal window. After the installation completes, you can verify that NumPy has been added to the installed packages by typing pip3 list.
The installation of Kivy is described in the following subsection.
1.2 Installing Kivy
Step-by-Step Commands for Installing Kivy
You can verify that Kivy has been installed by typing pip3 list. In our case, we obtained Kivy version 1.10.1. As you will see, it is important to make a note of the version number.
1.3 Installing Buildozer
At this point, we have the entire engine is ready to carry out programming in Ubuntu. However, since you are interested in translating the programs into Android APKs, you need an additional tool, called Buildozer.
Commands for Installing Buildozer
Required Cython Version for Installed Kivy Version
Installed Kivy Version
Required Cython Version
Once it’s installed, you can verify the installed version of Java by typing javac -version. In this case, we obtained Javac 1.8.0_265. This is the required version for Buildozer 1.2.0. To obtain the installed Buildozer version, type pip3 list.
Now that you have installed all the requirements needed for developing the programs, you are ready to start programming. In the following chapter, you begin with analytical equations for rotating two-dimensional polygons.
In this chapter, we covered the installation of the software requirements to start programming. We provided step-by-step listings to install pip3, IDLE, Kivy, and Buildozer, as well as the corresponding Java and Cython versions.