跳至內容

on restarting the instance in sagemaker and selecting kernel, not able to import modules

0

Hello I created, activated, installed modules and saved a new environment as a kernel in sagemaker studio using below commands, !conda create -n myenv -y !source activate myenv !pip install kxyz !python -m ipykernel install --user --name myenv --display-name "Neyd"

then closed the instance and then restarted the instance and selected the Neyd kernel. But, then import kxyz shows no module found. pip list also doesnt show this module, !conda env list also doesnt show myenv .

can someone help. i dont want to install all packages everytime I start the instance.

已提問 3 年前檢視次數 1303 次

2 個答案
1

if you stop a notebook instance, you will lose any changes you made to the Conda environment or installed packages in that session. If you want to keep your changes, you can either create a persistent Conda environment or save your work to a persistent storage location.

Here are some additional details about the implications of stopping a notebook instance:

  • Any data that is stored in the notebook's ephemeral storage (such as the /tmp directory) will be lost.
  • Any running processes will be terminated.
  • Any changes you made to the notebook's configuration will be lost.

Solution:

AWS

已回答 3 年前

-1

When you stop a notebook, SageMaker terminates the notebook's Amazon Elastic Compute Cloud (Amazon EC2) instance. Non-persistent Conda environments and the packages installed don't persist between sessions. SageMaker domains and Studio use an EFS volume as a persistent storage layer. You can save your Conda environments on this EFS volume. These environments are persistent between kernel, app, or Studio restart. Studio automatically picks up all environments as KernelGateway kernels.

To Create persistent Conda environments on a Studio EFS volume, please refer the AWS article [1] and GitHub [2] which guides you through step-by-step process along with detailed instructions.

References :
[1] https://aws.amazon.com/blogs/machine-learning/four-approaches-to-manage-python-packages-in-amazon-sagemaker-studio-notebooks/#:~:text=Persist%20Conda%20environments%20to%20the%20Studio%20EFS%20volume
[2] https://github.com/durgasury/efs_backed_conda

AWS
支援工程師

已回答 3 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。