Legacy Ubuntu Dependencies

If you are running Ubuntu 18.04 and ROS Melodic, you’ll find it comes with all dependencies available preinstalled. This is not the case however for older Ubuntu/ROS versions.

Freedom Robotics can deal with most common situations like:

  • detecting and using a 3.6+ version of python without updating the default python3 of the system.
  • installing python3.6+, ffmpeg4.2 and libsrtp2 from our PPA repository for Ubuntu 18.04/16.04/14.04 OS.
  • build and install python3.6, ffmpeg3.2, libsrtp2 if missing and installing from PPA is not an option

The behavior of the agent installation script can be controlled via AUTO INSTALL DEPENDENCIES and INSTALL DEPENDENCIES FROM PPA flags that can be found by navigating to the device in app.freedomrobotics.ai, clicking SETTINGS > INSTALLATION > ADVANCED SETTINGS and are by default enabled.

Below are specific example solutions and install scripts for each version. These scripts assume they are run by root user.

UBUNTU 16.04

UBUNTU 16.04 x86 (AMD, INTEL)

The installation script is able to detect and used a previously installed python 3.6+ version if its binary is in the path (can be found in one of the PATH environment variable paths).

From PPA Repositories

Currently, the Freedom Robotics agent installation script can handle the python3.6+ installation automatically when AUTO INSTALL DEPENDENCIES and INSTALL DEPENDENCIES FROM PPA flags are enabled.

In the past we suggested using ppa:jonathonf/python-3.6 repository, which has been made private. If you previously installed from it, running apt-get update will now partially fail. Please see the Removing Jonathanf section for an explanation of how to fix this.

# Install dependencies
apt-get update

apt-get install -y software-properties-common curl

# Adding our PPA ubuntu repository
add-apt-repository -y ppa:freedomrobotics/ppa
apt-get update

# Install the python 3.8 version from the PPA
apt-get install -y python3.8

From Sources

If fore some reason you can not use our PPA repository for installing python3.8, please disable the INSTALL DEPENDENCIES FROM PPA flag and the installer will try to download, compile and install python 3.6.9 for you if AUTO INSTALL DEPENDENCIES is enabled.

If you want to do it yourself, just disable AUTO INSTALL DEPENDENCIES flag and follow next installation example:

# Install dependencies
apt-get update

apt-get install -y build-essential libssl-dev curl

# Download and build python 3.6 from source
cd /opt

python_version=3.6.9

curl https://www.python.org/ftp/python/${python_version}/Python-${python_version}.tgz -o Python-${python_version}.tgz

tar -xvf Python-${python_version}.tgz

cd /opt/Python-${python_version}

./configure

make

make install

This is optional.

# Install virtualenv
apt-get update

apt-get install -y python-pip

pip install virtualenv

# Set up a virtual env for python 3.6
virtualenv -p `which python3.6` ~/python3.6venv

source ~/python3.6venv/bin/activate

Notes:

  • You will have to source the activation script each time you want to use python3.6 as python3 and as python. You can automate this via ~/.bashrc.
  • If you want python to be used with python2, just remove the python and pip links from the virtual environment (example bellow).
rm ~/python3.6venv/bin/python

rm ~/python3.6venv/bin/pip

Note:

While the installation script is able to install and then use python version 3.6+, replicating the previous python environment is a different story, so please keep in mind that if you previously used the default python3 of the system, all packages will have to be reinstalled on new python and code redeployed (if it is the case).

Ubuntu 16.04 default repositories have all the packages we need, but are older versions than what the aiortc python module requires.

From PPA Repositories

The agent installation script can handle the ffmpeg4.2 libraries installation from our PPA automatically when AUTO INSTALL DEPENDENCIES and INSTALL DEPENDENCIES FROM PPA flags are enabled.

# Install dependencies
apt-get update

apt-get install -y software-properties-common

# Install FFMPEG from PPA
add-apt-repository -y ppa:freedomrobotics/ppa

apt-get update

apt-get install -y ffmpeg4.2

If fore some reason you can not use our PPA repository for installing ffmpeg4.2 libraries, please disable the INSTALL DEPENDENCIES FROM PPA flag and the installer will try to download, compile and install ffmpeg3.2 for you if AUTO INSTALL DEPENDENCIES is enabled.

If you want to do it yourself, just disable AUTO INSTALL DEPENDENCIES flag and follow next installation example:

# Install dependencies
apt-get update

apt-get install -y autoconf automake build-essential cmake libass-dev libfreetype6-dev libjpeg-dev libtheora-dev libtool libvorbis-dev libx264-dev pkg-config curl yasm zlib1g-dev

# Install FFMPEG from Sources
cd /opt

ffmpeg_version=3.2

curl http://ffmpeg.org/releases/ffmpeg-${ffmpeg_version}.tar.bz2 -o ffmpeg-${ffmpeg_version}.tar.bz2 

tar -xjf ffmpeg-${ffmpeg_version}.tar.bz2

cd /opt/ffmpeg-${ffmpeg_version}

./configure --disable-static --enable-shared --disable-doc

make

make install

Because python 3.8 was recently released, some of the dependencies for which there are already built modules for 3.6 and 3.7 aren't yet available for python 3.8. In these situations, the code source will be built at install time.

libsrtp2 is necessary for building the pylibsrtp module (aiortc dependency). On x86 for python 3.6 and python 3.7 we don’t need it as pip finds a build of the module, but for python 3.8 there is no build available yet, so it has to be built from source code and libsrtp2 is mandatory for building it.

Similar to python3.6+ and ffmpeg4.3, FreedomRobotics agent installation script can handle the libsrtp2 libraries installation from our PPA automatically when AUTO INSTALL DEPENDENCIES and INSTALL DEPENDENCIES FROM PPA flags are enabled.

# Install dependencies
apt-get update

apt-get install -y software-properties-common

# Install from PPA
add-apt-repository -y ppa:freedomrobotics/ppa

apt-get update

apt-get install -y libsrtp2

From SourcesFrom Sources

If you can not use our PPA repository for installing libsrtp2 libraries, please disable the INSTALL DEPENDENCIES FROM PPA flag and the installer will try to download, compile and install libsrtp2.2 for you if AUTO INSTALL DEPENDENCIES is enabled.

If you want to do it yourself, just disable AUTO INSTALL DEPENDENCIES flag and follow next installation example:

# Install dependencies
apt-get update

apt-get install -y wget build-essential

# Build from source
libsrtp_version=2.2

cd /opt
wget https://github.com/cisco/libsrtp/archive/v${libsrtp_version}.tar.gz
tar -xvf v${libsrtp_version}.tar.gz

cd /opt/libsrtp-${libsrtp_version}

./configure

make

make runtest

make install

UBUNTU 16.04 ARM (NVIDIA, Raspberry Pi, etc)

Python3.6+ installation

Please follow the same procedure as for x86.

From PPA Repositories

Please follow the same procedure as for x86.

From Source

64bit (arm64 / arm64v8)

Please follow the same procedure as for x86 FFmpeg installation From Source.

32bit (arm32 / arm32v7)

For the 32bit arm we have to add one extra option to the ./configure command to specify the arm32 architecture.

# Install dependencies
apt-get update

apt-get install -y autoconf automake build-essential cmake libass-dev libfreetype6-dev libjpeg-dev libtheora-dev libtool libvorbis-dev libx264-dev pkg-config curl yasm zlib1g-dev

# Build FFMPEG from source
cd /opt

ffmpeg_version=3.2

curl http://ffmpeg.org/releases/ffmpeg-${ffmpeg_version}.tar.bz2 -o ffmpeg-${ffmpeg_version}.tar.bz2 

tar -xjf ffmpeg-${ffmpeg_version}.tar.bz2

cd /opt/ffmpeg-${ffmpeg_version}

./configure --disable-static --enable-shared --disable-doc  --arch=arm32

make

make install

This library is necessary for building the pylibsrtp module (aiortc dependency). On x86 we don’t need it as pip finds a build of the module (not yet available for python 3.8) , but for arm there is no build available yet, so it has to be built from source code and libsrtp2 is mandatory for building it.

From Repositories

Please follow the same procedure as for x86.

From Sources

In the case you want to install it yourself, the instructions are very similar to those for the x86 architecture; only the build configuration argument is different.

# Install dependencies
apt-get update

apt-get install -y wget build-essential

# Build from source
libsrtp_version=2.2

cd /opt
wget https://github.com/cisco/libsrtp/archive/v${libsrtp_version}.tar.gz
tar -xvf v${libsrtp_version}.tar.gz

cd /opt/libsrtp-${libsrtp_version}

./configure --build=arm

make

make runtest

make install

UBUNTU 14.04

UBUNTU 14.04 x86 and ARM

Fix HeartBleed SSL Bug in unpatched 14.04

apt-get update

apt-get install -y python-pip python-dev libffi-dev libssl-dev

pip install --upgrade six setuptools pip

pip install --upgrade pyOpenSSL  'cryptography<3'

pip install --upgrade idna certifi enum34 ipaddress pyasn1 ndg-httpsclient

We identified scenarios for which this fix is not working, and upgrading python 2 could be the only option. Please ask for assistance if that is the case.

UBUNTU 14.04 x86 (AMD, INTEL)

Python3.6+ installation

Please follow the same procedure as for 16.04 x86, with the remark that you should install python3.6 instead of python3.8 from our PPA repositories.

FFmpeg installation

Please follow the same procedure as for 16.04 x86.

libsrtp2 (python 3.8 only)

Please follow the same procedure as for 16.04 x86.

UBUNTU 14.04 ARM (NVIDIA, Raspberry Pi, etc)

Python3.6+ installation

Please follow the same procedure as for 16.04 x86.

FFmpeg installation

Please follow the same procedure as for 16.04 arm.

libsrtp2

Please follow the same procedure as for 16.04 arm.

Installing PPAs from the jonathanf python-3.6 repository is no longer supported. The previous ppa:jonathanf has been made private, so you can no longer access that version of Python 3.6 for older Ubuntu distributions.

If you have previously installed using them, you will need to remove the PPAs using the following command:

sudo rm -f /etc/apt/sources.list.d/jonathanf*python*