adamerose / PandasGUI

A GUI for Pandas DataFrames
MIT No Attribution
3.19k stars 237 forks source link

from PyQt5 import QtWebEngineWidgets: "ImportError" #56

Open Flock1 opened 4 years ago

Flock1 commented 4 years ago

Hi,

I installed pandasgui using pip and it installed the library but I got the following error:

from PyQt5 import QtWebEngineWidgets
ImportError: /lib/x86_64-linux-gnu/libgssapi_krb5.so.2: undefined symbol: krb5_ser_context_init, version krb5_3_MIT

I am using the package in an anaconda environment with python 3.8. Is there any specific version of PyQt5 that I need to install?

adamerose commented 4 years ago

This thread looks relevant: https://stackoverflow.com/questions/63186438/pyside2-installation-problem-on-ubuntu18-04-python-3-8-3-on-anaconda

I get a lot of issues like this about broken PyQt5 installations across various environments (often Linux and anaconda), not sure if there's anything I can do on pandasgui end to remedy this though... I just have PyQt5 and PyQtWebEngine as dependencies that get installed through pip along with pandasgui

Is there any specific version of PyQt5 that I need to install?

I don't think so, I try to be as backward compatible as possible. And your error message doesn't seem like something related to version incompatibility, more like a failed install. What version do you have?

deepcoder commented 4 years ago

I'm having a perhaps similar failure. I am trying to pip install pandasgui in a docker container from juypter: https://hub.docker.com/r/jupyter/datascience-notebook/tags/

tried uninstalling and reinstalling PyQT5 using above steps within the container, no luck.


/opt/conda/lib/python3.8/site-packages/pandasgui/widgets/plotly_viewer.py in <module>
     15 # https://stackoverflow.com/a/57436077/3620725
     16 try:
---> 17     from PyQt5 import QtWebEngineWidgets
     18 except ImportError as e:
     19     if e.msg == "QtWebEngineWidgets must be imported before a QCoreApplication instance is created":

ImportError: libXtst.so.6: cannot open shared object file: No such file or directory
​

tried:

jovyan@5a6a1a45a3aa:~$ pip uninstall pyside2, qt, pyqt5
ERROR: Invalid requirement: 'pyside2,'
jovyan@5a6a1a45a3aa:~$ pip uninstall pyside2
WARNING: Skipping pyside2 as it is not installed.
jovyan@5a6a1a45a3aa:~$ pip uninstall qt
WARNING: Skipping qt as it is not installed.
jovyan@5a6a1a45a3aa:~$ pip uninstall pyqt5
Found existing installation: PyQt5 5.15.1
Uninstalling PyQt5-5.15.1:
  Would remove:
...

jovyan@5a6a1a45a3aa:~$ pip --no-cache-dir install pyqt5
Collecting pyqt5
  Downloading PyQt5-5.15.1-5.15.1-cp35.cp36.cp37.cp38.cp39-abi3-manylinux2014_x86_64.whl (71.6 MB)

$ conda install -c conda-forge pyside2
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: done

==> WARNING: A newer version of conda exists. <==
  current version: 4.8.3
  latest version: 4.9.0

Please update conda by running

    $ conda update -n base conda

## Package Plan ##

  environment location: /opt/conda

  added / updated specs:
    - pyside2

The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    certifi-2020.6.20          |   py38h924ce5b_2         151 KB  conda-forge
    dbus-1.13.6                |       he372182_0         602 KB  conda-forge
    expat-2.2.9                |       he1b5a44_2         191 KB  conda-forge
    gst-plugins-base-1.14.5    |       h0935bb2_2         6.8 MB  conda-forge
    gstreamer-1.14.5           |       h36ae1b5_2         4.5 MB  conda-forge
    libclang-9.0.1             |default_hde54327_0        22.3 MB  conda-forge
    libllvm9-9.0.1             |       he513fc3_1        25.1 MB  conda-forge
    libxkbcommon-0.10.0        |       he1b5a44_0         475 KB  conda-forge
    libxslt-1.1.33             |       h31b3aaa_0         556 KB  conda-forge
    nspr-4.29                  |       he1b5a44_1         232 KB  conda-forge
    nss-3.55                   |       he751ad9_0         2.1 MB  conda-forge
    openssl-1.1.1h             |       h516909a_0         2.1 MB  conda-forge
    pyside2-5.13.2             |   py38hbee1fde_2        12.8 MB  conda-forge
    qt-5.12.5                  |       hd8c4c69_1        99.2 MB  conda-forge
    ------------------------------------------------------------
                                           Total:       177.0 MB

The following NEW packages will be INSTALLED:

  dbus               conda-forge/linux-64::dbus-1.13.6-he372182_0
  expat              conda-forge/linux-64::expat-2.2.9-he1b5a44_2
  gst-plugins-base   conda-forge/linux-64::gst-plugins-base-1.14.5-h0935bb2_2
  gstreamer          conda-forge/linux-64::gstreamer-1.14.5-h36ae1b5_2
  libclang           conda-forge/linux-64::libclang-9.0.1-default_hde54327_0
  libllvm9           conda-forge/linux-64::libllvm9-9.0.1-he513fc3_1
  libxkbcommon       conda-forge/linux-64::libxkbcommon-0.10.0-he1b5a44_0
  libxslt            conda-forge/linux-64::libxslt-1.1.33-h31b3aaa_0
  nspr               conda-forge/linux-64::nspr-4.29-he1b5a44_1
  nss                conda-forge/linux-64::nss-3.55-he751ad9_0
  pyside2            conda-forge/linux-64::pyside2-5.13.2-py38hbee1fde_2
  qt                 conda-forge/linux-64::qt-5.12.5-hd8c4c69_1

The following packages will be UPDATED:

  certifi                          2020.6.20-py38h32f6830_0 --> 2020.6.20-py38h924ce5b_2
  openssl                                 1.1.1g-h516909a_0 --> 1.1.1h-h516909a_0

Proceed ([y]/n)? y

-----
Same error again:

ImportErrorTraceback (most recent call last)
<ipython-input-1-c5c5d8976c89> in <module>
      1 import pandas as pd
----> 2 from pandasgui import show
      3 df = pd.DataFrame(([[1, 2, 3], [4, 5, 6], [7, 8, 9]]), columns=['a', 'b', 'c'])
      4 show(df)

/opt/conda/lib/python3.8/site-packages/pandasgui/__init__.py in <module>
----> 1 from pandasgui.gui import show
      2 
      3 __all__ = ["show"]

/opt/conda/lib/python3.8/site-packages/pandasgui/gui.py in <module>
     12 from pandasgui.store import Store, PandasGuiDataFrame
     13 from pandasgui.utility import fix_ipython, fix_pyqt, get_logger, as_dict, delete_datasets
---> 14 from pandasgui.widgets.dataframe_explorer import DataFrameExplorer
     15 from pandasgui.widgets.find_toolbar import FindToolbar
     16 from pandasgui.widgets.json_viewer import JsonViewer

/opt/conda/lib/python3.8/site-packages/pandasgui/widgets/dataframe_explorer.py in <module>
      7 from pandasgui.utility import get_logger, nunique
      8 from pandasgui.widgets.dataframe_viewer import DataFrameViewer
----> 9 from pandasgui.widgets.grapher import Grapher
     10 from pandasgui.widgets.reshaper import Reshaper
     11 from pandasgui.widgets.filter_viewer import FilterViewer

/opt/conda/lib/python3.8/site-packages/pandasgui/widgets/grapher.py in <module>
     13 
     14 from pandasgui.utility import flatten_df, get_logger
---> 15 from pandasgui.widgets.plotly_viewer import PlotlyViewer
     16 from pandasgui.widgets.spinner import Spinner
     17 from pandasgui.widgets.dragger import Dragger, ColumnArg, Schema

/opt/conda/lib/python3.8/site-packages/pandasgui/widgets/plotly_viewer.py in <module>
     27         app.__init__(sys.argv)
     28     else:
---> 29         raise e
     30 
     31 

/opt/conda/lib/python3.8/site-packages/pandasgui/widgets/plotly_viewer.py in <module>
     15 # https://stackoverflow.com/a/57436077/3620725
     16 try:
---> 17     from PyQt5 import QtWebEngineWidgets
     18 except ImportError as e:
     19     if e.msg == "QtWebEngineWidgets must be imported before a QCoreApplication instance is created":

ImportError: libXtst.so.6: cannot open shared object file: No such file or directory
​
Flock1 commented 4 years ago

Yeah. I checked the requirements for PyQt5 and it should be >= 5.15 and I have 5.15.1. So it should work.

deepcoder commented 4 years ago

I'm not sure I am of the pay grade to debug this, but even running this 'Hello World' pyqt5 app in a python 3 console in my conda docker enviroment seems to core dump python. Although, I am just guessing that, as I do not know how to find the juypter output or log:

from PyQt5 import QtWidgets
app = QtWidgets.QApplication([])
window = QtWidgets.QMainWindow()
label = QtWidgets.QLabel('\tHello World!')
window.setCentralWidget(label)
window.show()
app.exec_()
print('hi')

result:

Python 3.8.3 | packaged by conda-forge | (default, Jun  1 2020, 17:43:00) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.16.1 -- An enhanced Interactive Python. Type '?' for help.
santiariza15 commented 4 years ago

Yeah. I checked the requirements for PyQt5 and it should be >= 5.15 and I have 5.15.1. So it should work.

Hey did you find a fix?

wugoukanle commented 4 years ago

Reduce the version of PyQt to 5.12.1 and pip install PyQtWebEngine==5.12.1, arise other problem, pandasgui no response

Crypto-Spartan commented 4 years ago

same issue here, trying to run pandasgui from within jupyter. tried installing libgtk2.0-dev, libgl1-mesa-glx, libnss3, libxtst6, & libxkbcommon-x11-0. Now I'm getting an error about the x11 server.

is there a reason why pyqt5 isn't installing these modules when it is installed?

adamerose commented 4 years ago

is there a reason why pyqt5 isn't installing these modules when it is installed?

Not sure which modules you mean, the dependencies for PandasGUI include these:

        "PyQt5",
        "PyQt5-sip",
        "PyQtWebEngine",

Everyone in this thread seems to have those installed but they fail to work properly. I'm not sure what went wrong with the installation and many people have different errors. If you are unable to run from PyQt5 import QtWebEngineWidgets then your problem is with your PyQt5 installation and not PandasGUI specifically. There is an open issue to make a conda-forge distribution that I plan to follow up on this month which may make the installation more reliable but I'm not sure.

Crypto-Spartan commented 4 years ago

I believe my error is now related to pynput and there's an issue with the x-server installed. I'll have to look at the error and get back to you.

In regards to my question, I was asking why PyQt5 wouldn't automatically install libgtk2.0-dev, libgl1-mesa-glx, libnss3, libxtst6, & libxkbcommon-x11-0 as I had to install those manually myself.

santiariza15 commented 4 years ago

I downgraded PyQt to 5.12.1 and pip install PyQtWebEngine==5.12.1. It sorta worked on Jupiter but it kills the kernel

I tried it on PyCharm on Linux Mint and it works perfect :+1:

sichaoguo21 commented 3 years ago

After upgrading anaconda spyder to 4.1.5, it is failed to import pandasgui. The error is reported as

File "D:\Anaconda3\lib\site-packages\pandasgui\widgets\plotly_viewer.py", line 17, in <module>  from PyQt5 import QtWebEngineWidgets 

ValueError: PyCapsule_GetPointer called with incorrect name

And I have found a issue related to pyqt5, something similar to the error here: https://stackoverflow.com/questions/55794101/valueerrorpycapsule-getpointer-called-with-incorrect-name-with-from-pyqt5-qtwe

Being afraid to cause unstability to the spyder, I haven't tried it. Hope the question will be solved soon.

GodSpoon commented 3 years ago

Try uninstalling all of the PyQt packages and re-install using pip3

pip 3 install PyQt5 pip 3 install PyQt5-sip pip 3 install PyQtWebEngine

Packages being mixed up between pip1-3 installers causes problems

Almightyseun commented 3 years ago

After upgrading anaconda spyder to 4.1.5, it is failed to import pandasgui. The error is reported as

File "D:\Anaconda3\lib\site-packages\pandasgui\widgets\plotly_viewer.py", line 17, in <module>  from PyQt5 import QtWebEngineWidgets 

ValueError: PyCapsule_GetPointer called with incorrect name

And I have found a issue related to pyqt5, something similar to the error here: https://stackoverflow.com/questions/55794101/valueerrorpycapsule-getpointer-called-with-incorrect-name-with-from-pyqt5-qtwe

Being afraid to cause unstability to the spyder, I haven't tried it. Hope the question will be solved soon.

Has a fix for this been provided yet? I currently still have this issue on Spyder 4.2.5, I've tried downgrading my Spyder to different versions but I still can't get it to work. The dependency versions never seem to be compatible when I try to install the correct version.
For example on Spyder version 4.2.5, I installed PyQt and PyQtWebengineon version 5.12.1, and PyQt5-sip on version 12.8.1 and it returns :

"from PyQt5 import QtWebEngineWidgets ValueError: PyCapsule_GetPointer called with incorrect name"

This is just one of the different errors I run when trying to use the show command on Spyder. I've tried a different combination of the dependency versions and still run into different error messages/issues.

gatjaipur commented 3 years ago

The solution:

pip uninstall PyQtWebEngine pip uninstall PyQtWebEngine-qt5 pip install PyQtWebEngine-qt5 pip install PyQtWebEngine

blaubaer01 commented 3 years ago

Sorry, but this solution doesn't works. I still have the issue. I use Python 3.8 and Elementary OS. I have install pandasgui also on windows or Linux Mint. On this systems pandasgui works perfectly. But at a different computers.

blaubaer01 commented 3 years ago

I have tried to downgrade pyqt5 to 5.12. Then this issue disappears, but pandasqui still doesn't run. I got an Exit(1) failure....

blaubaer01 commented 3 years ago

This is the output by change 5.15 to 5.12: QApplication: invalid style override passed, ignoring it. Available styles: Windows, Fusion PandasGUI WARNING — pandasgui.utility — In df, converted columns to datetime: Messzeitpunkt Received signal 11 SEGV_MAPERR 000000000100

0 0x7fe4ee9cba4f

1 0x7fe4ee9cbe4b

2 0x7fe4ee9cc4ce

3 0x7fe5141db980

4 0x7fe4e1481284

5 0x7fe4e1482518

6 0x7fe4f70ba914 glXCreatePbuffer

7 0x7fe4ecf1be19

8 0x7fe4ecf1c5c3

9 0x7fe4ef29fd09

10 0x7fe4ef29fe6d

11 0x7fe4ed457ab8

12 0x7fe4ed458e1d

13 0x7fe4ef7ef70d

14 0x7fe4f0fbabb3

15 0x7fe4ee9a5745

16 0x7fe4ee9d8a10

17 0x7fe5141d06db start_thread

18 0x7fe513ef971f clone

r8: 0000000000000000 r9: 0000000000000001 r10: 0000000000000001 r11: 0000000000000202 r12: 000055d71e8849d0 r13: 000055d71e8849d0 r14: 0000000000000004 r15: 000055d71e33ef40 di: 000055d71e476360 si: 0000000000000000 bp: 000055d71e476360 bx: 0000000000000000 dx: 0000000000008041 ax: ffffffffffffff50 cx: 0000000000000000 sp: 00007fe49d7f93d0 ip: 00007fe4e1481284 efl: 0000000000010202 cgf: 002b000000000033 erf: 0000000000000004 trp: 000000000000000e msk: 0000000000000000 cr2: 0000000000000100 [end of stack trace] Calling _exit(1). Core file will not be generated.

blaubaer01 commented 3 years ago

I have been changed to debian, but with this distribution I got the same issue. Maybe this could be an hardware problem?

AakeJon49 commented 3 years ago

I had the same issue. Ubuntu 20.04LTS. I tried to uninstall and then reinstalled spyder from 4.1.5 to 3.3.6, and the error message was gone.

jaguardo commented 1 year ago

@gatjaipur looks like I needed a few different "uninstall/install"s from https://stackoverflow.com/questions/51154871/python-3-7-0-no-module-named-pyqt5-qtwebenginewidgets

# install latest python version for your operating system, then
# upgrade pip:
pip install --upgrade pip

# uninstall everything
pip uninstall PyQt5
pip uninstall PyQt5-sip
pip uninstall PyQtWebEngine

# install everything
pip install PyQt5
pip install PyQt5-sip
pip install PyQtWebEngine

I tried quite a bit of everything, until the above worked. I was able to get it to run in a conda environment, running a jupyter notebook:

conda create -n "plots" python=3.9.15 ipython
conda install jupyter
pip install pandasgui
pip uninstall PyQt5
pip uninstall PyQt5-sip
pip uninstall PyQtWebEngine
pip install PyQt5
pip install PyQt5-sip
pip install PyQtWebEngine
jupyter notebook

I tried installing it with conda, but got a similar error, removed it via conda and added it via pip then did the above steps. I'm sure there is a similar way to correct it for conda?

For Future Ref: error messages I saw from jupyter notebook:

ImportError: DLL load failed while importing QtWebEngineWidgets: The specified module could not be found.

and

ImportError: cannot import name 'QtWebEngineWidgets' from 'PyQt5'

when trying to do:

from pandasgui import show
nps798 commented 1 year ago

I encounter the issue today, not quite into the details of all these script. But I here proposed a method at least you can try before you can go in to all the code provided above.

I am using conda on ubuntu . My "spyder" command actually refers to the "base" virtual environment, even i start spyder in a virtual environment. So first step is to make sure in which environment is your problematic spyder. Check with which pip

then, using the following command to check your current installed python package pip list

uninstall all packages related to pyqt, spyder... (there may be some suffix in the word pyqt and spyder) uninstall them all in my case, they are pip uninstall spyder spyder-kernels PyQt5-Qt5 PyQtWebEngine PyQtWebEngine-Qt5 PyQt5-sip

After removal, install spyer by command pip install spyder

Then it should work. This is how I deal with it after searching for 2 hours.

marina513 commented 3 months ago

I downgraded PyQt to 5.12.1 and pip install PyQtWebEngine==5.12.1. It sorta worked on Jupiter but it kills the kernel

I tried it on PyCharm on Linux Mint and it works perfect 👍

Doing this in python3.8 virtual env worked in vs code