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

WebGL error #25

Closed
miglto opened this issue Aug 18, 2020 · 20 comments
Closed

WebGL error #25

miglto opened this issue Aug 18, 2020 · 20 comments

Comments

@miglto
Copy link

miglto commented Aug 18, 2020

When trying to plot a dataframe on Mac (python 3.8, latest pandasgui from this repository), I am getting an error saying webgl is not available. I checked all browsers I have and they all support webgl (meaning when I go to the webgl site, I can see the graph - it is possible this is webgl2 not 1).

The dataset I used is here:
https://drive.google.com/file/d/1qlUt1_X_0BxbmFDP5YgAqIQBp3osP4jz/view?usp=sharing
Screen Shot 2020-08-18 at 2 56 05 PM

@miglto
Copy link
Author

miglto commented Aug 18, 2020

Pls ignore "render_mode", I was trying that out to see if it did anything.

@adamerose
Copy link
Owner

adamerose commented Aug 18, 2020

Hi @miglto

It works for me:
image

Let's check if your problem is related to pandasgui or just plotly. Can you run the code below and let me know what happens?

import pandas as pd
import plotly.express as px

df = pd.read_csv('https://drive.google.com/u/0/uc?id=1qlUt1_X_0BxbmFDP5YgAqIQBp3osP4jz')
fig = px.scatter(data_frame=df, x='bid', y='ask')
fig.show(renderer="browser")

It should open a Plotly figure in your browser that looks like mine above

@miglto
Copy link
Author

miglto commented Aug 18, 2020 via email

@adamerose
Copy link
Owner

adamerose commented Aug 18, 2020

Yeah pandasgui uses the QWebEngineView from PyQt.

Can you try this code now?

from PyQt5 import QtCore, QtWidgets
from PyQt5.QtWebEngineWidgets import QWebEngineView

import tempfile
import pandas as pd

import plotly.express as px
from plotly.io import to_html

df = pd.read_csv('https://drive.google.com/u/0/uc?id=1qlUt1_X_0BxbmFDP5YgAqIQBp3osP4jz')
fig = px.scatter(data_frame=df, x='bid', y='ask')

app = QtWidgets.QApplication.instance() or QtWidgets.QApplication([])

file = tempfile.NamedTemporaryFile(mode="w", suffix=".html", delete=False)
file.write(to_html(fig, config={"responsive": True}))

viewer = QWebEngineView()
viewer.load(QtCore.QUrl.fromLocalFile(file.name))
viewer.show()

app.exec_()

@miglto
Copy link
Author

miglto commented Aug 18, 2020 via email

@miglto
Copy link
Author

miglto commented Aug 18, 2020

Simple example that fails below - this is a QtWebEngine issue... Who to ask?

from PyQt5 import QtCore, QtGui, QtWidgets, QtWebEngineWidgets

app = QtWidgets.QApplication.instance() or QtWidgets.QApplication([])

viewer = QtWebEngineWidgets.QWebEngineView()
viewer.load(QtCore.QUrl("http://webglreport.com/?v=2"))
viewer.show()

app.exec_()

@miglto
Copy link
Author

miglto commented Aug 18, 2020 via email

@adamerose
Copy link
Owner

adamerose commented Aug 19, 2020

Yep looks like a QWebEngineView issue. I found a few potential fixes... try the snippet below. And if it doesn't work, also try upgrading PyQt5 and PyQtWebEngine to latest versions or at least 5.13.0

from PyQt5 import QtCore, QtWidgets, QtWebEngineWidgets

app = QtWidgets.QApplication(["--ignore-gpu-blacklist", "--enable-gpu-rasterization"])

viewer = QtWebEngineWidgets.QWebEngineView()
viewer.settings().setAttribute(QtWebEngineWidgets.QWebEngineSettings.WebGLEnabled, True)
viewer.load(QtCore.QUrl("http://webglreport.com/?v=2"))
viewer.show()

app.exec_()

Who to ask?

If none of the above works, try also posting on https://stackoverflow.com/ with the pyqt and pyqt5 tags.

Also include what OS version you're using and your version of PyQt5 and PyQtWebEngine

@miglto
Copy link
Author

miglto commented Aug 19, 2020 via email

@miglto
Copy link
Author

miglto commented Aug 19, 2020

PyQt5 and PyQtWebEngine are versions 5.15.0 (latest)
OS is macOSX 10.15.6
Laptop is MacBookPro11,1 (GPU is Inter Iris)

@miglto
Copy link
Author

miglto commented Aug 20, 2020

I installed Ubuntu 20.04 on my mac, and the webgl error is gone. I am guessing this is macos blocking a call to webgl. It is odd that it would do that but it works in Safari, Chrome, and Firefox.

@adamerose
Copy link
Owner

Yeah unfortunately I can't be much help debugging since I can't reproduce the issue myself (don't have a Mac), but if you do end up finding a solution I'll add the fix to pandasgui

@miglto
Copy link
Author

miglto commented Aug 20, 2020

Yes, I will let you know if I find a solution. However, frankly now that I got my mac to triple-boot (macos, ubuntu, windows) I will probably not bother with macos for this any longer... :)

BTW... Quick question: Would it be possible/useful to add a filter to pandasgui? Meaning for example selecting rows based on some value of the row. Obviously this can be done in code, but that's a tad slower. Thx!

@adamerose
Copy link
Owner

BTW... Quick question: Would it be possible/useful to add a filter to pandasgui? Meaning for example selecting rows based on some value of the row. Obviously this can be done in code, but that's a tad slower. Thx!

Yup I'll probably focus on that now since I'm mostly done the Grapher. If you have any ideas about how it should look & work feel free to post.

I'll probably start off by just providing a text input on each DataFrame that lets you enter strings as a Pandas query expression, and allow you to toggle them on/off.

Also considered a button on each header that pops up a UI like this, but its more work and not that much better so I'll put it off for someone else to do or until I have more time
image

@miglto
Copy link
Author

miglto commented Aug 20, 2020

That's cool.

A few comments:

  • You really want to indicate what columns have filters applied, maybe making the header red or something (otherwise it is easy to overlook)
  • For values, I often care that they are in a range, so maybe that's something consider (an and would do)
  • In other tabs (eg stats and grapher) I would also add an indication that some filtering had been applied - like a red dot or a message.

@miglto
Copy link
Author

miglto commented Aug 20, 2020

BTW... I was COMPLETELY shocked by the change in the Grapher layout. I was like "I must have broken something". Once I figured how it works, it's clearly an improvement.

@adamerose
Copy link
Owner

adamerose commented Aug 28, 2020

Closing this since you moved on and I was unable to replicate it.

btw I just pushed what I've done so far on the filters feature to the dev branch if you want to try it out.
image

You really want to indicate what columns have filters applied, maybe making the header red or something (otherwise it is easy to overlook)

Decided against this because filters can reference multiple or modified columns. It's still easy to see what filters are applied by looking at the Filters tab.

For values, I often care that they are in a range, so maybe that's something consider (an and would do)

Example of this is in my pic for both ranges and value lists.

In other tabs (eg stats and grapher) I would also add an indication that some filtering had been applied - like a red dot or a message.

I like this idea but haven't done anything on it yet. Right now Statistics remain unfiltered and Grapher works on the currently filtered DataFrame

If you have any more feedback or suggestions on filtering or other topics please open a new issue so it doesn't get lost

@beetleskin
Copy link

ftr, I have the same issue in Ubuntu 18.04

@adamerose
Copy link
Owner

adamerose commented Nov 5, 2020

@beetleskin

ftr, I have the same issue in Ubuntu 18.04

I recommend trying the same snippet as miglto:

from PyQt5 import QtCore, QtGui, QtWidgets, QtWebEngineWidgets

app = QtWidgets.QApplication.instance() or QtWidgets.QApplication([])

viewer = QtWebEngineWidgets.QWebEngineView()
viewer.load(QtCore.QUrl("http://webglreport.com/?v=2"))
viewer.show()

app.exec_()

And that will narrow it down to a PyQt5 issue, and then I recommend opening a thread here https://forum.qt.io/category/10/general-and-desktop

If someone has a solution that can be solved with code let me know and I'll put it in PandasGUI.

@beetleskin
Copy link

For me it turned out to be an issue with PyCharm. It works nicely from the ipython commandline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants