Mslice unable to load gui properly

Hi,

I cannot load Mslice on Ubuntu 16.04 with Mantidnightly installed on it. It cannot load proper gui:

x@x:~/Software/mslice/mslice-master$ ./mslicedevel.sh 
running build
running build_py
running build_scripts
Gtk-Message: Failed to load module "overlay-scrollbar"
Python 2.7.12 (default, Nov 19 2016, 06:48:10) 
Type "copyright", "credits" or "license" for more information.

IPython 2.4.1 -- An enhanced Interactive Python.
 ?         -> Introduction and overview of IPython's features.
 %quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-fe912b074029> in <module>()
----> 1 from mslice.app import show_gui; show_gui()

/Software/mslice/mslice-master/build/lib.linux-x86_64-2.7/mslice/app/__init__.pyc in show_gui()
63     global MAIN_WINDOW
64     if MAIN_WINDOW is None:
---> 65         from mslice.app.mainwindow import MainWindow
 66         MAIN_WINDOW = MainWindow()
 67     MAIN_WINDOW.show()

/Software/mslice/mslice-master/build/lib.linux-x86_64-2.7/mslice/app/mainwindow.py in <module>()
----> 1 from PyQt4.QtGui import QMainWindow
2 
3 from mslice.presenters.main_presenter import MainPresenter
4 from mslice.views.mainview import MainView
5 from .mainwindow_ui import Ui_MainWindow

/usr/lib/python2.7/dist-packages/IPython/external/qt_loaders.pyc in load_module(self, fullname)
45     Importing %s disabled by IPython, which has
46     already imported an Incompatible QT Binding: %s
---> 47     """ % (fullname, loaded_api()))
48 
49 ID = ImportDenier()

ImportError: 
Importing PyQt4 disabled by IPython, which has
already imported an Incompatible QT Binding: pyqtv1

Is there any way I could prevent Ipython (called by Mantidpython?) from importing those bindings at start?

Hi Rafal,

it seems the problem is that there’s a bug in the version of IPython that’s installed by Ubuntu - see this bug report: 1219997 – ipython in pylab qt mode prevents import of PyQt4

It’s also a very old version of IPython, and Ubuntu has only updated it in 17.04 and have not made a back-port to 16.04 (or 16.10). (unlike RedHat)

The easiest way to fix it is either for you to upgrade IPython manually (this was what I had done on my version of Ubuntu due to an unrelated reason… and the main Linux development machine we use runs RedHat 7). You can upgrade by using pip:

sudo apt-get install python-pip
sudo pip install ipython==5.1.0

(You can’t just use pip install ipython because this will try to install IPython 6 which requires Python 3). Then mslicedevel.sh should work.

Is there any way I could prevent Ipython (called by Mantidpython?) from importing those bindings at start?

No, the PyQt4 import is required by the GUI. The only other option is to run mslice without IPython enabled. You can do this by modifying the file build/scripts-2.7/start_mslice.py, changing the last two lines from:

from mslice.app import main
main()

to

from mslice.app import show_gui
from PyQt4.QtGui import QApplication
qapp = QApplication([])
show_gui()
qapp.exec_()

Hope this helps,

Duc.

PS. I’ve filed a bug with Ubuntu ( Bug #1695670 “IPython with --pylab=qt does not alow PyQt4 import...” : Bugs : ipython package : Ubuntu ). Hopefully they will backport the changes in IPython to 16.04 in the near future.

Hi Duc,

thank you for quick response, this made Mslice work!

Cheers,
Rafal