I am currently trying to run spyder on wsl using xLauncher. I am running wsl 2 on Ubuntu. I could not get the GUI for spyder to load using xLauncher.
First I installed Ubuntu wsl --install --distribution Ubuntu
,
went into root directory sudo su
,
downloaded anaconda wget https://repo.anaconda.com/archive/Anaconda3-2024.02-1-Linux-x86_64.sh
,
installed anaconda bash Anaconda3-2024.02-1-Linux-x86_64.sh
,
then I restarted wsl so the conda environment could take effect,
I then downloaded spyder conda install spyder
,
I downloaded xLauncher and launched it changing display number to 0,
echo $DISPLAY
outputs :0
,
I then try and launch spyder, getting the following error:
File "/root/anaconda3/bin/spyder", line 11, in <module> sys.exit(main()) ^^^^^^ File "/root/anaconda3/lib/python3.11/site-packages/spyder/app/start.py", line 252, in main from spyder.app import mainwindow File "/root/anaconda3/lib/python3.11/site-packages/spyder/app/mainwindow.py", line 46, in <module> from qtpy.compat import from_qvariant File "/root/anaconda3/lib/python3.11/site-packages/qtpy/compat.py", line 16, in <module> from .QtWidgets import QFileDialog File "/root/anaconda3/lib/python3.11/site-packages/qtpy/QtWidgets.py", line 36, in <module> from PyQt5.QtWidgets import *ImportError: libGL.so.1: cannot open shared object file: No such file or directory
I then run apt update
and apt upgrade
and conda update --all
, a bunch of stuff updates but I get the same error message.
Then according to this thread I run apt-get install qtbase5-dev
and the error message changes to
File "/root/anaconda3/bin/spyder", line 11, in <module> sys.exit(main()) ^^^^^^ File "/root/anaconda3/lib/python3.11/site-packages/spyder/app/start.py", line 252, in main from spyder.app import mainwindow File "/root/anaconda3/lib/python3.11/site-packages/spyder/app/mainwindow.py", line 57, in <module> from qtpy import QtWebEngineWidgets # analysis:ignore ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/anaconda3/lib/python3.11/site-packages/qtpy/QtWebEngineWidgets.py", line 28, in <module> from PyQt5.QtWebEngineWidgets import (ImportError: libasound.so.2: cannot open shared object file: No such file or directory
so then according to this thread, I did apt-get install libasound2
and it worked!
I was compiling the list of things I had tried and I guess I finally did it in the correct order.
Edit: so the reason I wanted spyder and python on wsl was for the newer tensorflow versions to work on my GPU. Well conda cannot install a new enough version of tensorflow so I had to re-do my entire conda environment through pip, after which I got another error opening spyder:
File "/root/anaconda3/envs/options/bin/spyder", line 8, in <module> sys.exit(main()) ^^^^^^ File "/root/anaconda3/envs/options/lib/python3.11/site-packages/spyder/app/start.py", line 252, in main from spyder.app import mainwindow File "/root/anaconda3/envs/options/lib/python3.11/site-packages/spyder/app/mainwindow.py", line 57, in <module> from qtpy import QtWebEngineWidgets # analysis:ignore ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/anaconda3/envs/options/lib/python3.11/site-packages/qtpy/QtWebEngineWidgets.py", line 28, in <module> from PyQt5.QtWebEngineWidgets import (ImportError: libsmime3.so: cannot open shared object file: No such file or directory
which was fixed after looking at this thread by doing apt-get install libnss3