LoginSignup
3
1

More than 5 years have passed since last update.

Jupyter Notebookで再生ボタンを実行できなかったので、ipykernelのバージョンを変更した

Last updated at Posted at 2018-09-30

はじめに

機械学習を勉強するにあたり、「scikit-learnとTensorFlowによる実践機械学習」で学習を進めています。
ここで2章のとおりに「Jupyter Notebook」を入れてみましたが、再生ボタンをクリックしても実行できませんでした。
python3.5とjupyter関連に問題があったようなので、バージョン指定することでエラーを回避しました。(2018-09-30時点)


scikit-learnとTensorFlowによる実践機械学習

環境

  • Mac OS High Sierra 10.13
  • Python 3.5.5(書籍で3.5のバージョンを使用していたため)

  • pipインストール

pip3 install --upgrade jupyter matplotlib numpy pandas scipy scikit-learn

実行内容

「scikit-learnとTensorFlowによる実践機械学習」2章のP.43にあるとおり、Jupyter Notebook内での画面出力を試しました。

print("Hello world!")

結果

  • 画面出力されない
  • セルが追加される

Consoleの内容

ImportError: No module named 'prompt_toolkit.formatted_text'

解決策

Python3.5において、pip install jupyterでインストールされた「ipykernel」が原因のようでした。
https://github.com/jupyter/jupyter/issues/370

なので「ipykernel」のバージョンを、5未満にして対応しました。

pip uninstall ipykernel
pip install 'ipykernel<5.0.0'
pip uninstall jupyter-console
pip install 'jupyter-console<5.0.0'

これで、「Hello world!」が出力されるようになりました。

さいごに

Pythonを詳しく分からず、書籍を読みながら勉強を進めています。
同じような事象になられた方の参考になれば幸いです。

参考

3
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1