-
Notifications
You must be signed in to change notification settings - Fork 0
/
on-start.sh
29 lines (20 loc) · 789 Bytes
/
on-start.sh
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
#!/bin/bash
set -e
# OVERVIEW
# This script installs a single pip package in all SageMaker conda environments, apart from the JupyterSystemEnv which is a
# system environment reserved for Jupyter.
# Note this may timeout if the package installations in all environments take longer than 5 mins, consider using "nohup" to run this
# as a background process in that case.
sudo -u ec2-user -i <<EOF
# PARAMETERS
PACKAGE=scipy
# Note that "base" is special environment name, include it there as well.
for env in base /home/ec2-user/anaconda3/envs/*; do
source /home/ec2-user/anaconda3/bin/activate $(basename "$env")
if [ $env = 'JupyterSystemEnv' ]; then
continue
fi
pip install --upgrade "$PACKAGE"
source /home/ec2-user/anaconda3/bin/deactivate
done
EOF