-
Notifications
You must be signed in to change notification settings - Fork 250
/
Copy pathon-start.sh
31 lines (21 loc) · 907 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
30
31
#!/bin/bash
set -e
# OVERVIEW
# This script installs a single conda package in all SageMaker conda environments, apart from the JupyterSystemEnv
# which is a system environment reserved for Jupyter.
# NOTE: if the total runtime of this script exceeds 5 minutes, the Notebook Instance will fail to start up. If you
# would like to run this script in the background, then replace "sudo" with "nohup sudo -b". This will allow the
# Notebook Instance to start up while the installation happens in the background.
sudo -u ec2-user -i <<'EOF'
# PARAMETERS
PACKAGE=scipy
# Note that "base" is special environment name, include it there as well.
conda install "$PACKAGE" --name base --yes
for env in /home/ec2-user/anaconda3/envs/*; do
env_name=$(basename "$env")
if [ $env_name = 'JupyterSystemEnv' ]; then
continue
fi
conda install "$PACKAGE" --name "$env_name" --yes
done
EOF