Jupytext allows you to save your notebook as a plain python or markdown file. One of the advantages is that you can do an easy git diff in merge requests.
How can you install the jupytext plugin on the jupyter/jupyterlab environment on AWS Sagemaker?
to install jupytext in jupyter(lab) use the following script in your sagemaker on-start lifecycle config:
#!/bin/bash
set -e
echo "installing jupytext plugin into the jupyter(lab) environment"
sudo -u ec2-user -i <<EOF
# to install jupyter plugins, you need to select the jupyter environment
source /home/ec2-user/anaconda3/bin/activate /home/ec2-user/anaconda3/envs/JupyterSystemEnv
# install jupytext
pip install jupytext --upgrade
# As of Feb 2021, Sagemaker is using jupyterlab v 1.x for which Jupytext recommends the following version.
jupyter labextension install [email protected]
# allow jupyter to open and save notebooks as text files.
echo c.NotebookApp.contents_manager_class="jupytext.TextFileContentsManager" >> /home/ec2-user/.jupyter/jupyter_notebook_config.py
# restart jupyter to let the changes take effect.
sudo initctl restart jupyter-server --no-wait
EOF
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With