ejeschke / ginga

The Ginga astronomical FITS file viewer
BSD 3-Clause "New" or "Revised" License
120 stars 77 forks source link

Ginga install required extra installation of PySide6 #1043

Closed bmorris3 closed 6 months ago

bmorris3 commented 1 year ago

I tried pip install ginga today. I'm using py3.10.9 and ginga 4.0.1, on an M1 Mac with OS X 12.6.

The install ran without issues, but running $ ginga yielded:

Traceback (most recent call last):
  File "/Users/bmmorris/miniconda3/envs/research3/lib/python3.10/site-packages/qtpy/__init__.py", line 252, in <module>
    from PySide6 import __version__ as PYSIDE_VERSION  # analysis:ignore
ModuleNotFoundError: No module named 'PySide6'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/bmmorris/miniconda3/envs/research3/bin/ginga", line 8, in <module>
    sys.exit(_main())
  File "/Users/bmmorris/miniconda3/envs/research3/lib/python3.10/site-packages/ginga/rv/main.py", line 746, in _main
    reference_viewer(sys.argv)
  File "/Users/bmmorris/miniconda3/envs/research3/lib/python3.10/site-packages/ginga/rv/main.py", line 741, in reference_viewer
    viewer.main(options, args)
  File "/Users/bmmorris/miniconda3/envs/research3/lib/python3.10/site-packages/ginga/rv/main.py", line 385, in main
    ginga_toolkit.choose()
  File "/Users/bmmorris/miniconda3/envs/research3/lib/python3.10/site-packages/ginga/toolkit.py", line 73, in choose
    from ginga.qtw import QtHelp  # noqa
  File "/Users/bmmorris/miniconda3/envs/research3/lib/python3.10/site-packages/ginga/qtw/QtHelp.py", line 42, in <module>
    from qtpy import QtCore
  File "/Users/bmmorris/miniconda3/envs/research3/lib/python3.10/site-packages/qtpy/__init__.py", line 259, in <module>
    raise QtBindingsNotFoundError()
qtpy.QtBindingsNotFoundError: No Qt bindings could be found

After running pip install PySide6, the issues were resolved and ginga opened successfully.

pllim commented 1 year ago

Huh, you should have Qt by default?

https://github.com/ejeschke/ginga/blob/af1756aa0fb9bda485fee2e1706836382d60547b/setup.cfg#L50

ejeschke commented 1 year ago

It's not set as required in setup.cfg because it is possible to use other back ends, like Gtk. I wonder how matplotlib takes care of choosing which one to install--maybe tries a few imports to see what is available during the install?

ejeschke commented 1 year ago

@pllim, installing qtpy does not force a PyQt or PySide installation.

ejeschke commented 1 year ago

However, most people will want matplotlib installed in order to see the plots, so once that is installed you have one of the back ends available.

pllim commented 1 year ago

Matplotlib has some fancy stuff but I got lost here:

https://github.com/matplotlib/matplotlib/blob/60f01751c0bfb486dec45faf1c494e4c1042f236/lib/matplotlib/rcsetup.py#L244

eas342 commented 8 months ago

I tried pip installing stginga and had a similar issue with qt on an M1 mac Python 3.12.0.

(stginga) % stginga UI toolkit choose error: qt or gtk variants not found (stginga) % ginga UI toolkit choose error: qt or gtk variants not found

conda install PyQt fixed this issue for me

ejeschke commented 6 months ago

Recommend installing by:

pip install ginga[qt5]

or

pip install ginga[qt6]

Closing, we can revisit later if a reasonable solution is found.