JuliaでPyPlotが動かない。plotした瞬間に落ちる。ついでにpythonでも.show()した瞬間に落ちる。
JuliaでPyPlotが動かない
インストールした時の記事はこちら
easygoingrider.hatenablog.com
かなり適当にインストールしたので、何か良くなかった模様。
jupyter-lab上でpyplotを動かした瞬間、具体的にはplotを呼んだ瞬間にカーネルが落ちる。
以下、うまくいかなかったメモ。
*次の記事はこちら
easygoingrider.hatenablog.com
*うまくいった記事はこちら
easygoingrider.hatenablog.com
一番最初にjupyter labでusing PyPlot
を実行した時、足りないパッケージなどを自動でインストールされた模様。その際、pipだった?あまり良く見ていなかったからわからん。とりあえずどうやっても動かなくなってしまった。悪いことにpythonのほうのmatplotlibまで動かない。
とりあえずここからはpython上でmatplotlibの復活を試みる。
matplotlibのアップデートも試したがダメ。plt.show()で落ちる。
qiita.com
こんな記事を見つけたので、matplotlibrcを開いてバックエンドもいじってみたが違う感じ。TkAggを記入したが、
Duplicate key in file WindowsPath('C:/Users/user/.julia/conda/3/lib/site-packages/matplotlib/mpl-data/matplotlibrc'), line 82 ('backend: TkAgg ')
といわれる。というか、何も言わずにmatplotlibが作るウィンドウがフリーズして消えていくので何がエラーなのか全然わからない。.show()以外は(.plot()などは)ちゃんと動いている??
とりあえずmatplotlibの再インストール
conda uninstall matplotlib conda install matplotlib
ダメだった。やっぱりウィンドウが開くが、すぐに消える。同時にpythonも落ちる。
Figure1というウィンドウが出て、(反応なし)の状態、落ちる
ただ、落ちるまでの時間が短くなった。なぜ。
つぎ、とりあえずpipが悪いのではと勝手に予想
pip uninstall matplotlib
でmatplotlib-3.4.3を削除。
pip list | find "matplotlib"
でサーチ、matplotlib-inline 0.1.2がいる。
conda list | find "matplotlib"
conda でも見える。とりあえず消す。
pip uninstall matplotlib-inline
condaからも消えていた。
conda list | find "matplotlib" matplotlib 3.4.3 py39haa95532_0
(というか、後で気付いたが、なぜかpython が3.9になっている…?anacondaでアップデートしても、3.8.12より上のバージョンに行かなかったのに…デフォルトのチャンネルだとダメなのか…?)
condaからも消す
conda uninstall matplotlib
なぜかmatplotlib-inlineが復活している。
conda list | find "matplot" matplotlib-inline 0.1.2 pyhd3eb1b0_2
もっかい消す
conda uninstall matplotlib
完全にいなくなった。再インストール
conda install matplotlib conda list | find "matplot" matplotlib 3.4.3 py39haa95532_0 matplotlib-base 3.4.3 py39h49ac443_0
matplotlib-inlineがいなくなった。もっかいインストール。
conda install matplotlib-inline conda list | find "matplot" matplotlib 3.4.3 py39haa95532_0 matplotlib-base 3.4.3 py39h49ac443_0 matplotlib-inline 0.1.2 pyhd3eb1b0_2
pythonを起動。pyplotを試す
>>> import matplotlib.pyplot as plt >>> plt.plot([1,2,3]) [<matplotlib.lines.Line2D object at 0x0000019218E36970>] >>> plt.show()
ここで落ちる。 何も変わっとらんやんけ。。。
jupyter-labでも試す。
Kernel Restarting The kernel for Source/Jupyter test/Untitled.ipynb appears to have died. It will restart automatically. [I 2021-10-31 19:23:22.121 ServerApp] AsyncIOLoopKernelRestarter: restarting kernel (1/5), keep random ports kernel ca50f313-2607-4a57-8b8e-abaf831004ab restarted kernel ca50f313-2607-4a57-8b8e-abaf831004ab restarted
だめ。
conda update --all
色々入れた。
conda upgrade --all # All requested packages already installed.
もっかい確認。
condaからpythonでmatplotを動かすと、これまでと同じ
>>> import matplotlib.pyplot as plt >>> plt.plot([1,2,3]) [<matplotlib.lines.Line2D object at 0x0000019218E36970>] >>> plt.show() # ここで落ちる
jupyter-labでpyplotを動かすと、
import matplotlib.pyplot as plt plt.plot([0,1,2,3,4,5],[0,1,4,9,16,25]) [<matplotlib.lines.Line2D at 0x1efe1c10e80>]
だが、この時点でカーネルが落ちる
Kernel Restarting The kernel for Source/Jupyter test/Untitled.ipynb appears to have died. It will restart automatically.
ダメだ、動かない。もっかい最初からインストールやり直すか。。。
参考にしたサイト
qiita.com
これ、大事だった。ちゃんと環境変数の設定せなあかんのか…どうやらエラーは二つあって、一つ目がこれで、QTのパス通したらjuliaのエラーの出方が変わった。
qiita.com
This application failed to start because it could not find or load the Qt platform plugin "windows"
in "".
Reinstalling the application may fix this problem.
このエラーが消えた。
これはダメだった。すでにインストールされていた。
qiita.com
これもダメだった。
www.eureka-moments-blog.com
これも違う、というかそもそもMKLに関するエラーは出ていない
qiita.com