biolab / orange3

🍊 :bar_chart: :bulb: Orange: Interactive data analysis
https://orangedatamining.com
Other
4.85k stars 1.01k forks source link

ValueError: PyCapsule_GetPointer called with incorrect name #5070

Closed liar666 closed 3 years ago

liar666 commented 3 years ago

Hello everybody,

I wanted to give a try to Orange3.

I'm running python 3.8.5 with a venv specific for datascience tools.

I've upgraded all my packages in this venv and installed orange with python3 -m pip install orange3

Everything went OK.

When I try to run Orange with python3 -m Orange.canvas or the orange-canvas script I get:

Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/user/Python/EEGs/lib/python3.8/site-packages/Orange/canvas/__main__.py", line 48, in <module>
    from orangewidget.workflow.errorreporting import handle_exception
  File "/home/user/Python/EEGs/lib/python3.8/site-packages/orangewidget/workflow/errorreporting.py", line 29, in <module>
    from orangewidget.workflow.widgetsscheme import WidgetsScheme
  File "/home/user/Python/EEGs/lib/python3.8/site-packages/orangewidget/workflow/widgetsscheme.py", line 49, in <module>
    from orangewidget.widget import OWBaseWidget
  File "/home/user/Python/EEGs/lib/python3.8/site-packages/orangewidget/widget.py", line 22, in <module>
    from orangewidget.report import Report
  File "/home/user/Python/EEGs/lib/python3.8/site-packages/orangewidget/report/__init__.py", line 4, in <module>
    from .report import *
  File "/home/user/Python/EEGs/lib/python3.8/site-packages/orangewidget/report/report.py", line 13, in <module>
    from orangewidget.io import PngFormat
  File "/home/user/Python/EEGs/lib/python3.8/site-packages/orangewidget/io.py", line 15, in <module>
    from orangewidget.utils.webview import WebviewWidget
  File "/home/user/Python/EEGs/lib/python3.8/site-packages/orangewidget/utils/webview.py", line 30, in <module>
    from AnyQt.QtWebKitWidgets import QWebView
  File "/home/user/Python/EEGs/lib/python3.8/site-packages/AnyQt/QtWebKitWidgets.py", line 14, in <module>
    from PyQt5.QtWebKitWidgets import *
ValueError: PyCapsule_GetPointer called with incorrect name

Try instaling & running latest Orange 3 in a venv with lastest packages for tensorflow, sci/numpy, pandas, scikit*, bokeh, etc (i.e. every tool a DS needs...).

ales-erjavec commented 3 years ago

What version of PyQt5 do you have and how did you install it?

Did you by any chance create the initial venv with --system-site-packages?

liar666 commented 3 years ago

This is apparently indeed a problem with PyQt5. During my packages upgrade, I apparently got 5.15.1 installed.

Now I get:

$ python3 -m pip install orange3
Requirement already satisfied: orange3 in ./lib/python3.8/site-packages (3.27.1)
Requirement already satisfied: scikit-learn!=0.23.0,>=0.22.0 in ./lib/python3.8/site-packages (from orange3) (0.23.2)
Requirement already satisfied: chardet>=3.0.2 in /usr/lib/python3/dist-packages (from orange3) (3.0.4)
Requirement already satisfied: xlrd>=0.9.2 in /home/user/.local/lib/python3.8/site-packages (from orange3) (1.2.0)
Requirement already satisfied: xlsxwriter in ./lib/python3.8/site-packages (from orange3) (1.3.7)
Requirement already satisfied: pyqtgraph>=0.11.0 in ./lib/python3.8/site-packages (from orange3) (0.11.0)
Requirement already satisfied: AnyQt>=0.0.11 in ./lib/python3.8/site-packages (from orange3) (0.0.11)
Requirement already satisfied: requests in /home/user/.local/lib/python3.8/site-packages (from orange3) (2.24.0)
Requirement already satisfied: PyQtWebEngine>=5.12 in ./lib/python3.8/site-packages (from orange3) (5.15.1)
Requirement already satisfied: baycomp>=1.0.2 in ./lib/python3.8/site-packages (from orange3) (1.0.2)
Requirement already satisfied: python-louvain>=0.13 in ./lib/python3.8/site-packages (from orange3) (0.14)
Requirement already satisfied: pyyaml in /usr/lib/python3/dist-packages (from orange3) (5.3.1)
Requirement already satisfied: pip>=9.0 in ./lib/python3.8/site-packages (from orange3) (20.2.4)
Requirement already satisfied: joblib>=0.9.4 in ./lib/python3.8/site-packages (from orange3) (0.17.0)
WARNING: Keyring is skipped due to an exception: Failed to unlock the keyring!
Collecting PyQt5!=5.15.1,>=5.12
  Using cached PyQt5-5.15.0-5.15.0-cp35.cp36.cp37.cp38-abi3-manylinux2014_x86_64.whl (76.6 MB)
Requirement already satisfied: numpy>=1.16.0 in ./lib/python3.8/site-packages (from orange3) (1.19.4)
Requirement already satisfied: bottleneck>=1.0.0 in ./lib/python3.8/site-packages (from orange3) (1.3.2)
Requirement already satisfied: scipy>=0.16.1 in ./lib/python3.8/site-packages (from orange3) (1.5.4)
Requirement already satisfied: openTSNE>=0.4.3 in ./lib/python3.8/site-packages (from orange3) (0.4.4)
Requirement already satisfied: keyrings.alt in ./lib/python3.8/site-packages (from orange3) (4.0.1)
Requirement already satisfied: setuptools>=36.3 in /usr/lib/python3/dist-packages (from orange3) (45.2.0)
Requirement already satisfied: docutils in /usr/lib/python3/dist-packages (from orange3) (0.16)
Collecting httpx~=0.14.0
  Using cached httpx-0.14.3-py3-none-any.whl (62 kB)
Requirement already satisfied: networkx in ./lib/python3.8/site-packages (from orange3) (2.5)
Requirement already satisfied: openpyxl in ./lib/python3.8/site-packages (from orange3) (3.0.5)
Requirement already satisfied: orange-canvas-core<0.2a,>=0.1.18 in ./lib/python3.8/site-packages (from orange3) (0.1.18)
Requirement already satisfied: keyring in ./lib/python3.8/site-packages (from orange3) (21.4.0)
Requirement already satisfied: matplotlib>=2.0.0 in ./lib/python3.8/site-packages (from orange3) (3.3.2)
Requirement already satisfied: orange-widget-base>=4.8.1 in ./lib/python3.8/site-packages (from orange3) (4.9.0)
Requirement already satisfied: serverfiles in ./lib/python3.8/site-packages (from orange3) (0.3.0)
Requirement already satisfied: pandas in ./lib/python3.8/site-packages (from orange3) (1.1.4)
Requirement already satisfied: threadpoolctl>=2.0.0 in ./lib/python3.8/site-packages (from scikit-learn!=0.23.0,>=0.22.0->orange3) (2.1.0)
Requirement already satisfied: idna<3,>=2.5 in /home/user/.local/lib/python3.8/site-packages (from requests->orange3) (2.10)
Requirement already satisfied: certifi>=2017.4.17 in /home/user/.local/lib/python3.8/site-packages (from requests->orange3) (2020.6.20)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in ./lib/python3.8/site-packages (from requests->orange3) (1.25.11)
Requirement already satisfied: PyQt5-sip<13,>=12.8 in ./lib/python3.8/site-packages (from PyQtWebEngine>=5.12->orange3) (12.8.1)
Requirement already satisfied: sniffio in ./lib/python3.8/site-packages (from httpx~=0.14.0->orange3) (1.2.0)
Collecting httpcore==0.10.*
  Using cached httpcore-0.10.2-py3-none-any.whl (48 kB)
Requirement already satisfied: rfc3986[idna2008]<2,>=1.3 in ./lib/python3.8/site-packages (from httpx~=0.14.0->orange3) (1.4.0)
Requirement already satisfied: decorator>=4.3.0 in /usr/lib/python3/dist-packages (from networkx->orange3) (4.4.2)
Requirement already satisfied: et-xmlfile in /usr/lib/python3/dist-packages (from openpyxl->orange3) (1.0.1)
Requirement already satisfied: jdcal in /home/user/.local/lib/python3.8/site-packages (from openpyxl->orange3) (1.4.1)
Requirement already satisfied: dictdiffer in ./lib/python3.8/site-packages (from orange-canvas-core<0.2a,>=0.1.18->orange3) (0.8.1)
Requirement already satisfied: commonmark>=0.8.1 in ./lib/python3.8/site-packages (from orange-canvas-core<0.2a,>=0.1.18->orange3) (0.9.1)
Requirement already satisfied: cachecontrol[filecache] in ./lib/python3.8/site-packages (from orange-canvas-core<0.2a,>=0.1.18->orange3) (0.12.6)
Requirement already satisfied: jeepney>=0.4.2; sys_platform == "linux" in /home/user/.local/lib/python3.8/site-packages (from keyring->orange3) (0.4.3)
Requirement already satisfied: SecretStorage>=3; sys_platform == "linux" in /home/user/.local/lib/python3.8/site-packages (from keyring->orange3) (3.1.2)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3 in /home/user/.local/lib/python3.8/site-packages (from matplotlib>=2.0.0->orange3) (2.4.7)
Requirement already satisfied: cycler>=0.10 in /usr/lib/python3/dist-packages (from matplotlib>=2.0.0->orange3) (0.10.0)
Requirement already satisfied: python-dateutil>=2.1 in /home/user/.local/lib/python3.8/site-packages (from matplotlib>=2.0.0->orange3) (2.8.1)
Requirement already satisfied: kiwisolver>=1.0.1 in ./lib/python3.8/site-packages (from matplotlib>=2.0.0->orange3) (1.3.1)
Requirement already satisfied: pillow>=6.2.0 in ./lib/python3.8/site-packages (from matplotlib>=2.0.0->orange3) (8.0.1)
Requirement already satisfied: pytz>=2017.2 in ./lib/python3.8/site-packages (from pandas->orange3) (2020.4)
Collecting h11<0.10,>=0.8
  Using cached h11-0.9.0-py2.py3-none-any.whl (53 kB)
Requirement already satisfied: msgpack>=0.5.2 in /home/user/.local/lib/python3.8/site-packages (from cachecontrol[filecache]->orange-canvas-core<0.2a,>=0.1.18->orange3) (1.0.0)
Requirement already satisfied: lockfile>=0.9; extra == "filecache" in /usr/lib/python3/dist-packages (from cachecontrol[filecache]->orange-canvas-core<0.2a,>=0.1.18->orange3) (0.12.2)
Requirement already satisfied: cryptography in ./lib/python3.8/site-packages (from SecretStorage>=3; sys_platform == "linux"->keyring->orange3) (3.2.1)
Requirement already satisfied: six>=1.5 in /home/user/.local/lib/python3.8/site-packages (from python-dateutil>=2.1->matplotlib>=2.0.0->orange3) (1.15.0)
Requirement already satisfied: cffi!=1.11.3,>=1.8 in ./lib/python3.8/site-packages (from cryptography->SecretStorage>=3; sys_platform == "linux"->keyring->orange3) (1.14.3)
Requirement already satisfied: pycparser in /home/user/.local/lib/python3.8/site-packages (from cffi!=1.11.3,>=1.8->cryptography->SecretStorage>=3; sys_platform == "linux"->keyring->orange3) (2.20)
Installing collected packages: PyQt5, h11, httpcore, httpx
  Attempting uninstall: PyQt5
    Found existing installation: PyQt5 5.15.1
    Uninstalling PyQt5-5.15.1:
      Successfully uninstalled PyQt5-5.15.1
  Attempting uninstall: h11
    Found existing installation: h11 0.11.0
    Uninstalling h11-0.11.0:
      Successfully uninstalled h11-0.11.0
  Attempting uninstall: httpcore
    Found existing installation: httpcore 0.12.1
    Uninstalling httpcore-0.12.1:
      Successfully uninstalled httpcore-0.12.1
  Attempting uninstall: httpx
    Found existing installation: httpx 0.16.1
    Uninstalling httpx-0.16.1:
      Successfully uninstalled httpx-0.16.1
ERROR: After October 2020 you may experience errors when installing or updating packages. This is because pip will change the way that it resolves dependency conflicts.

We recommend you use --use-feature=2020-resolver to test your packages with the new resolver before it becomes the default.

spyder 4.1.5 requires jedi==0.17.1, but you'll have jedi 0.17.2 which is incompatible.
spyder 4.1.5 requires parso==0.7.0, but you'll have parso 0.8.0 which is incompatible.
spyder 4.1.5 requires pyqt5<5.13; python_version >= "3", but you'll have pyqt5 5.15.0 which is incompatible.
spyder 4.1.5 requires pyqtwebengine<5.13; python_version >= "3", but you'll have pyqtwebengine 5.15.1 which is incompatible.
Successfully installed PyQt5-5.15.0 h11-0.9.0 httpcore-0.10.2 httpx-0.14.3

So installation is marked successful (but it is not as I still get the PyCapsule_GetPointer error...)

There's apparently a conflict between i-don't-know-which-package that requires 5.15.1, orange that requires everything but 5.15.1 and Γ¨spyder4that requires<5.13`

OMFG, this Python way of managing versions is REALLY annoying... it always ends up breaking my installs... Before I used venv, it broke the whole system (because python is used by many important linux scripts) and now it breaks my venv... It's really annoying that everything gets broken I soon as one installs a new package or upgrades the existing ones :{ I NEVER had any problem of the sort with R or Java or whatever-language-you-want... Sorry, this is not your fault, but I'm really fed up wasting my time with Python how come this has become the de-facto language for DS when it is so broken(-by-design)?!?!?

liar666 commented 3 years ago

Correction, in fact no, PyQt5 5.15.0 is installed...

$ pip3 list | grep -i pyqt
PyQt5                         5.15.0
PyQt5-sip                     12.8.1
pyqtgraph                     0.11.0
PyQtWebEngine                 5.15.1
ales-erjavec commented 3 years ago

From the output you seem to have created the env with --system-site-packages (some packages such as chardet, and cycler are picked up from the system install). Most probably the error is because you also have PyQt5 installed in the system python. The error is raised from import of QtWebKit. This module is not present in the PyQt5 binary wheel packages installed from from pip but is (or at least can be) present in system pyqt5 install.

Can you test this by creating an new venv without system site packages

python3 -m venv ~/Python/env-without-sys/
source ~/Python/env-without-sys/bin/activate
pip install PyQt5
python -c "import PyQt5.QtWebKit"

and one with

python3 -m venv --system-site-packages ~/Python/env-with-sys/
source ~/Python/env-with-sys/bin/activate
pip install PyQt5
python -c "import PyQt5.QtWebKit"

In any case it is recommended that you install orange into a separate venv (without system site packages) for orange alone.

kaizen89 commented 3 years ago

I downgraded PyQt5 and no more issue pip install PyQt5==5.10.1

liar666 commented 3 years ago

Hi,

Sorry I have a very bad internet connexion, so it took me time to be able to make the tests recommended by @ales-erjavec.

The results are the following:

$ python3 -m venv env-without-sys/
$ source env-without-sys/bin/activate
(env-without-sys) $ pip install PyQt5
/usr/bin/python2: No module named pip
(env-without-sys) $ pip3 install PyQt5
Collecting PyQt5
  Using cached PyQt5-5.15.1-5.15.1-cp35.cp36.cp37.cp38.cp39-abi3-manylinux2014_x86_64.whl (71.6 MB)
Collecting PyQt5-sip<13,>=12.8
  Downloading PyQt5_sip-12.8.1-cp38-cp38-manylinux1_x86_64.whl (293 kB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 293 kB 67 kB/s 
Installing collected packages: PyQt5-sip, PyQt5
Successfully installed PyQt5-5.15.1 PyQt5-sip-12.8.1
(env-without-sys) $ python -c "import PyQt5.QtWebKit"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'PyQt5.QtWebKit'
$ python3 -m venv --system-site-packages env-with-sys/
$ source env-with-sys/bin/activate
(env-with-sys) $ pip install PyQt5
/usr/bin/python2: No module named pip
(env-with-sys) $ pip3 install PyQt5
Requirement already satisfied: PyQt5 in /home/user/.local/lib/python3.8/site-packages (5.15.0)
Requirement already satisfied: PyQt5-sip<13,>=12.8 in /home/user/.local/lib/python3.8/site-packages (from PyQt5) (12.8.0)
(env-with-sys) $ python -c "import PyQt5.QtWebKit"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.15' not found (required by /home/user/.local/lib/python3.8/site-packages/PyQt5/QtCore.abi3.so)

So indeed venv created with --system-site-packages uses system-wide PyQt5. However, both seem to fail for different reasons.

So you're right that might have been the problem. Unfortunately, I don't remember having done such a specific initialization of my venv, and don't see why I would have wanted to do so...

Whatever, I ended up creating a specific venv for Orange, but I don't like that very much as it 1) doubles the space used by many packages that are common between Orange and my venv for DataScience.... And I don't have that much free space. 2) It required downloading again many packages whereas I'm on a very bad internet connexion :{

Whatever, thanks for your help, I'm now able to try Orange now :)

horvatm commented 3 years ago

Hi.

On which linux systems was Orange3 tested, just to get a sense what to do. Namely on Ubuntu 20.04.2 LTS I created a fresh user and installed Orange3 locally

   pip3 install orange3 --user

After running

  orange-canvas

I get

    from PyQt5.QtWebKitWidgets import *
ValueError: PyCapsule_GetPointer called with incorrect name.

Here is the full log: Traceback (most recent call last): File "/home/ouser/.local/bin/orange-canvas", line 5, in from Orange.canvas.main import main File "/home/ouser/.local/lib/python3.8/site-packages/Orange/canvas/main.py", line 49, in from orangewidget.workflow.errorreporting import handle_exception File "/home/ouser/.local/lib/python3.8/site-packages/orangewidget/workflow/errorreporting.py", line 29, in from orangewidget.workflow.widgetsscheme import WidgetsScheme File "/home/ouser/.local/lib/python3.8/site-packages/orangewidget/workflow/widgetsscheme.py", line 52, in from orangewidget.widget import OWBaseWidget, Input File "/home/ouser/.local/lib/python3.8/site-packages/orangewidget/widget.py", line 22, in from orangewidget.report import Report File "/home/ouser/.local/lib/python3.8/site-packages/orangewidget/report/init.py", line 4, in from .report import File "/home/ouser/.local/lib/python3.8/site-packages/orangewidget/report/report.py", line 14, in from orangewidget.io import PngFormat File "/home/ouser/.local/lib/python3.8/site-packages/orangewidget/io.py", line 15, in from orangewidget.utils.webview import WebviewWidget File "/home/ouser/.local/lib/python3.8/site-packages/orangewidget/utils/webview.py", line 30, in from AnyQt.QtWebKitWidgets import QWebView File "/home/ouser/.local/lib/python3.8/site-packages/AnyQt/QtWebKitWidgets.py", line 14, in from PyQt5.QtWebKitWidgets import ValueError: PyCapsule_GetPointer called with incorrect name

pisarik commented 3 years ago

Hi @horvatm,

I know some users on Windows who also experienced the same problem after they tried to update some add-on or Orange3 itself.

It seems this happens due to incompatible versions of pyqt5 packages. Make sure that pyqt5 packages have compatible versions. Try to reinstall or update them. In my environment I have the following versions:

pyqt                      5.9.2            py38h05f1152_4  
pyqt5                     5.15.4                   pypi_0    pypi
pyqt5-qt5                 5.15.2                   pypi_0    pypi
pyqt5-sip                 12.9.0                   pypi_0    pypi
pyqtgraph                 0.12.1                   pypi_0    pypi

Now, If I install pyqt5==5.9.2, then I get PyCapsule_GetPointer error, so perhaps you need to run:

pip3 install -U pyqt5
horvatm commented 3 years ago

Thank for the help @pisarik . I really appreciate it. I must say that the upgrade

pip3 install -U pyqt5 --user

did not help. Now I have

pip3 list  | grep Qt
AnyQt                        0.0.13
PyQt5                        5.15.4
PyQt5-Qt5                    5.15.2
PyQt5-sip                    12.9.0
PyQtWebEngine                5.15.4
PyQtWebEngine-Qt5            5.15.2
QtAwesome                    0.4.4
QtPy                         1.9.0

I will just switch to Windows or Mac for this job using orange3.

ales-erjavec commented 3 years ago

Install orange in a separate virtual environment (without --system-site-packages).

If you do install using --user make sure that no PyQt5 packages are installed there. Install them using your system package manager.

markotoplak commented 3 years ago

@horvatm, here is how I just tried installing Orange3 on Ubuntu 20.04. I used virtualenv to prevent conflicts with the system installed packages. Here are the command:

virtualenv -p python38 orangetest
source orangetest/bin/activate
pip install orange3

Whenever you will need to start Orange, you will need to activate the virtual environment. Like this:

source orangetest/bin/activate
orange-canvas
pisarik commented 3 years ago

Actually, I figured it out. At least in our case when windows users tried to update orange that comes with anaconda.

It seems that during update Orange tries to install pyqt5 from pip, then it starts to conflict with the one that installed with conda. This worked for me:

  1. Uninstall all pyqt5 packages that are installed through pip

    pip freeze
    pip uninstall pyqt5 pyqt5-sip pyqtgraph
  2. Install necessary packages in conda (I am not conda user, so I don't know whether you can have problems due to different channels, but it worked):

    conda install -c anaconda pyqt
    conda install -c conda-forge pyqt5-sip
    conda install pyqtgraph
markotoplak commented 3 years ago

@pisarik, how did that user try to update? What exactly did they do? Did they try to install a add-on that prompted the update or did they do something else?

If there is update with pip into a conda environment all hell can break loose.

pisarik commented 3 years ago

@markotoplak :smile: Anaconda -> Orange -> Add-ons -> Tick Orange3 3.26.0 < 3.29.3 -> Install -> Restart Orange -> PyCapsule error This happened to 2-3 people in our group.

Another strange thing that happens with Orange that distributed with Anaconda is that sometimes the button "Launch Orange" doesn't work. But everything works if I open Anaconda Prompt and write there orange-canvas, so as a workaround I usually create a .bat runner. This thing is done for 3-5 people in our group:) All of them in common have NMBU laptop, win 10, without admin rights. So they cannot install apps from .exe files, but they can install anaconda through app catalog and then add-ons installation works except upgrading Orange that causes PyCapsule error.