Sagemaker nbextensions

894 Views Asked by At

I am running the following script in my Sagemaker notebook's lifecycle configuration:

#!/bin/bash

set -e

# OVERVIEW
# This script installs a single pip package in a single SageMaker conda environments.

sudo -u ec2-user -i <<'EOF'
# PARAMETERS
ENVIRONMENT=python3

source /home/ec2-user/anaconda3/bin/activate "$ENVIRONMENT"

pip install "PyAthena"
pip install "jupyter_nbextensions_configurator"
jupyter nbextensions_configurator enable --sys-prefix
pip install "jupyter_contrib_nbextensions"
jupyter nbextensions_configurator enable --sys-prefix

source /home/ec2-user/anaconda3/bin/deactivate

EOF

When I open the notebook, I do not see the nbextensions tab. I have stopped and restart the notebook.

enter image description here

I have tried the subcommand lines with --user as well...

pip install "jupyter_nbextensions_configurator"
jupyter nbextensions_configurator enable --user
pip install "jupyter_contrib_nbextensions"
jupyter nbextensions_configurator enable --user

Am I missing something else?

1

There are 1 best solutions below

0
On

Refer to this sample to install notebook extensions on SageMaker notebooks.

You'd have to activate the JupyterSystemEnv for extensions. If you want a specific conda environment, such as Python3, to have a set of packages, then you can activate the python3 environment and run pip install <package> commands.