labscript-suite / runviewer

π—Ώπ˜‚π—»π˜ƒπ—Άπ—²π˜„π—²π—Ώ is a graphical interface for visualising hardware-timed experiments composed using the 𝘭𝘒𝘣𝘴𝘀𝘳π˜ͺ𝘱𝘡 𝘴𝘢π˜ͺ𝘡𝘦.
http://labscriptsuite.org
BSD 2-Clause "Simplified" License
2 stars 39 forks source link

No allowed version of pyqtgraph works 100% correctly with runviewer #18

Closed philipstarkey closed 6 years ago

philipstarkey commented 6 years ago

Original report (archived issue) by Philip Starkey (Bitbucket: pstarkey, GitHub: philipstarkey).


It looks like pyqtgraph v0.9.10 is the oldest version that runviewer will support (based on the import check). However this raises a double import denier error (see below).

If I try and use pyqtgraph v0.10.0 (the only other version allowed by the import check), then runviewer loads, but you can't reset the x-axis (time axis). Presumably we don't actually support v0.10.0 yet and the solution is to fix the double import denier issue?

Note: This is done with the current tip version as the latest tagged version also has an issue with the double import denier.

#!python

Traceback (most recent call last):
  File "C:\labscript_suite\labscript_py27\runviewer\__main__.py", line 63, in <module>
    check_version('pyqtgraph', '0.9.10', '1')
  File "C:\labscript_suite\labscript_py27\labscript_utils\__init__.py", line 89, in check_version
    _reraise(exc_info)
  File "C:\labscript_suite\labscript_py27\labscript_utils\__init__.py", line 67, in _reraise
    exec('raise type, value, traceback', globals(), locals())
  File "C:\labscript_suite\labscript_py27\labscript_utils\__init__.py", line 52, in _get_version
    module = __import__(module_name)
  File "C:\labscript_suite\labscript_py27\labscript_utils\double_import_denier.py", line 38, in load_module
    return imp.load_module(name, self.fp, self.pathname, self.description)
  File "C:\Anaconda3\envs\labscript_py27\lib\site-packages\pyqtgraph\__init__.py", line 13, in <module>
    from .Qt import QtGui
  File "C:\labscript_suite\labscript_py27\labscript_utils\double_import_denier.py", line 38, in load_module
    return imp.load_module(name, self.fp, self.pathname, self.description)
  File "C:\Anaconda3\envs\labscript_py27\lib\site-packages\pyqtgraph\Qt.py", line 32, in <module>
    raise Exception("PyQtGraph requires either PyQt4 or PySide; neither package could be imported.")
Exception: PyQtGraph requires either PyQt4 or PySide; neither package could be imported.
philipstarkey commented 6 years ago

Original comment by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington).


Are you sure this has to do with double import denier? All imports go through it, so if you were to get an importerror you would have gotten anyway, double_import_denier would still be in the traceback even though it is not playing any role.

philipstarkey commented 6 years ago

Original comment by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington).


I'm not able to reproduce this problem (on Linux, anyway).

I see that pyqtgraph v0.9.10 doesn't work if you have only PyQt5, since it requires PyQt4, resulting in the exception you posted. And if you have both PyQt4 and PyQt5 it breaks with a different ImportError because qtutils goes for PyQt5 first, and pyqtgraph then imports PyQt4 and you can't import both at once.

philipstarkey commented 6 years ago

Original comment by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington).


Also, I am able to reset the x axis on 0.10.0, both with PyQt4 and PyQt5

philipstarkey commented 6 years ago

Original comment by Philip Starkey (Bitbucket: pstarkey, GitHub: philipstarkey).


Right, sorry. Got confused because I a) forgot this was a new virtualenv that would install pyqt5 by default and b) saw double_import_denier in the traceback (which is ocnfusing but I get why it's there now).

The actual bug is that you can't reset the time axis if there are enough plots to create the scroll bar, and you scroll down so that the tiny plot at the top (which everything is linked to) is hidden. This is something I think I was aware of before. Thought it had been fixed...I guess not (or it's a regression). Anyway, this issue should be closed because the report makes no sense!

philipstarkey commented 6 years ago

Original comment by Philip Starkey (Bitbucket: pstarkey, GitHub: philipstarkey).


I was wrong (see above comment)

philipstarkey commented 6 years ago

Original comment by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington).


In Python 3 double_import_denier hides itself from tracebacks it's not involved in :). But in Python 2 this isn't possible so we get a few extra frames in the traceback unfortunately.