AOtools / soapy

A Python Adaptive Optics Simulation
GNU General Public License v3.0
84 stars 32 forks source link

Can not open soapy GUI #74

Open ghost opened 7 years ago

ghost commented 7 years ago

Dear Sir,

I am starting to use the soapy library. I have installed the 'master' branch and I can run the 'python testSimulation.py' without problems, but I am having problems to start the GUI. The problem is on this line of the bin/soapy script:

from soapy import gui

I am using ubuntu 16.04 64-bit, but I have tried also the 32-bit version with the same result. It seems there is a problem with the QT library and Ipython, but I have not been able to find a solution.

Here is the traceback:

Traceback (most recent call last):
  File "/usr/local/bin/soapy", line 4, in <module>
    __import__('pkg_resources').run_script('soapy===v0.13.1-2-gd1d68a0', 'soapy')
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 719, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1504, in run_script
    exec(code, namespace, namespace)
  File "/usr/local/lib/python2.7/dist-packages/soapy-v0.13.1_2_gd1d68a0-py2.7.egg/EGG-INFO/scripts/soapy", line 12, in <module>
    from soapy import gui
  File "/usr/local/lib/python2.7/dist-packages/soapy-v0.13.1_2_gd1d68a0-py2.7.egg/soapy/gui.py", line 40, in <module>
    from IPython.qt.console.rich_ipython_widget import RichIPythonWidget
  File "/home/user/.local/lib/python2.7/site-packages/IPython/qt/console/rich_ipython_widget.py", line 8, in <module>
    from IPython.external.qt import QtCore, QtGui
  File "/home/user/.local/lib/python2.7/site-packages/IPython/external/qt.py", line 23, in <module>
    QtCore, QtGui, QtSvg, QT_API = load_qt(api_opts)
  File "/home/user/.local/lib/python2.7/site-packages/IPython/external/qt_loaders.py", line 296, in load_qt
    api_options))
ImportError: 
    Could not load requested Qt binding. Please ensure that
    PyQt4 >= 4.7, PyQt5 or PySide >= 1.0.3 is available,
    and only one is imported per session.

    Currently-imported Qt library:   'pyqtv1'
    PyQt4 installed:                 True
    PyQt5 installed:                 False
    PySide >= 1.0.3 installed:       False
    Tried to load:                   ['pyside', 'pyqt', 'pyqt5']
andrewpaulreeves commented 7 years ago

Hi!

Great to hear your giving Soapy a go - apologies that you've been experiencing problems with the GUI.

I think the issue is due to the confusing nature of Qt when using PyQt4 and Python2. There are couple number of different Qt bindings, and the most used, PyQt4, actually has 2 API versions. When using Python 2, APIv1 is used by default, which the IPython console doesn't like. I think I've fixed this now by explicitly setting the API to v2 - I'm about to emerge this fix into master. Hopefully everything will work ok now, I've found that anaconda python is a bit more reliable than packaged python environments as it is a bit more up to date and repeatable across platforms. I'm also slowly switching my main development to be on Python3, though still targeting 2 as well, so if it fits in with your other Python work, you may find 3 a nicer experience.

andrewpaulreeves commented 7 years ago

HI @user8905 - Just wondering if you've had a chance to test the fix for the GUI from last week? Thanks! Andrew