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

Question:

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:2020Backup2020BackupcodePythonPyQtgraphsfirst.py", line 1, in <module>
    import pyqtgraph
  File "C:UsersmpnloAppDataLocalProgramsPythonPython38-32libsite-packagespyqtgraph__init__.py", line 204, in <module>
    from .graphicsItems.VTickGroup import *
  File "C:UsersmpnloAppDataLocalProgramsPythonPython38-32libsite-packagespyqtgraphgraphicsItemsVTickGroup.py", line 7, in <module>
    from .. import functions as fn
  File "C:UsersmpnloAppDataLocalProgramsPythonPython38-32libsite-packagespyqtgraphfunctions.py", line 17, in <module>
    from . import debug
  File "C:UsersmpnloAppDataLocalProgramsPythonPython38-32libsite-packagespyqtgraphdebug.py", line 11, in <module>
    from . import ptime
  File "C:UsersmpnloAppDataLocalProgramsPythonPython38-32libsite-packagespyqtgraphptime.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.

Asked By: Micheal Nestor

||

Answers:

Compile the latest pyqtgraph with pip3 install --upgrade git+http://github.com/pyqtgraph/pyqtgraph.git

Answered By: misantroop

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!

Answered By: Micheal Nestor
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.