Open sot-iris opened 7 years ago
I'm having the same issue on two different operating systems.
I hope I find time to investigate in this issue this week. At first glance as a reminder for my self: https://stackoverflow.com/questions/10888045/simple-ipython-example-raises-exception-on-sys-exit may be related.
Having the same issue.
Hi all, sorry for taking a while to reply. My guess is that Jupyter Notebook is doing something in the background that varies depending on the environment/config files and precise set up. One possibility is that you are not using the qt backend which is activated in Jupyter Notebook by the line %matplotlib qt.
Try running this as the first command in a cell of its own at the very beginning of the Jupyter Notebook as running this together with everything else can sometimes be problematic for some reason. Alternatively you can change the Jupyter config to use this by default so you don't have to type it every time.
[1] %matplotlib qt
[2] import samuroi
import numpy
data = numpy.random.normal(size=(100,100,30))
morphology = numpy.random.normal(size = (100,100))
app = samuroi.SamuROIWindow(data = data,morphology=morphology)
app.show()
If this doesn't solve the problem there is also this possible workaround:
I managed to reproduce the problem outside of Jupyter Notebook and fixed it using the following code, which is hopefully just a temporary solution while I look into this further:
import samuroi
import numpy
from PyQt4 import QtGui
data = numpy.random.normal(size=(100,100,30))
morphology = numpy.random.normal(size = (100,100))
QtGui.QApplication(sys.argv)
app = samuroi.SamuROIWindow(data = data,morphology=morphology)
app.show()
This should fix the problem for python and ipython running outside of the Jupyter Notebook framework. This may also fix the problem in Jupyter Notebooks that aren't working, but I have not tested this. If not please let me know and I will look into a better fix.
Hi, I was able to run the test code listed in the documentation with the dummy numpy data on my windows VM, using a separate conda env with the samuroi dependencies. I was able to do this once. I did this using jupyter notebook. Any more run attempts brings about the error "QWidget: Must construct a QApplication before a QPaintDevice". Any advice would be appreciated. many thanks Sotiris