LoginSignup
1
0

More than 3 years have passed since last update.

Installation of Mayavi2 on Ubuntu on WSL

Posted at

Matplotlibの3次元グラフ機能に不満があったので,MatplotlibがおすすめしていたMayavi2というものをインストールしてみることにした

基本的なインストール方法はMayaviのホームページに書いてあった

python3 -m pip install mayavi
python3 -m pip install PyQt5

で,起動の確認は

mayavi2

できるらしいが,ここでエラー.

qt.qpa.xcb: could not connect to display
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.

Aborted (core dumped)

この方の言うように別のパッケージをaptでインストールしてみてもだめだった.
そこでこのページを参考にexport QT_DEBUG_PLUGINS=1と環境変数1を設定してからもう一度

mayavi2

とすると色々さらにうわーって出てから,後の方に

QLibraryPrivate::loadPlugin failed on "/<hogehoge>/libqxcb.so" : "Cannot load library /<hogehoge>/libqxcb.so

みたいなのが出ると思う.

ので以下のように依存関係の中でnot foundなものを探す

ldd /<hogehoge>/libqxcb.so | grep "not found"

ちなみに自分のPyQtのインストール方法では<hogehoge>の部分は
~/.local/lib/python3.8/site-packages/PyQt5/Qt5/plugins/platforms/であった.

これでnot foundなものを上から順にapt installしてく.
not foundと表示されているのはライブラリ名<fugafuga>.soみたな名前だと思うが,それを参考に

sudo apt install <fugafuga>#ここでTABキーを押すと似た名前のパッケージリストが出る

パッケージリストのうち,インストールしたいライブラリに最も近い名前のものをインストールする.たぶんパッケージには-devがついてるのとついてないのがあって,ついてなくてもいいけど,-devつきなら全部はいってるはず.

たぶん上から4つくらいインストールすれば依存関係があるのが一緒にインストールされてくれて解決すると思う.

で,またmayaviの起動確認

mayavi2

とこんどは一瞬X11が開くがすぐに落ちてOpenGL系のエラー

Unable to find a valid OpenGL 3.2 or later implementation. Please update your video card driver to the latest version. If you are using Mesa please make sure you have version 11.2 or later and make sure your driver in Mesa supports OpenGL 3.2 such as llvmpipe or openswr. If you are on windows and using Microsoft remote desktop note that it only supports OpenGL 3.2 with nvidia quadro cards. You can use other remoting software such as nomachine to avoid this issue

これはX11側を再起動してWGL(Windows側のOpenGLを使用)をOFFにすれば解決

もう一度mayaviの起動確認

mayavi2

x11のウィンドウがforgroundで開き,落ちない!


  1. これは今だけ必要なだけで設定ファイルとかに書き込まない方がいい 

1
0
0

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
1
0