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

Orange wheel requires Qt #6952

Closed
janezd opened this issue Dec 10, 2024 · 0 comments · Fixed by biolab/orange-canvas-core#320 or #6955
Closed

Orange wheel requires Qt #6952

janezd opened this issue Dec 10, 2024 · 0 comments · Fixed by biolab/orange-canvas-core#320 or #6955
Labels
bug A bug confirmed by the core team

Comments

@janezd
Copy link
Contributor

janezd commented Dec 10, 2024

What's wrong?

I created a new environment with Orange, without Qt, because I only needed a headless Orange (use case: Orada). Importing orange results in the following error.

/Users/janez/miniforge3/envs/orada/bin/python /Users/janez/dev/orada/backend/app.py 
Traceback (most recent call last):
  File "/Users/janez/dev/orada/backend/dataset.py", line 11, in <module>
    import Orange
  File "/Users/janez/miniforge3/envs/orada/lib/python3.12/site-packages/Orange/__init__.py", line 4, in <module>
    from Orange import data
  File "/Users/janez/miniforge3/envs/orada/lib/python3.12/site-packages/Orange/data/__init__.py", line 4, in <module>
    from .variable import *
  File "/Users/janez/miniforge3/envs/orada/lib/python3.12/site-packages/Orange/data/variable.py", line 1, in <module>
    from orangecanvas.utils.localization.si import plsi, plsi_sz, z_besedo
  File "/Users/janez/miniforge3/envs/orada/lib/python3.12/site-packages/orangecanvas/utils/__init__.py", line 12, in <module>
    from AnyQt.QtCore import Qt
  File "/Users/janez/miniforge3/envs/orada/lib/python3.12/site-packages/AnyQt/QtCore.py", line 1, in <module>
    from . import _api
  File "/Users/janez/miniforge3/envs/orada/lib/python3.12/site-packages/AnyQt/_api.py", line 116, in <module>
    raise ImportError("PyQt4, PyQt5, PySide or PySide2 are not available for import")
ImportError: PyQt4, PyQt5, PySide or PySide2 are not available for import

Process finished with exit code 1

This happens because pip instal orange3 runs Orange through trubar, which translates it. Translated orange imports from orangecanvas.utils.localization.si, which executes orangecanvas/utils/__init__.py, which in turn imports Qt. Since orangecanvas depends on Qt (though not through requirements, to allow using different versions of Qt), it has every right to import it.

I am reporting the problem here, though the first solution that comes to mind is to move localization module from orangecanvas.utils.localization to orangecanvas.localization to avoid importing Qt. Note after discussion with @markotoplak: the old location must still work (e.g. import * from the new location) otherwise we'd also have to re-release all add-ons.

This will affect anybody who wants to run headless Orange. This "anybody" probably doesn't mean "manybody", hence no need to rush into 3.38.1.

How can we reproduce the problem?

Create an environment, install Orange, import it.

What's your environment?

  • Operating system: macOS
  • Orange version: 3.38
  • How you installed Orange: pip
@janezd janezd added bug report Bug is reported by user, not yet confirmed by the core team bug A bug confirmed by the core team and removed bug report Bug is reported by user, not yet confirmed by the core team labels Dec 10, 2024
@janezd janezd self-assigned this Dec 13, 2024
@janezd janezd removed their assignment Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug confirmed by the core team
Projects
None yet
1 participant