Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Unable to run inside a Jupyter Notebook on WSL2 #476

Open
Shaikh-Ubaid opened this issue Oct 31, 2024 · 1 comment
Open

[BUG] Unable to run inside a Jupyter Notebook on WSL2 #476

Shaikh-Ubaid opened this issue Oct 31, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@Shaikh-Ubaid
Copy link

Shaikh-Ubaid commented Oct 31, 2024

Expected Behavior

chart = Chart()
# df already contains my data with columns time, open, high, low, close
chart.set(df)
chart.show(block=True)

I expect this to open a new interactive chart window in my windows operating system. Note that I am running the above from my notebook which is opened in Brave Browser and is connected to my kernel running inside WSL2.

Current Behaviour

I get an error:

[pywebview] GTK cannot be loaded
Traceback (most recent call last):
  File "/home/ubaid/miniforge3/envs/trade/lib/python3.13/site-packages/webview/guilib.py", line 37, in import_gtk
    import webview.platforms.gtk as guilib
  File "/home/ubaid/miniforge3/envs/trade/lib/python3.13/site-packages/webview/platforms/gtk.py", line 20, in <module>
    import gi
ModuleNotFoundError: No module named 'gi'
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: linuxfb, minimal, offscreen, vnc, webgl, xcb.

Reproducible Example

  • Install WSL2
  • Launch WSL2
  • Install conda (because I am running my notebook inside a conda environment)
  • Create conda environment
    • conda create -n my_env python
    • python -m pip install pandas jupyter lightweight-charts (and other libraries that you might need)
  • Launch jupyter
    • jupyter notebook
      ` Create a new notebook, paste the following code in a code cell and run it.
from lightweight_charts import Chart
chart = Chart()
# df already contains my data with columns time, open, high, low, close
chart.set(df)
chart.show(block=True)

You should get:

[pywebview] GTK cannot be loaded
Traceback (most recent call last):
  File "/home/ubaid/miniforge3/envs/trade/lib/python3.13/site-packages/webview/guilib.py", line 37, in import_gtk
    import webview.platforms.gtk as guilib
  File "/home/ubaid/miniforge3/envs/trade/lib/python3.13/site-packages/webview/platforms/gtk.py", line 20, in <module>
    import gi
ModuleNotFoundError: No module named 'gi'
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: linuxfb, minimal, offscreen, vnc, webgl, xcb.

If you get any other error, for example, xyz library not found, then you can just google for it and install it manually using sudo apt install libxkbcommon-x11-0. I had to install couple of these before arriving at the above error.

Environment

- Windows OS: Windows 11 Pro, build 22631.4317
- WSL Version: 2, `Ubuntu 22.04.3 LTS`
- Library: `lightweight-charts        2.1`
@Shaikh-Ubaid Shaikh-Ubaid added the bug Something isn't working label Oct 31, 2024
@Shaikh-Ubaid
Copy link
Author

I haven't yet tried running the above in a plain python script, but I believe the outcome would be the same. I think the error is more related being unable to find the Xming server running inside my windows.

PS: I have already installed Xming, and launched it (with configuration: multiple windows, display number 0, and other default configuration), but no success at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant