Skip to content

Commit d234632

Browse files
authored
Update install_dependencies and workflows
* Update install_dependencies.sh - check both ubuntu and debian version - add a check for aarch64 (for 64 bit arm OS) - dynamically change packages based on version Tested on: - nvidia jetson orin nano - aarch64 - ("Ubuntu 20.04.6 LTS") - RPI 64 bit OS (aarch64 - luxonis/based on Bookworm - 12) - x86 host ("Ubuntu 21.04") Updated workflows to work on windows, ubuntu and macOS (added versions 13 and 14)
1 parent 3690c72 commit d234632

File tree

2 files changed

+80
-33
lines changed

2 files changed

+80
-33
lines changed

.github/workflows/test-install-dependencies.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
runs-on: ubuntu-latest
1717
strategy:
1818
matrix:
19-
container_image: ["fedora:34", "fedora:35", "fedora:36", "ubuntu:18.04", "ubuntu:20.04", "ubuntu:22.04", "ubuntu:22.10"]
19+
container_image: ["fedora:34", "fedora:35", "fedora:36", "ubuntu:18.04", "ubuntu:20.04", "ubuntu:22.04"]
2020
container:
2121
image: ${{ matrix.container_image }}
2222
steps:
@@ -38,7 +38,7 @@
3838
test_macos:
3939
strategy:
4040
matrix:
41-
os: ["macos-11", "macos-12"]
41+
os: ["macos-11", "macos-12", "macos-13", "macos-14"]
4242
runs-on: ${{ matrix.os }}
4343
steps:
4444
- uses: actions/checkout@v3
@@ -53,12 +53,16 @@
5353
runs-on: windows-latest
5454
steps:
5555
- uses: actions/checkout@v3
56+
- uses: actions/setup-python@v4
57+
with:
58+
python-version: "3.10"
5659
- name: Download chocolatey
5760
shell: pwsh
5861
run: Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
59-
- name: Install dependencies
62+
- name: Install pycharm-community dependency
6063
shell: pwsh
61-
run: choco install cmake git python --version 3.10 -y
62-
- name: Install example requrirements
64+
run: choco install pycharm-community -y
65+
- name: Install example requirements
6366
run: |
6467
python examples/install_requirements.py
68+

docs/source/_static/install_dependencies.sh

Lines changed: 71 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ readonly linux_pkgs=(
1212
python3-numpy
1313
)
1414

15-
readonly ubuntu_pkgs=(
15+
readonly debian_pkgs=(
1616
${linux_pkgs[@]}
1717
# https://docs.opencv.org/master/d7/d9f/tutorial_linux_install.html
1818
build-essential
@@ -46,24 +46,22 @@ readonly ubuntu_pkgs=(
4646
qml-module-qtquick-window2
4747
)
4848

49-
readonly ubuntu_pkgs_pre22_04=(
50-
"${ubuntu_pkgs[@]}"
49+
readonly debian_pkgs_pre22_04=(
50+
"${debian_pkgs[@]}"
5151
libdc1394-22-dev
5252
)
5353

54-
readonly ubuntu_pkgs_post22_04=(
55-
"${ubuntu_pkgs[@]}"
54+
readonly debian_pkgs_post22_04=(
55+
"${debian_pkgs[@]}"
5656
libdc1394-dev
5757
)
5858

59-
readonly ubuntu_arm_pkgs=(
60-
"${ubuntu_pkgs[@]}"
61-
libdc1394-22-dev
59+
debian_arm_pkgs=(
60+
"${debian_pkgs[@]}"
6261
# https://stackoverflow.com/a/53402396/5494277
6362
libhdf5-dev
6463
libhdf5-dev
6564
libatlas-base-dev
66-
libjasper-dev
6765
# https://github.com/EdjeElectronics/TensorFlow-Object-Detection-on-the-Raspberry-Pi/issues/18#issuecomment-433953426
6866
libilmbase-dev
6967
libopenexr-dev
@@ -94,6 +92,12 @@ print_and_exec () {
9492
$*
9593
}
9694

95+
# Version comparison function
96+
version_lte() {
97+
[[ "$1" == "$(echo -e "$1\n$2" | sort -V | head -n1)" ]]
98+
}
99+
100+
97101
if [[ $(uname) == "Darwin" ]]; then
98102
echo "During Homebrew install, certain commands need 'sudo'. Requesting access..."
99103
sudo true
@@ -109,34 +113,72 @@ elif [ -f /etc/os-release ]; then
109113
# shellcheck source=/etc/os-release
110114
source /etc/os-release
111115

112-
if [[ "$ID" == "ubuntu" || "$ID" == "debian" || "$ID_LIKE" == "ubuntu" || "$ID_LIKE" == "debian" || "$ID_LIKE" == "ubuntu debian" ]]; then
113-
if [[ ! $(uname -m) =~ ^arm* ]]; then
114-
sudo apt-get update
115-
if [[ "$VERSION_ID" > "22.04" || "$VERSION_ID" == "22.04" ]]; then
116-
sudo apt-get install -y "${ubuntu_pkgs_post22_04[@]}"
117-
else
118-
sudo apt-get install -y "${ubuntu_pkgs_pre22_04[@]}"
119-
fi
120-
python3 -m pip install --upgrade pip
121-
elif [[ $(uname -m) =~ ^arm* ]]; then
122-
sudo apt-get update
123-
sudo apt-get install -y "${ubuntu_arm_pkgs[@]}"
124-
python3 -m pip install --upgrade pip
116+
# Correctly determine if the architecture is ARM or aarch64
117+
IS_ARM=false
118+
if [[ $(uname -m) =~ ^arm || $(uname -m) == "aarch64" ]]; then
119+
IS_ARM=true
120+
fi
121+
122+
# Assuming debian_pkgs_pre22_04, debian_pkgs_post22_04, ubuntu_pkgs_pre22_04, and ubuntu_pkgs_post22_04 are defined
123+
124+
source /etc/os-release
125+
126+
IS_ARM=false
127+
if [[ $(uname -m) =~ ^arm || $(uname -m) == "aarch64" ]]; then
128+
IS_ARM=true
129+
fi
130+
131+
# Check if the version is less than or equal to 22.04 (Ubuntu) or 11 (Debian)
132+
if { [[ "$ID" == "debian" ]] && version_lte "$VERSION_ID" "11"; } || { [[ "$ID" == "ubuntu" ]] && version_lte "$VERSION_ID" "21.10"; }; then
133+
if $IS_ARM; then
134+
echo "Using pre-22.04 package list for ARM"
135+
debian_arm_pkgs=("${debian_arm_pkgs[@]}")
136+
# Add libjasper-dev for ARM but not aarch64
137+
[[ $(uname -m) =~ ^arm ]] && { debian_arm_pkgs+=("libjasper-dev"); }
138+
139+
sudo apt-get install -y ${debian_arm_pkgs[@]/${debian_pkgs[@]}/${debian_pkgs_pre22_04[@]}}
140+
141+
else
142+
echo "Using pre-22.04 package list"
143+
144+
sudo apt-get install -y ${debian_pkgs_pre22_04[@]}
125145
fi
146+
147+
python3 -m pip install --upgrade pip
126148

127149
# As set -e is set, retrieve the return value without exiting
128150
RET=0
129151
dpkg -s uvcdynctrl > /dev/null 2>&1 || RET=$? || true
130152
# is uvcdynctrl installed
131153
if [[ "$RET" == "0" ]]; then
132-
echo -e "\033[33mWe detected \"uvcdynctrl\" installed on your system. \033[0m"
133-
echo -e "\033[33mWe recommend removing this package, as it creates a huge log files if a camera is used in UVC mode (webcam)\033[0m"
134-
echo -e "\033[33mYou can do so by running the following commands:\033[0m"
135-
echo -e "\033[33m$ sudo apt remove uvcdynctrl uvcdynctrl-data\033[0m"
136-
echo -e "\033[33m$ sudo rm -f /var/log/uvcdynctrl-udev.log\033[0m"
137-
echo ""
154+
echo -e "\033[33mWe detected \"uvcdynctrl\" installed on your system. \033[0m"
155+
echo -e "\033[33mWe recommend removing this package, as it creates a huge log files if a camera is used in UVC mode (webcam)\033[0m"
156+
echo -e "\033[33mYou can do so by running the following commands:\033[0m"
157+
echo -e "\033[33m$ sudo apt remove uvcdynctrl uvcdynctrl-data\033[0m"
158+
echo -e "\033[33m$ sudo rm -f /var/log/uvcdynctrl-udev.log\033[0m"
159+
echo ""
138160
fi
139161

162+
# Check if the version is greater than 22.04 (Ubuntu) or 11 (Debian)
163+
elif { [[ "$ID" == "debian" ]] && ! version_lte "$VERSION_ID" "11"; } || { [[ "$ID" == "ubuntu" ]] && ! version_lte "$VERSION_ID" "21.10"; }; then
164+
if $IS_ARM; then
165+
echo "Using post-22.04 package list for ARM"
166+
debian_arm_pkgs=("${debian_arm_pkgs[@]}")
167+
# Add libjasper-dev for ARM but not aarch64
168+
[[ $(uname -m) =~ ^arm ]] && { debian_arm_pkgs+=("libjasper-dev"); }
169+
# Switching libbtbb2 to libtbbmalloc2
170+
debian_arm_pkgs=("${debian_arm_pkgs[@]/libtbb2/libtbbmalloc2}")
171+
172+
sudo apt-get install -y ${debian_arm_pkgs[@]/${debian_pkgs[@]}/${debian_pkgs_post22_04[@]}}
173+
174+
else
175+
echo "Using post-22.04 package list"
176+
177+
sudo apt-get install -y ${debian_pkgs_post22_04[@]}
178+
fi
179+
180+
python3 -m pip install --upgrade pip
181+
140182
OS_VERSION=$(lsb_release -r |cut -f2)
141183
if [ "$OS_VERSION" == "21.04" ]; then
142184
echo -e "\033[33mThere are known issues with running our demo script on Ubuntu 21.04, due to package \"python3-pyqt5.sip\" not being in a correct version (>=12.9)\033[0m"
@@ -145,6 +187,7 @@ elif [ -f /etc/os-release ]; then
145187
echo -e "\033[33m$ sudo dpkg -i python3-pyqt5.sip_12.9.0-1_amd64.deb\033[0m"
146188
echo ""
147189
fi
190+
148191
elif [[ "$ID" == "fedora" ]]; then
149192
sudo dnf update -y
150193
sudo dnf install -y "${fedora_pkgs[@]}"

0 commit comments

Comments
 (0)