Skip to content

Instantly share code, notes, and snippets.

@thanakijwanavit
Last active May 2, 2021 16:57
Show Gist options
  • Save thanakijwanavit/83c28fd2ef1a413bb88bac97de17c949 to your computer and use it in GitHub Desktop.
Save thanakijwanavit/83c28fd2ef1a413bb88bac97de17c949 to your computer and use it in GitHub Desktop.
jupyterlab config code config sagemaker
name="my-env"
version="3.7"
# Create a new conda environment for the given Python version
conda create -y -n "$name" python="$version"
# Activate the environment
source /home/ec2-user/anaconda3/bin/activate "$name"
# Create a Jupyter kernel for your new environment
pip install ipykernel
python -m ipykernel install --name "$name" --display-name "$name" --user
# Deactivate the environment
source /home/ec2-user/anaconda3/bin/deactivate
conda create --name python39 python=3.9
python -m ipykernel install --user --name python39 --display-name "python39"
conda create --name python38 python=3.8
python -m ipykernel install --user --name python38 --display-name "python38"
https://donagh.io/using-custom-python-versions-with-sagemaker/
{
"shortcuts":[
{
"command": "runmenu:restart-and-run-all",
"keys": [
"Ctrl R"
],
"selector": "[data-jp-code-runner]"
},
{
"command": "notebook:enter-command-mode",
"keys": [
"Ctrl Escape"
],
"selector": ".jp-Notebook.jp-mod-editMode"
},
{
"command": "tooltip:dismiss",
"keys": [
"Ctrl Escape"
],
"selector": "body.jp-mod-tooltip .jp-CodeConsole-promptCell"
},
{
"selector": ".jp-Notebook.jp-mod-editMode",
"keys": ["Escape"],
"command": "leave-insert-mode"
}
]
}
{
"markdownCellConfig": {
"autoClosingBrackets": false,
"fontFamily": null,
"fontSize": null,
"lineHeight": null,
"lineNumbers": true,
"lineWrap": "on",
"matchBrackets": false,
"readOnly": false,
"insertSpaces": true,
"tabSize": 2,
"wordWrapColumn": 80,
"rulers": [],
"codeFolding": false,
"lineWiseCopyCut": true
},
"codeCellConfig": {
"autoClosingBrackets": true,
"fontFamily": null,
"fontSize": null,
"lineHeight": null,
"lineNumbers": true,
"lineWrap": "off",
"matchBrackets": true,
"readOnly": false,
"insertSpaces": true,
"tabSize": 2,
"wordWrapColumn": 80,
"rulers": [],
"codeFolding": false,
"lineWiseCopyCut": true
}
}
url='https://gist.githubusercontent.com/thanakijwanavit/83c28fd2ef1a413bb88bac97de17c949/raw/startup.sh'
bash <(curl -s $url)
#!/bin/bash
set -e
sudo yum -y install amazon-efs-utils
#### mount efs
EFS_DNS_NAME=fs-37a44477
mkdir -p /home/ec2-user/SageMaker/efs
mount \
-t efs \
$EFS_DNS_NAME:/ /home/ec2-user/SageMaker/efs \
--verbose
chmod go+rw /home/ec2-user/SageMaker/efs
###### install extensions
sudo -u ec2-user -i <<'EOF'
# PARAMETERS
EXTENSION_NAME=@ryantam626/jupyterlab_vim
source /home/ec2-user/anaconda3/bin/activate JupyterSystemEnv
jupyter labextension install $EXTENSION_NAME
source /home/ec2-user/anaconda3/bin/deactivate
EOF
### set up git env
# PARAMETERS
YOUR_USER_NAME="nic"
YOUR_EMAIL_ADDRESS="[email protected]"
sudo -u ec2-user -i <<EOF
git config --global user.name "$YOUR_USER_NAME"
git config --global user.email "$YOUR_EMAIL_ADDRESS"
EOF
###### add environment
name="python38"
version="3.8"
# Create a new conda environment for the given Python version
/home/ec2-user/anaconda3/bin/conda create -y -n "$name" python="$version"
# # Activate the environment
# /home/ec2-user/anaconda3/bin/conda activate "$name"
# # Create a Jupyter kernel for your new environment
# pip install ipykernel
# python -m ipykernel install --name "$name" --display-name "$name" --user
# # install other packages
# pip install nicHelper nbdev s3bz pandas numpy powerline-status
# # Deactivate the environment
# # source /home/ec2-user/anaconda3/bin/deactivate
# conda deactivate
###### install fish
sudo yum-config-manager --add-repo http://fishshell.com/files/linux/RedHat_RHEL-6/fish.release:2.repo
sudo yum -y install fish
#### install omf
curl -L https://get.oh-my.fish | fish
omf theme agnoster
omf install aws
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment