Sagemaker Studio notebook - no module named 'tensorflow' when chosen image type "Tensorflow 2.6 Python 3.8 GPU optimized"

0

Hi,

I have created a simple notebook on SageMaker Studio using the Image "Tensorflow 2.6 Python 3.8 GPU optimized". But when I try to run simple statement viz. "import tensorflow", I am getting the error "no module named 'tensorflow'".

I tried to install 'tensorflow' package using pip from the terminal attached to the image. But it shows the message "requirement already satisfied".

Am I missing anything here? Please help.

Thanks in advance, Praveen

質問済み 3年前964ビュー
1回答
1
承認された回答

From the question, I understand that you are trying to use a TensorFlow 2.6 Python 3.8 kernel in SageMaker Studio, but you are unable to import tensorflow.

The service team are aware of this issue and are actively working on a fix.

Mitigation Option

A) If your use case is version flexible, version other than 2.6 should work.

B) If not, you can try the following as workaround

  1. Open a notebook using a Tensorflow 2.6 Python 3.8 kernel
  2. Execute the following line in a notebook cell: !sed -i 's|^ *"python",| "/usr/local/bin/python",|g' /usr/local/share/jupyter/kernels/python3/kernel.json
  3. Stop the kernel
  4. Re-attach the kernel to your notebook.

Hope it helps!

サポートエンジニア
回答済み 3年前
profile picture
エキスパート
レビュー済み 6ヶ月前
  • Thanks for informing that it's a known issue. Are there any other known issues of SageMaker Studio documented in a webpage? Please send me the link if it exists.

    The solution mentioned in option #B didn't work for me. Tried for couple of times, but still I am getting same error.

    I went for option #A and it's working fine as for Tensorflow.

    Thanks for the help!!

  • Option #B also working fine for me. Thanks for the workaround!!

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ