Search code examples
pythonpyqtpyqt5pyqtgraph

attributeerror module 'time' has no attribute 'clock' (pyqt5)


I understand that time.clock() has been deprecated since Python 3.3. However, the error is occurring when I am trying to import the pyqtgraph module:

import pyqtgraph 

That is the only line in the file, and this is the error:

  File "D:\2020Backup\2020Backup\code\Python\PyQt\graphs\first.py", line 1, in <module>
    import pyqtgraph
  File "C:\Users\mpnlo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyqtgraph\__init__.py", line 204, in <module>
    from .graphicsItems.VTickGroup import *
  File "C:\Users\mpnlo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyqtgraph\graphicsItems\VTickGroup.py", line 7, in <module>
    from .. import functions as fn
  File "C:\Users\mpnlo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyqtgraph\functions.py", line 17, in <module>
    from . import debug
  File "C:\Users\mpnlo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyqtgraph\debug.py", line 11, in <module>
    from . import ptime
  File "C:\Users\mpnlo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyqtgraph\ptime.py", line 24, in <module>
    cstart = systime.clock()  ### Required to start the clock in windows
AttributeError: module 'time' has no attribute 'clock'

I was wondering if anyone knows a workaround for this issue, perhaps a way for me to update the erroneous in the module, I am using the most recent version of pyqtgraph.


Solution

  • So a workaround, if this is happening to you, would be to use, the matplotlib module integrated into pyqt5, this page outlines how to do this:

    https://pythonspot.com/pyqt5-matplotlib/

    I hope this helps!