Documented Python and module installation process.
This commit is contained in:
@@ -1,17 +1,18 @@
|
|||||||
# TeraHz build guide
|
# TeraHz build guide
|
||||||
The recommended way of getting TeraHz is the official SD card image provided
|
The recommended way of getting TeraHz is the official Raspberry Pi SD card image
|
||||||
under the releases tab in the GitHub repository. Installing TeraHz from source
|
provided under the releases tab in the GitHub repository. Installing TeraHz from
|
||||||
is a time consuming and painful process, even more so if you don't know what
|
source is a time consuming and painful process, even more so if you don't know
|
||||||
you're doing, and whatever you end up building __will not be officially
|
what you're doing, and whatever you end up building __will not be officially
|
||||||
supported__ (unless you're a core developer).
|
supported__ (unless you're a core developer).
|
||||||
|
|
||||||
With this warning out of the way, let's begin.
|
With this warning out of the way, let's begin.
|
||||||
|
|
||||||
## Getting the latest sources
|
## Getting the latest sources
|
||||||
The most reliable way to get working source code is by cloning the official GitHub
|
The most reliable way to get working source code is by cloning the official
|
||||||
repository and checking out the `development-working` tag. This tag marks the latest
|
GitHub repository and checking out the `development-stable` tag. This tag marks
|
||||||
confirmed working commit. Building from the master branch is somewhat risky, and
|
the latest confirmed working commit. Building from the master branch is somewhat
|
||||||
building from development branches is straight up stupid if you're not a developer.
|
risky, and building from development branches is straight up stupid if you're
|
||||||
|
not a developer.
|
||||||
|
|
||||||
After cloning and checking out, check the documentation for module dependencies
|
After cloning and checking out, check the documentation for module dependencies
|
||||||
and the required version of python in the `docs/dependencies.md` file.
|
and the required version of python in the `docs/dependencies.md` file.
|
||||||
@@ -20,15 +21,66 @@ and the required version of python in the `docs/dependencies.md` file.
|
|||||||
This step depends a lot on the platform you're using. TeraHz was developed with
|
This step depends a lot on the platform you're using. TeraHz was developed with
|
||||||
Raspberry Pi and Raspbian in mind. If you're familiar with Raspbian enough,
|
Raspberry Pi and Raspbian in mind. If you're familiar with Raspbian enough,
|
||||||
you'll know that the latest version of Python available is `3.5`, which is too
|
you'll know that the latest version of Python available is `3.5`, which is too
|
||||||
obsolete to run TeraHz and the required modules consistently.
|
obsolete to run TeraHz and the required modules consistently. This leaves us
|
||||||
|
with compiling Python from source. __This step is guaranteed to be slow,
|
||||||
|
overnight compiling with something like tmux is recommended.__
|
||||||
|
|
||||||
After messing with Debian arm64 packages in the early development days I determined
|
### Pre-requirements
|
||||||
that the most reliable way of getting Python on Raspbian is compiling it from source.
|
Installing python without most C libraries will lead to a rather minimalistic
|
||||||
This part of the installation will take the largest portion of time, as compiling
|
Python install, missing a lot of important modules. To prevent this, update
|
||||||
anything complex on the Raspberry is painfully slow.
|
the system packages. After that, reboot.
|
||||||
|
|
||||||
If you're running an OS that provides a recent version of Python, great! You won't
|
```
|
||||||
have to waste so much time waiting for the build process to finish.
|
sudo apt update
|
||||||
|
sudo apt full-upgrade
|
||||||
|
sudo reboot
|
||||||
|
```
|
||||||
|
|
||||||
The Python version TeraHz works best on is `3.6.8`. To install it, download the
|
Install the required build tools, libraries and their headers.
|
||||||
gzipped tarball from the official Python website, and decompress it.
|
|
||||||
|
```
|
||||||
|
sudo apt-get install build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev
|
||||||
|
```
|
||||||
|
|
||||||
|
### Compiling
|
||||||
|
Compiling Python from source is, in fact pretty easy, just time-consuming. I'll
|
||||||
|
advise you again to use a terminal multiplexer like `tmux` to start the build
|
||||||
|
process, detach the terminal session overnight and reattach it some time later
|
||||||
|
to check on it.
|
||||||
|
|
||||||
|
Python 3.6.8 can be downloaded in many forms, but you'll be using the most basic
|
||||||
|
of them all: a gzipped tarball. Download and decompress it, the cd into its
|
||||||
|
directory.
|
||||||
|
|
||||||
|
```
|
||||||
|
wget https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tgz
|
||||||
|
tar -xzf Python-3.6.8.tgz
|
||||||
|
cd Python-3.6.8
|
||||||
|
```
|
||||||
|
|
||||||
|
Python's build process is pretty classic, a `.configure` script and a Makefile.
|
||||||
|
Using the `-j` option with Make can reduce the compile time significantly. Go
|
||||||
|
with as many threads as you have cores: `-j 4` works great on the Pi 3 B/B+.
|
||||||
|
|
||||||
|
```
|
||||||
|
./configure
|
||||||
|
make -j4
|
||||||
|
```
|
||||||
|
|
||||||
|
When the compilation ends, install your freshly built version of python.
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo make altinstall
|
||||||
|
```
|
||||||
|
|
||||||
|
Altinstall means that the new version of Python will be installed beside the
|
||||||
|
existing version, and all related commands will use the full naming scheme:
|
||||||
|
think `python3.6` or `pip3.6` instead of the shorter `python3` or `pip3`.
|
||||||
|
|
||||||
|
### Modules
|
||||||
|
Another painfully slow part is the installation of all the required modules needed
|
||||||
|
by TeraHz. Luckily, `pip3.6` takes care of the entire installation process. You might also want to run this command through a terminal multiplexer overnight, as it takes a few hours to complete.
|
||||||
|
|
||||||
|
```
|
||||||
|
pip3.6 install smbus pyserial flask pandas
|
||||||
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user