Skip to content
This repository has been archived by the owner on Aug 26, 2024. It is now read-only.

Pmolloy/install deps #115

Merged
merged 10 commits into from
Jan 19, 2021
18 changes: 8 additions & 10 deletions .github/workflows/test-install-dependencies.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
name: Run install dependencies script
on: [push]
on:
push:
paths:
- source/_static/install_dependencies.sh
jobs:
install-ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: source/_static/install_dependencies.sh

install-linux:
runs-on: ubuntu-latest
strategy:
matrix:
image:
- 'fedora:latest'
container: ${{ matrix.image }}
install-fedora:
runs-on: macos-latest
steps:
- run: dnf install -y sudo
- uses: actions/checkout@v2
- run: source/_static/install_dependencies.sh
- run: cp ci/fedora.vagrant Vagrantfile
- run: vagrant up
4 changes: 4 additions & 0 deletions ci/fedora.vagrant
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Vagrant.configure("2") do |config|
config.vm.box = "generic/fedora33"
config.vm.provision "shell", path: "source/_static/install_dependencies.sh"
end
122 changes: 91 additions & 31 deletions source/_static/install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,67 @@

set -e

readonly linux_pkgs=(
python3
python3-pip
udev
cmake
git
python3-numpy
)

readonly ubuntu_pkgs=(
${linux_pkgs[@]}
# https://docs.opencv.org/master/d7/d9f/tutorial_linux_install.html
build-essential
libgtk2.0-dev
pkg-config
libavcodec-dev
libavformat-dev
libswscale-dev
python-dev
libtbb2
libtbb-dev
libjpeg-dev
libpng-dev
libtiff-dev
libdc1394-22-dev
# https://stackoverflow.com/questions/55313610
ffmpeg
libsm6
libxext6
libgl1-mesa-glx
)

readonly ubuntu_arm_pkgs=(
"${ubuntu_pkgs[@]}"
# https://stackoverflow.com/a/53402396/5494277
libhdf5-dev
libhdf5-dev
libatlas-base-dev
libjasper-dev
libqtgui4
libqt4-test
# https://github.com/EdjeElectronics/TensorFlow-Object-Detection-on-the-Raspberry-Pi/issues/18#issuecomment-433953426
libilmbase-dev
libopenexr-dev
libgstreamer1.0-dev
)

readonly fedora_pkgs=(
${linux_pkgs[@]}
gtk2-devel
# Fedora uses pkgconf instead of pkg-config
tbb-devel
libjpeg-turbo-devel
libpng-devel
libtiff-devel
libdc1394-devel
# TODO(PM): ffmpeg requires enabling rpmfusion-free-updates
# TODO(PM): libavcodec-dev libavformat-dev libswscale-dev python-dev libtbb2
# libsm6 libxext6 libgl1-mesa-glx
)

print_action () {
green="\e[0;32m"
reset="\e[0;0m"
Expand Down Expand Up @@ -38,39 +99,38 @@ if [[ $(uname) == "Darwin" ]]; then
echo
echo "=== Installed successfully! IMPORTANT: For changes to take effect,"
echo "please close and reopen the terminal window, or run: exec \$SHELL"
elif [[ ! $(uname -m) =~ ^arm* ]]; then
# shellcheck source=/etc/os-release
source /etc/os-release
case "$NAME" in
Ubuntu)
sudo apt-get update
sudo apt-get install -y python3 python3-pip udev
elif [ -f /etc/os-release ]; then
# shellcheck source=/etc/os-release
source /etc/os-release

case "$ID" in
ubuntu|debian)
if [[ ! $(uname -m) =~ ^arm* ]]; then
sudo apt-get update
sudo apt-get install -y "${ubuntu_pkgs[@]}"
python3 -m pip install --upgrade pip
elif [[ $(uname -m) =~ ^arm* ]]; then
sudo apt-get update
sudo apt-get install -y "${ubuntu_arm_pkgs[@]}"
python3 -m pip install --upgrade pip
fi
;;
fedora)
sudo dnf update -y
sudo dnf install -y "${fedora_pkgs[@]}"
sudo dnf groupinstall -y "Development Tools" "Development Libraries"
python3 -m pip install --upgrade pip
;;
*)
echo "ERROR: Distribution not supported"
exit 99
;;
esac

# Allow all users to read and write to Myriad X devices
echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="03e7", MODE="0666"' | sudo tee /etc/udev/rules.d/80-movidius.rules
sudo udevadm control --reload-rules && sudo udevadm trigger
# https://docs.opencv.org/master/d7/d9f/tutorial_linux_install.html
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libdc1394-22-dev
# https://stackoverflow.com/questions/55313610/importerror-libgl-so-1-cannot-open-shared-object-file-no-such-file-or-directo
sudo apt-get install -y ffmpeg libsm6 libxext6 libgl1-mesa-glx
python3 -m pip install --upgrade pip
;;
*)
echo "ERROR: Distribution not supported"
;;
esac
elif [[ $(uname -m) =~ ^arm* ]]; then
sudo apt-get update
sudo apt-get install -y python3 python3-pip udev virtualenv
echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="03e7", MODE="0666"' | sudo tee /etc/udev/rules.d/80-movidius.rules
sudo udevadm control --reload-rules && sudo udevadm trigger
# https://docs.opencv.org/master/d7/d9f/tutorial_linux_install.html
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
# https://stackoverflow.com/questions/55313610/importerror-libgl-so-1-cannot-open-shared-object-file-no-such-file-or-directo
sudo apt-get install -y ffmpeg libsm6 libxext6 libgl1-mesa-glx
# https://stackoverflow.com/a/53402396/5494277
sudo apt-get install -y libhdf5-dev libhdf5-dev libatlas-base-dev libjasper-dev libqtgui4 libqt4-test
# https://github.com/EdjeElectronics/TensorFlow-Object-Detection-on-the-Raspberry-Pi/issues/18#issuecomment-433953426
sudo apt-get install -y libilmbase-dev libopenexr-dev libgstreamer1.0-dev
python3 -m pip install --upgrade pip
else
echo "ERROR: Host not supported"
exit 99
fi