adamerose / PandasGUI

A GUI for Pandas DataFrames
MIT No Attribution
3.2k stars 233 forks source link

WebGL error #25

Closed miglto closed 4 years ago

miglto commented 4 years ago

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 commented 4 years ago

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

adamerose commented 4 years ago

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 commented 4 years ago

That works fine.

However, this is rendered in Safari. Does the pandasgui window use some other engine?

On Aug 18, 2020, at 4:31 PM, Adam notifications@github.com wrote:

Hi @miglto https://github.com/miglto It works for me: https://user-images.githubusercontent.com/10884874/90562284-f10cf880-e16f-11ea-8c99-36c168d86e49.png 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") — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/adamerose/pandasgui/issues/25#issuecomment-675697613, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMLDVNFGVHP6FPWXTMT3RHLSBLQL5ANCNFSM4QD6KCBA.

adamerose commented 4 years ago

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 commented 4 years ago

Done. Get the WebGL error:

On Aug 18, 2020, at 4:50 PM, Adam notifications@github.com wrote:

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_() — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/adamerose/pandasgui/issues/25#issuecomment-675713113, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMLDVNEH5F6EL3MYGQZXWJTSBLSPTANCNFSM4QD6KCBA.

miglto commented 4 years ago

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 commented 4 years ago

Posted to the Qt forum:

https://forum.qt.io/topic/118171/webgl-error-on-mac

On Aug 18, 2020, at 4:50 PM, Adam notifications@github.com wrote:

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_() — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/adamerose/pandasgui/issues/25#issuecomment-675713113, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMLDVNEH5F6EL3MYGQZXWJTSBLSPTANCNFSM4QD6KCBA.

adamerose commented 4 years ago

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 commented 4 years ago

That did not work. I have the latest of PyQt5 and PyQtWebEngine (looks to be version 12.8.0 according to pip).

Miguel

On Aug 18, 2020, at 8:18 PM, Adam notifications@github.com wrote:

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/ https://stackoverflow.com/ with the pyqt and pyqt5 tags.

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

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/adamerose/pandasgui/issues/25#issuecomment-675781149, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMLDVNHCOVYHKHR3ZN66MY3SBMK5RANCNFSM4QD6KCBA.

miglto commented 4 years ago

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

miglto commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

That's cool.

A few comments:

miglto commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

ftr, I have the same issue in Ubuntu 18.04

adamerose commented 4 years ago

@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 commented 4 years ago

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