3

ipynb file while starting a Sagemaker instance. current status is: Cloudwatch(success) -> Lambda(success) - > Sagemaker instance(success) -> Running Particular Notebook (failed)

1.I tried using "Sagemaker Lifecycle" config with the code

jupyter nbconvert --execute prediction-12hr.ipynb --ExecutePreprocessor.kernel_name=conda_tensorflow_p36

but getting an error

[NbConvertApp] Converting notebook prediction-12hr.ipynb to html [NbConvertApp] Executing notebook with kernel: conda_tensorflow_p36
...
raise NoSuchKernel(kernel_name) jupyter_client.kernelspec.NoSuchKernel: No such kernel named conda_tensorflow_p36

on running

`!conda env list'
conda environments:

base * /home/ec2-user/anaconda3
JupyterSystemEnv /home/ec2-user/anaconda3/envs/JupyterSystemEnv
chainer_p27 /home/ec2-user/anaconda3/envs/chainer_p27
chainer_p36 /home/ec2-user/anaconda3/envs/chainer_p36
mxnet_p27 /home/ec2-user/anaconda3/envs/mxnet_p27
mxnet_p36 /home/ec2-user/anaconda3/envs/mxnet_p36
python2 /home/ec2-user/anaconda3/envs/python2
python3 /home/ec2-user/anaconda3/envs/python3
pytorch_p27 /home/ec2-user/anaconda3/envs/pytorch_p27
pytorch_p36 /home/ec2-user/anaconda3/envs/pytorch_p36
tensorflow_p27 /home/ec2-user/anaconda3/envs/tensorflow_p27
tensorflow_p36 /home/ec2-user/anaconda3/envs/tensorflow_p36

Also tried injecting a python/bash code to run the instance startup, pausing the start-up code to wait untill conda instance is setup by sagemaker.
Still no luck

Can someone suggest a plan to run .ipynb file in anyways possible.

Geo Joy
  • 347
  • 2
  • 10

2 Answers2

0

Try to activate the relevant Python virtualenv that the notebooks relies.

source /home/ec2-user/anaconda3/envs/tensorflow_p36/bin/activate
jupyter nbconvert --execute ...

Learn more How to activate virtualenv?

Gili Nachum
  • 5,288
  • 4
  • 31
  • 33
  • /home/ec2-user/anaconda3/envs/tensorflow_p36/bin/activate: No such file or directory /home/ec2-user/SageMaker/start_script.sh: line 9: source: activate: file not found – Geo Joy Sep 21 '18 at 04:41
-1

Can you try activating tensorflow_p36 env and execute notebook file in that environment? That way you don't have to specify a kernel.

source activate tensorflow_p36
jupyter nbconvert --execute prediction-12hr.ipynb
Han
  • 222
  • 1
  • 2