spedas / pyspedas

Python-based Space Physics Environment Data Analysis Software
https://pyspedas.readthedocs.io/
MIT License
149 stars 58 forks source link

Trouble importing pyspedas in a linux subsytem on windows. #95

Closed qudsiramiz closed 3 years ago

qudsiramiz commented 3 years ago

I am using WSL on a Windows system where I installed pyspedas in a new virtual environment just like it says on the GitHub page. However when I try to import it in either python or ipython, it aborts the whole process by core dump saying: qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.

I have tried reinstalling it and a bunch of other things, like installing the available/suggested platform plugins. But so far nothing has helped.

I tried using Spyder from Anaconda Navigator, but that has it's own set of issues!

I have attached a screenshot of the issue.

Any suggestion on how to resolve this issue?

python_pyspedas

ericthewizard commented 3 years ago

Thanks for the bug report!

There are probably some missing libraries in your WSL installation. I was able to get everything to work with a fresh WSL (Ubuntu) installation with:

  1. I used VcXsrv to run an X server on the host Windows system, from directions I found at:

https://techcommunity.microsoft.com/t5/windows-dev-appconsult/running-wsl-gui-apps-on-windows-10/ba-p/1493242

You might already have this setup, but if not, it'll be required (you need an X Windows server to send the plots to).

  1. I used the following commands:
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get -y install python3-pip
sudo apt-get -y install gedit
sudo apt-get -y install libxcb-xinerama0
pip3 install pyspedas
export DISPLAY=$(ip route|awk '/^default/{print $3}'):0.0

I think installing gedit and libxcb-xinerama0 fix the exact issue you're seeing.

Hope this helps!

qudsiramiz commented 3 years ago

Thank you so much. That worked. I think just executing the last line would have made it work, since despite doing everything anew it did exactly same, as in dumped the core. So I had to execute the line export DISPLAY=$(ip route|awk '/^default/{print $3}'):0.0 every time I opened a new terminal. Ended up putting that in the .bashrc file and now it works fine!