naojsoft / qplan

Other
2 stars 4 forks source link

error at launch with pyqt5 #4

Closed monodera closed 5 years ago

monodera commented 7 years ago

I got the following error at launch with PyQt5. I'm using newly installed macOS 10.12.2 and Python environment is AstroConda with Python 3. Thanks!

Traceback (most recent call last):
  File "/Users/monodera/anaconda3/envs/astroconda/lib/python3.5/site-packages/qtpy/__init__.py", line 119, in <module>
    from PySide import __version__ as PYSIDE_VERSION  # analysis:ignore
ImportError: No module named 'PySide'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/monodera/anaconda3/envs/astroconda/bin/qplan", line 4, in <module>
    __import__('pkg_resources').run_script('qplan==2.6.1', 'qplan')
  File "/Users/monodera/anaconda3/envs/astroconda/lib/python3.5/site-packages/setuptools-27.2.0-py3.5.egg/pkg_resources/__init__.py", line 744, in run_script
  File "/Users/monodera/anaconda3/envs/astroconda/lib/python3.5/site-packages/setuptools-27.2.0-py3.5.egg/pkg_resources/__init__.py", line 1499, in run_script
  File "/Users/monodera/anaconda3/envs/astroconda/lib/python3.5/site-packages/qplan-2.6.1-py3.5.egg/EGG-INFO/scripts/qplan", line 45, in <module>
    viewer.main(options, args)
  File "/Users/monodera/anaconda3/envs/astroconda/lib/python3.5/site-packages/qplan-2.6.1-py3.5.egg/qplan/main.py", line 153, in main
    from qplan.View import Viewer
  File "/Users/monodera/anaconda3/envs/astroconda/lib/python3.5/site-packages/qplan-2.6.1-py3.5.egg/qplan/View.py", line 6, in <module>
    from ginga.gw import GwHelp, GwMain, Widgets, Desktop
  File "/Users/monodera/anaconda3/envs/astroconda/lib/python3.5/site-packages/ginga/gw/GwHelp.py", line 8, in <module>
    from ginga.qtw.QtHelp import *
  File "/Users/monodera/anaconda3/envs/astroconda/lib/python3.5/site-packages/ginga/qtw/QtHelp.py", line 33, in <module>
    from qtpy import QtCore
  File "/Users/monodera/anaconda3/envs/astroconda/lib/python3.5/site-packages/qtpy/__init__.py", line 125, in <module>
    raise PythonQtError('No Qt bindings could be found')
qtpy.PythonQtError: No Qt bindings could be found
ejeschke commented 7 years ago

@monodera, could you do a

conda list | grep -i qt

and let us know the result? Thanks.

ejeschke commented 7 years ago

And try starting qplan with -t qt5...

monodera commented 7 years ago

@ejeschke

$ conda list | grep -i qt
pyqt                      5.6.0                    py35_1
pyqtgraph                 0.9.11              np111py35_1    http://ssb.stsci.edu/astroconda
qt                        5.6.2                         0
qtconsole                 4.2.1                    py35_1
qtpy                      1.1.2                    py35_0

WIth -t qt5, it worked! I thought that it trys to somehow detect the version of PyQt automatically.

Anyway, thanks!

ejeschke commented 7 years ago

Hmm, it should detect it automatically. I won't close this issue yet. I'll try to reproduce it.

monodera commented 7 years ago

Apparently, just setting the default toolkit from qt4 to qt5 in qplan/main.py fixes the issue as the automatic detection procedure starts from qt5. But I have not tested whether this change cases a problem with other toolkits.

ejeschke commented 7 years ago

Could you try setting it to just "qt" and see what happens?

monodera commented 7 years ago

I got the same error as the original post.

$ qplan --loglevel=20 --stderr -i /Users/monodera/Dropbox/subaru-support-queue-shared/HSC-16Bsim -c /Users/monodera/Dropbox/subaru-support-queue-shared/HSC-16Bsim/executed_obs.txt
2016-12-30 11:43:27,782 | I | main.py:144 (main) | starting qplan 0.4.20161130232512
Traceback (most recent call last):
  File "/Users/monodera/anaconda3/envs/astroconda/lib/python3.5/site-packages/qtpy/__init__.py", line 119, in <module>
    from PySide import __version__ as PYSIDE_VERSION  # analysis:ignore
ImportError: No module named 'PySide'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/monodera/anaconda3/envs/astroconda/bin/qplan", line 4, in <module>
    __import__('pkg_resources').run_script('qplan==2.6.1', 'qplan')
  File "/Users/monodera/anaconda3/envs/astroconda/lib/python3.5/site-packages/setuptools-27.2.0-py3.5.egg/pkg_resources/__init__.py", line 744, in run_script
  File "/Users/monodera/anaconda3/envs/astroconda/lib/python3.5/site-packages/setuptools-27.2.0-py3.5.egg/pkg_resources/__init__.py", line 1499, in run_script
  File "/Users/monodera/anaconda3/envs/astroconda/lib/python3.5/site-packages/qplan-2.6.1-py3.5.egg/EGG-INFO/scripts/qplan", line 45, in <module>
    viewer.main(options, args)
  File "/Users/monodera/anaconda3/envs/astroconda/lib/python3.5/site-packages/qplan-2.6.1-py3.5.egg/qplan/main.py", line 153, in main
    from qplan.View import Viewer
  File "/Users/monodera/anaconda3/envs/astroconda/lib/python3.5/site-packages/qplan-2.6.1-py3.5.egg/qplan/View.py", line 6, in <module>
    from ginga.gw import GwHelp, GwMain, Widgets, Desktop
  File "/Users/monodera/anaconda3/envs/astroconda/lib/python3.5/site-packages/ginga/gw/GwHelp.py", line 8, in <module>
    from ginga.qtw.QtHelp import *
  File "/Users/monodera/anaconda3/envs/astroconda/lib/python3.5/site-packages/ginga/qtw/QtHelp.py", line 33, in <module>
    from qtpy import QtCore
  File "/Users/monodera/anaconda3/envs/astroconda/lib/python3.5/site-packages/qtpy/__init__.py", line 125, in <module>
    raise PythonQtError('No Qt bindings could be found')
qtpy.PythonQtError: No Qt bindings could be found
ejeschke commented 7 years ago

@monodera, could you confirm that if you launch without adding the "-t" parameter that it launches successfully? Looking at the logic for the toolkit choice, it looks like if you specify "qt" it assumes qt4, whereas if you specify no toolkit, it will determine one for you.

monodera commented 7 years ago

The current source code is the following in main.py.

$ grep -n -C 3 "\-\-toolkit"  /Users/monodera/anaconda3/envs/astroconda/lib/python3.5/site-packages/qplan-2.6.1-py3.5.egg/qplan/main.py
130-        optprs.add_option("-s", "--site", dest="sitename", metavar="NAME",
131-                          default='subaru',
132-                          help="Observing site NAME")
133:        optprs.add_option("-t", "--toolkit", dest="toolkit", metavar="NAME",
134-                          default='qt4',
135-                          help="Prefer GUI toolkit (gtk|qt)")
136-        log.addlogopts(optprs)

Then launching qplan with and without -t option gives error in either case.

$ qplan --loglevel=20 --stderr -i /Users/monodera/Dropbox/subaru-support-queue-shared/HSC-16Bsim -c /Users/monodera/Dropbox/subaru-support-queue-shared/HSC-16Bsim/executed_obs.txt -t qt
2017-01-05 11:53:28,012 | I | main.py:144 (main) | starting qplan 0.4.20161130232512
Traceback (most recent call last):
  File "/Users/monodera/anaconda3/envs/astroconda/lib/python3.5/site-packages/qtpy/__init__.py", line 119, in <module>
    from PySide import __version__ as PYSIDE_VERSION  # analysis:ignore
ImportError: No module named 'PySide'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/monodera/anaconda3/envs/astroconda/bin/qplan", line 4, in <module>
    __import__('pkg_resources').run_script('qplan==2.6.1', 'qplan')
  File "/Users/monodera/anaconda3/envs/astroconda/lib/python3.5/site-packages/setuptools-27.2.0-py3.5.egg/pkg_resources/__init__.py", line 744, in run_script
  File "/Users/monodera/anaconda3/envs/astroconda/lib/python3.5/site-packages/setuptools-27.2.0-py3.5.egg/pkg_resources/__init__.py", line 1499, in run_script
  File "/Users/monodera/anaconda3/envs/astroconda/lib/python3.5/site-packages/qplan-2.6.1-py3.5.egg/EGG-INFO/scripts/qplan", line 45, in <module>
    viewer.main(options, args)
  File "/Users/monodera/anaconda3/envs/astroconda/lib/python3.5/site-packages/qplan-2.6.1-py3.5.egg/qplan/main.py", line 153, in main
    from qplan.View import Viewer
  File "/Users/monodera/anaconda3/envs/astroconda/lib/python3.5/site-packages/qplan-2.6.1-py3.5.egg/qplan/View.py", line 6, in <module>
    from ginga.gw import GwHelp, GwMain, Widgets, Desktop
  File "/Users/monodera/anaconda3/envs/astroconda/lib/python3.5/site-packages/ginga/gw/GwHelp.py", line 8, in <module>
    from ginga.qtw.QtHelp import *
  File "/Users/monodera/anaconda3/envs/astroconda/lib/python3.5/site-packages/ginga/qtw/QtHelp.py", line 33, in <module>
    from qtpy import QtCore
  File "/Users/monodera/anaconda3/envs/astroconda/lib/python3.5/site-packages/qtpy/__init__.py", line 125, in <module>
    raise PythonQtError('No Qt bindings could be found')
qtpy.PythonQtError: No Qt bindings could be found
$ qplan --loglevel=20 --stderr -i /Users/monodera/Dropbox/subaru-support-queue-shared/HSC-16Bsim -c /Users/monodera/Dropbox/subaru-support-queue-shared/HSC-16Bsim/executed_obs.txt
2017-01-05 11:54:06,308 | I | main.py:144 (main) | starting qplan 0.4.20161130232512
Traceback (most recent call last):
  File "/Users/monodera/anaconda3/envs/astroconda/lib/python3.5/site-packages/qtpy/__init__.py", line 119, in <module>
    from PySide import __version__ as PYSIDE_VERSION  # analysis:ignore
ImportError: No module named 'PySide'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/monodera/anaconda3/envs/astroconda/bin/qplan", line 4, in <module>
    __import__('pkg_resources').run_script('qplan==2.6.1', 'qplan')
  File "/Users/monodera/anaconda3/envs/astroconda/lib/python3.5/site-packages/setuptools-27.2.0-py3.5.egg/pkg_resources/__init__.py", line 744, in run_script
  File "/Users/monodera/anaconda3/envs/astroconda/lib/python3.5/site-packages/setuptools-27.2.0-py3.5.egg/pkg_resources/__init__.py", line 1499, in run_script
  File "/Users/monodera/anaconda3/envs/astroconda/lib/python3.5/site-packages/qplan-2.6.1-py3.5.egg/EGG-INFO/scripts/qplan", line 45, in <module>
    viewer.main(options, args)
  File "/Users/monodera/anaconda3/envs/astroconda/lib/python3.5/site-packages/qplan-2.6.1-py3.5.egg/qplan/main.py", line 153, in main
    from qplan.View import Viewer
  File "/Users/monodera/anaconda3/envs/astroconda/lib/python3.5/site-packages/qplan-2.6.1-py3.5.egg/qplan/View.py", line 6, in <module>
    from ginga.gw import GwHelp, GwMain, Widgets, Desktop
  File "/Users/monodera/anaconda3/envs/astroconda/lib/python3.5/site-packages/ginga/gw/GwHelp.py", line 8, in <module>
    from ginga.qtw.QtHelp import *
  File "/Users/monodera/anaconda3/envs/astroconda/lib/python3.5/site-packages/ginga/qtw/QtHelp.py", line 33, in <module>
    from qtpy import QtCore
  File "/Users/monodera/anaconda3/envs/astroconda/lib/python3.5/site-packages/qtpy/__init__.py", line 125, in <module>
    raise PythonQtError('No Qt bindings could be found')
qtpy.PythonQtError: No Qt bindings could be found

I can launch only when specifying -t qt5.

$ qplan --loglevel=20 --stderr -i /Users/monodera/Dropbox/subaru-support-queue-shared/HSC-16Bsim -c /Users/monodera/Dropbox/subaru-support-queue-shared/HSC-16Bsim/executed_obs.txt -t qt5                                                                                                          2017-01-05 11:54:40,751 | I | main.py:144 (main) | starting qplan 0.4.20161130232512
2017-01-05 11:54:45,334 | I | ModuleManager.py:53 (loadModule) | Loading module 'SlewChart'...
2017-01-05 11:54:45,525 | I | ModuleManager.py:53 (loadModule) | Loading module 'AirMassChart'...
2017-01-05 11:54:45,528 | I | ModuleManager.py:53 (loadModule) | Loading module 'Schedule'...
2017-01-05 11:54:45,535 | I | ModuleManager.py:53 (loadModule) | Loading module 'Report'...
2017-01-05 11:54:45,542 | I | ModuleManager.py:53 (loadModule) | Loading module 'Logger'...
2017-01-05 11:54:45,543 | I | ModuleManager.py:53 (loadModule) | Loading module 'ControlPanel'...
2017-01-05 11:54:45,552 | I | ModuleManager.py:53 (loadModule) | Loading module 'SumChart'...
2017-01-05 11:54:45,554 | I | ModuleManager.py:44 (loadModule) | Reloading module 'SumChart'...
2017-01-05 11:54:45,555 | I | ModuleManager.py:44 (loadModule) | Reloading module 'SumChart'...
2017-01-05 11:54:45,556 | I | ModuleManager.py:44 (loadModule) | Reloading module 'SumChart'...
ejeschke commented 7 years ago

Ah, I see. At least the main problem here is that the default is specified as 'qt4'.

ejeschke commented 7 years ago

I've committed something of a fix. If you upgrade to at least commit aaaa1ec280077612b2c6d71c1ede72646f885c87, and leave off the "-t" parameter, qplan will successfully autodetect your widget set. NOTE: you will also need to update to the latest ginga.

It would be good if one could specify "qt" and it would autodetect which version of Qt (for example). This probably isn't too hard but should be fixed in Ginga, which provides the toolkit wrapping. At least with this fix one does not get an error with the default options when starting up.

ejeschke commented 5 years ago

I think we can close this.