Skip to content

Commit ceb2c6c

Browse files
authored
Update install_dependencies.sh (#972)
* Update install_dependencies.sh Fixed installing on ARM and raspbian Tested on: - RPI - armv7l - Raspbian 10 (buster) - 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") * Update install_dependencies.sh Added ubuntu 23.10 support
1 parent af360d5 commit ceb2c6c

File tree

1 file changed

+128
-71
lines changed

1 file changed

+128
-71
lines changed

docs/source/_static/install_dependencies.sh

Lines changed: 128 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ readonly debian_pkgs=(
2222
libavformat-dev
2323
libswscale-dev
2424
python3-dev
25-
libtbb2
2625
libtbb-dev
2726
libjpeg-dev
2827
libpng-dev
@@ -31,7 +30,6 @@ readonly debian_pkgs=(
3130
ffmpeg
3231
libsm6
3332
libxext6
34-
libgl1-mesa-glx
3533
python3-pyqt5
3634
python3-pyqt5.qtquick
3735
qml-module-qtquick-controls2
@@ -46,18 +44,36 @@ readonly debian_pkgs=(
4644
qml-module-qtquick-window2
4745
)
4846

49-
readonly debian_pkgs_pre22_04=(
50-
"${debian_pkgs[@]}"
51-
libdc1394-22-dev
52-
)
53-
54-
readonly debian_pkgs_post22_04=(
55-
"${debian_pkgs[@]}"
56-
libdc1394-dev
57-
)
58-
59-
debian_arm_pkgs=(
60-
"${debian_pkgs[@]}"
47+
readonly debian_arm_pkgs=(
48+
${linux_pkgs[@]}
49+
# https://docs.opencv.org/master/d7/d9f/tutorial_linux_install.html
50+
build-essential
51+
libgtk2.0-dev
52+
pkg-config
53+
libavcodec-dev
54+
libavformat-dev
55+
libswscale-dev
56+
python3-dev
57+
libtbb-dev
58+
libjpeg-dev
59+
libpng-dev
60+
libtiff-dev
61+
# https://stackoverflow.com/questions/55313610
62+
ffmpeg
63+
libsm6
64+
libxext6
65+
python3-pyqt5
66+
python3-pyqt5.qtquick
67+
qml-module-qtquick-controls2
68+
qml-module-qt-labs-platform
69+
qtdeclarative5-dev
70+
qml-module-qtquick2
71+
qtbase5-dev
72+
qtchooser
73+
qt5-qmake
74+
qtbase5-dev-tools
75+
qml-module-qtquick-layouts
76+
qml-module-qtquick-window2
6177
# https://stackoverflow.com/a/53402396/5494277
6278
libhdf5-dev
6379
libhdf5-dev
@@ -68,6 +84,25 @@ debian_arm_pkgs=(
6884
libgstreamer1.0-dev
6985
)
7086

87+
readonly debian_pkgs_pre22_04=(
88+
libdc1394-22-dev
89+
libgl1-mesa-glx
90+
libtbb2
91+
92+
)
93+
readonly debian_pkgs_post22_04=(
94+
libdc1394-dev
95+
libgl1-mesa-glx
96+
libtbbmalloc2
97+
98+
)
99+
readonly debian_pkgs_23=(
100+
libdc1394-dev
101+
libgl1-mesa-dev
102+
libtbbmalloc2
103+
)
104+
105+
71106
readonly fedora_pkgs=(
72107
${linux_pkgs[@]}
73108
gtk2-devel
@@ -92,11 +127,32 @@ print_and_exec () {
92127
$*
93128
}
94129

95-
# Version comparison function
96130
version_lte() {
97131
[[ "$1" == "$(echo -e "$1\n$2" | sort -V | head -n1)" ]]
98132
}
99133

134+
declare -A debian_versions=(
135+
["trixie/sid"]="13"
136+
["bookworm/sid"]="12"
137+
["bullseye/sid"]="11"
138+
["buster/sid"]="10"
139+
["stretch/sid"]="9"
140+
["jessie/sid"]="8"
141+
["wheezy/sid"]="7"
142+
["squeeze/sid"]="6"
143+
)
144+
145+
# Function to lookup and print Debian version number
146+
lookup_debian_version_number() {
147+
debian_version_string="$1"
148+
version_number="${debian_versions[$debian_version_string]}"
149+
150+
if [ -n "$version_number" ]; then
151+
echo "$version_number"
152+
else
153+
echo "None"
154+
fi
155+
}
100156

101157
if [[ $(uname) == "Darwin" ]]; then
102158
echo "During Homebrew install, certain commands need 'sudo'. Requesting access..."
@@ -109,85 +165,87 @@ if [[ $(uname) == "Darwin" ]]; then
109165
echo
110166
echo "=== Installed successfully! IMPORTANT: For changes to take effect,"
111167
echo "please close and reopen the terminal window, or run: exec \$SHELL"
168+
112169
elif [ -f /etc/os-release ]; then
113-
# shellcheck source=/etc/os-release
114170
source /etc/os-release
171+
if [ -f /etc/debian_version ]; then
172+
output=$(cat /etc/debian_version)
173+
echo $output
174+
if [[ $output == *sid ]]; then
175+
version=$(lookup_debian_version_number $output)
176+
else
177+
version=$output
178+
fi
115179

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
180+
# Correctly determine if the architecture is ARM or aarch64
181+
IS_ARM=false
182+
if [[ $(uname -m) =~ ^arm* || $(uname -m) == "aarch64" ]]; then
183+
IS_ARM=true
184+
fi
121185

122-
# Assuming debian_pkgs_pre22_04, debian_pkgs_post22_04, ubuntu_pkgs_pre22_04, and ubuntu_pkgs_post22_04 are defined
186+
echo "$version"
187+
echo "$IS_ARM"
123188

124-
source /etc/os-release
189+
if [ $IS_ARM ]; then
190+
sudo DEBIAN_FRONTEND=noninteractive apt install -y "${debian_arm_pkgs[@]}"
191+
if [ "$version" == "13" ]; then
192+
echo "Detected ARM Debian 13"
193+
sudo apt install -y "${debian_pkgs_23[@]}"
194+
elif version_lte "$version" "11"; then
195+
echo "Using pre-22.04 ARM package list"
196+
sudo apt-get install -y ${debian_pkgs_pre22_04[@]}
125197

126-
IS_ARM=false
127-
if [[ $(uname -m) =~ ^arm || $(uname -m) == "aarch64" ]]; then
128-
IS_ARM=true
129-
fi
198+
# Check for uvcdynctrl package and recommend removal if found
199+
if dpkg -s uvcdynctrl &> /dev/null; then
200+
echo -e "\033[33mWe detected 'uvcdynctrl' installed on your system.\033[0m"
201+
# Instructions for removal
202+
echo -e "\033[33m$ sudo apt remove uvcdynctrl uvcdynctrl-data\033[0m"
203+
echo -e "\033[33m$ sudo rm -f /var/log/uvcdynctrl-udev.log\033[0m"
204+
fi
130205

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"); }
138206

139-
sudo apt-get install -y ${debian_arm_pkgs[@]/${debian_pkgs[@]}/${debian_pkgs_pre22_04[@]}}
207+
else
208+
echo "Using post-22.04 ARM package list"
209+
sudo apt-get install -y ${debian_pkgs_post22_04[@]}
210+
fi
140211

141-
else
142-
echo "Using pre-22.04 package list"
212+
# Add libjasper-dev for ARM but not aarch64
213+
[[ $(uname -m) =~ ^arm* ]] && { sudo apt install -y libjasper-dev; }
143214

144-
sudo apt-get install -y ${debian_pkgs_pre22_04[@]}
215+
else
216+
sudo DEBIAN_FRONTEND=noninteractive apt install -y "${debian_pkgs[@]}"
217+
if [ $version == "13" ]; then
218+
echo "Detected Debian 13"
219+
sudo apt install -y "${debian_pkgs_23[@]}"
220+
elif version_lte "$version" "11"; then
221+
echo "Using pre-22.04 package list"
222+
sudo apt-get install -y "${debian_pkgs_pre22_04[@]}"
223+
224+
else
225+
echo "Using post-22.04 package list"
226+
sudo apt-get install -y "${debian_pkgs_post22_04[@]}"
227+
fi
145228
fi
146-
147-
python3 -m pip install --upgrade pip
148229

149-
# As set -e is set, retrieve the return value without exiting
150-
RET=0
151-
dpkg -s uvcdynctrl > /dev/null 2>&1 || RET=$? || true
152-
# is uvcdynctrl installed
153-
if [[ "$RET" == "0" ]]; then
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"
230+
# Check for uvcdynctrl package and recommend removal if found
231+
if dpkg -s uvcdynctrl &> /dev/null; then
232+
echo -e "\033[33mWe detected 'uvcdynctrl' installed on your system.\033[0m"
233+
# Instructions for removal
157234
echo -e "\033[33m$ sudo apt remove uvcdynctrl uvcdynctrl-data\033[0m"
158235
echo -e "\033[33m$ sudo rm -f /var/log/uvcdynctrl-udev.log\033[0m"
159-
echo ""
160236
fi
161237

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
179238

180-
python3 -m pip install --upgrade pip
181-
182-
OS_VERSION=$(lsb_release -r |cut -f2)
183-
if [ "$OS_VERSION" == "21.04" ]; then
239+
240+
if [ "$VERSION_ID" == "21.04" ]; then
184241
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"
185242
echo -e "\033[33mWe recommend installing the updated version manually using the following commands\033[0m"
186243
echo -e "\033[33m$ wget http://mirrors.kernel.org/ubuntu/pool/universe/p/pyqt5-sip/python3-pyqt5.sip_12.9.0-1_amd64.deb\033[0m"
187244
echo -e "\033[33m$ sudo dpkg -i python3-pyqt5.sip_12.9.0-1_amd64.deb\033[0m"
188245
echo ""
189246
fi
190247

248+
191249
elif [[ "$ID" == "fedora" ]]; then
192250
sudo dnf update -y
193251
sudo dnf install -y "${fedora_pkgs[@]}"
@@ -197,7 +255,6 @@ elif [ -f /etc/os-release ]; then
197255
echo "ERROR: Distribution not supported"
198256
exit 99
199257
fi
200-
201258
# Allow all users to read and write to Myriad X devices
202259
echo "Installing udev rules..."
203260
echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="03e7", MODE="0666"' | sudo tee /etc/udev/rules.d/80-movidius.rules > /dev/null

0 commit comments

Comments
 (0)