AttributeError module 'time' has no attribute 'clock'
Using PyQtGraph with Python 3.8

Heads up! You've already completed this tutorial.

PyQtGraph is a library for creating plots in PyQt applications. Recent changes in Python 3.8 can cause problems if you're using older versions of PyQtGraph.

I got an error when running your plotting script above at line from pyqtgraph import PlotWidget, plot, which gave the error Exception has occurred: AttributeError module 'time' has no attribute 'clock'

The clock member was removed from the time module in Python 3.8. In your own code this can be replaced with either time.perf_counter() or time.process_time() instead, depending on your requirements. For libraries such as PyQtGraph you'll need to wait for them to be updated.

This was fixed in PyQtGraph v0.11.0rc0 and is available via PyPi.

In future, if you need to access the latest versions of PyQtGraph before release, you can also install the current master from Github directly.

python
pip install git+https://github.com/pyqtgraph/pyqtgraph.git

Alternatively, you can downgrade to Python 3.7 in the meantime.

Over 10,000 developers have bought Create GUI Applications with Python & Qt!
Create GUI Applications with Python & Qt6
Take a look

Downloadable ebook (PDF, ePub) & Complete Source code

Also available from Payhip , Gumroad , Leanpub and Amazon Paperback

[[ discount.discount_pc ]]% OFF for the next [[ discount.duration ]] [[discount.description ]] with the code [[ discount.coupon_code ]]

Purchasing Power Parity

Developers in [[ country ]] get [[ discount.discount_pc ]]% OFF on all books & courses with code [[ discount.coupon_code ]]
Well done, you've finished this tutorial! Mark As Complete
[[ user.completed.length ]] completed [[ user.streak+1 ]] day streak

AttributeError module 'time' has no attribute 'clock' was written by Martin Fitzpatrick .

Martin Fitzpatrick has been developing Python/Qt apps for 8 years. Building desktop applications to make data-analysis tools more user-friendly, Python was the obvious choice. Starting with Tk, later moving to wxWidgets and finally adopting PyQt.