Skip to content

Instantly share code, notes, and snippets.

@MohamedKari
Last active March 1, 2020 21:25
Show Gist options
  • Save MohamedKari/7a90b191fe10caca7cb2bc6773181b25 to your computer and use it in GitHub Desktop.
Save MohamedKari/7a90b191fe10caca7cb2bc6773181b25 to your computer and use it in GitHub Desktop.
Install Custom Env on SageMaker Notebook Instance
#!/bin/sh
source deactivate
export CONDA_CUSTOM_ENV_URL="$1"
export CONDA_CUSTOM_ENV_PARENT_DIR="/home/ec2-user/SageMaker"
export CONDA_CUSTOM_ENV_DIR="$CONDA_CUSTOM_ENV_PARENT_DIR/custom_env"
cd $CONDA_CUSTOM_ENV_PARENT_DIR
curl $CONDA_CUSTOM_ENV_URL -o custom_env.yml
conda env create --prefix ./custom_env --file custom_env.yml
source activate $CONDA_CUSTOM_ENV_DIR
pip install ipykernel
python -m ipykernel install --user --name custom_env --display-name "Python (custom_env)"
# installs kernelspec at /home/ec2-user/.local/share/jupyter/kernels/custom_env
source deactivate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment