Last active
January 22, 2022 17:16
-
-
Save Andre-Tan/7aafbd87d019cb132b135e315b2592d5 to your computer and use it in GitHub Desktop.
2022Jan22-Enabling_jupyter_contrib_nbextensions_in_Sagemaker_Notebook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' | |
This is a quick shortcut to enable jupyter_contrib_nbextensions in AWS SageMaker Notebook instance. | |
The correct way is to have the installation script as part of the instance Lifecycle Config. | |
Apparently you can do without, but as with virtual environments in AWS Sagemaker, you lose it if you kill the instance. | |
' | |
# Check whether vanilla nbextension is there or not | |
jupyter nbextension list | |
# Install jupyter_contrib_nbextensions. Note that you can enable all extensions in the package after these 2 lines. | |
pip install jupyter_contrib_nbextensions | |
jupyter contrib nbextension install | |
# Enable nbextensions through terminal/use this bash script as-is if these are the packages you want | |
jupyter nbextension enable codefolding/main | |
jupyter nbextension enable codefolding/edit | |
jupyter nbextension enable collapsible_headings/main | |
jupyter nbextension enable execute_time/ExecuteTime | |
jupyter nbextension enable toc2/main | |
# Open or refresh a Jupyter Notebook. The extensions should already be enabled. | |
' | |
References | |
1. [SageMaker: Install Jupyter Extensions in Restart-proof Way](https://modelpredict.com/sagemaker-restart-proof-jupyter-extensions) | |
2. [AWS Lifecycle Configuration Official Documentation](https://docs.aws.amazon.com/sagemaker/latest/dg/notebook-lifecycle-config.html) | |
3. [jupyter_contrib_nbextensions Home Page](https://jupyter-contrib-nbextensions.readthedocs.io/en/latest/) | |
4. [List of extensions in jupyter_contrib_nbextensions](https://jupyter-contrib-nbextensions.readthedocs.io/en/latest/nbextensions.html#) | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment