-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
101 lines (81 loc) · 4.13 KB
/
install.sh
File metadata and controls
101 lines (81 loc) · 4.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/bash
# Development mode setup script ::::::::::::::::::::::::::::::::::::::::::::::
#
# YOLO Object Detection Model Training
#
# This script is called from the TrainingObjectDetectionYOLOv5 directory using:
#
# bash ../../CodeProject.AI-Server/src/setup.sh
#
# The setup.sh script will find this install.sh file and execute it.
#
# For help with install scripts, notes on variables and methods available, tips,
# and explanations, see /src/modules/install_script_help.md
if [ "$1" != "install" ]; then
read -t 3 -p "This script is only called from: bash ../../CodeProject.AI-Server/src/setup.sh"
echo
exit 1
fi
# This is needed.
oneStepPIP=true
if [ "${edgeDevice}" = "Raspberry Pi" ] || [ "${edgeDevice}" = "Orange Pi" ] ||
[ "${edgeDevice}" = "Radxa ROCK" ] || [ "${edgeDevice}" = "Jetson" ]; then
moduleInstallErrors="Unable to install on Pi, ROCK or Jetson hardware."
fi
# Supporting libraries so the PIP installs will work
if [ "$moduleInstallErrors" = "" ] && [ "$os" = "linux" ] && [ "$architecture" == "x86_64" ]; then
# ensure libcurl4 is present
installAptPackages "libcurl4"
if [ ! -f /usr/lib/x86_64-linux-gnu/libssl.so.1.1 ] || [ ! -e /usr/lib/libcrypto.so.1.1 ]; then
# output a warning message if no admin rights and instruct user on manual steps
install_instructions="cd ${moduleDirPath}${newline}sudo bash ../../CodeProject.AI-Server/src/setup.sh"
checkForAdminAndWarn "$install_instructions"
if [ "$isAdmin" = true ] || [ "$attemptSudoWithoutAdminRights" = true ]; then
moduleInstallErrors=""
if [ "$os_name" != "debian" ]; then
echo "deb http://security.ubuntu.com/ubuntu focal-security main" | sudo tee /etc/apt/sources.list.d/focal-security.list
fi
installAptPackages "libssl1.1"
# LIBSSL: Add link at /usr/lib/libssl.so.1.1 that points to /lib/x86_64-linux-gnu/libssl.so.1.1
if [ -f /lib/x86_64-linux-gnu/libssl.so.1.1 ] && [ ! -e /usr/lib/libssl.so.1.1 ]; then
if [ "${verbosity}" = "loud" ]; then
sudo ln -s /lib/x86_64-linux-gnu/libssl.so.1.1 /usr/lib/libssl.so.1.1
else
sudo ln -s /lib/x86_64-linux-gnu/libssl.so.1.1 /usr/lib/libssl.so.1.1 >/dev/null 2>/dev/null
fi
fi
# LIBRYPTO: Add link at /usr/lib/libcrypto.so.1.1 that points to /lib/x86_64-linux-gnu/libcrypto.so.1.1
if [ -f /lib/x86_64-linux-gnu/libcrypto.so.1.1 ] && [ ! -e /usr/lib/libcrypto.so.1.1 ]; then
if [ "${verbosity}" = "loud" ]; then
sudo ln -s /lib/x86_64-linux-gnu/libcrypto.so.1.1 /usr/lib/libcrypto.so.1.1
else
sudo ln -s /lib/x86_64-linux-gnu/libcrypto.so.1.1 /usr/lib/libcrypto.so.1.1 >/dev/null 2>/dev/null
fi
fi
# https://docs.voxel51.com/getting_started/troubleshooting.html#database-exits
sudo ulimit -n 64000
fi
fi
fi
# PyTorch-DirectML not working for this module
# if [ "$moduleInstallErrors" = "" ] && [ "$hasCUDA" != true ] && [ "$os" = "linux" ]; then
# writeLine 'Installing PyTorch-DirectML...'
# installPythonPackagesByName "torch-directml" "PyTorch DirectML plugin"
# fi
if [ "$moduleInstallErrors" = "" ] && [ "$os" = "macos" ]; then
write 'Installing updated setuptools in venv...' $color_primary
"$venvPythonCmdPath" -m pip install -U setuptools >/dev/null 2>/dev/null &
spin $!
writeLine "done" $color_success
fi
# OpenCV needs a specific version for macOS 11
# https://github.com/opencv/opencv-python/issues/777#issuecomment-1879553756
if [ "$os_name" = "Big Sur" ]; then # macOS 11.x on Intel, kernal 20.x
installPythonPackagesByName "opencv-python==4.6.0.66" "OpenCV 4.6.0.66 for macOS 11.x"
fi
if [ "$moduleInstallErrors" = "" ]; then
# Download the models and store in /assets and /custom-models (already in place in docker)
getFromServer "models/" "models-yolo5-pt.zip" "assets" "Downloading Standard YOLO models..."
# TODO: Check assets created and has files
# moduleInstallErrors=...
fi