I'm getting this error with QGIS from new OSGeo4W installer, that uses Python 3.9:
Couldn't load plugin 'crayfish' due to an error when calling its classFactory() method
AttributeError: module 'time' has no attribute 'clock'
Traceback (most recent call last):
File "C:/OSGEO4~1/apps/qgis-rel-dev/./python\qgis\utils.py", line 335, in _startPlugin
plugins[packageName] = package.classFactory(iface)
File "C:/Users/PedroVenancio/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\crayfish\__init__.py", line 29, in classFactory
from .plugin import CrayfishPlugin
File "C:/OSGEO4~1/apps/qgis-rel-dev/./python\qgis\utils.py", line 798, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "C:/Users/PedroVenancio/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\crayfish\plugin.py", line 31, in
from .gui.plot_widget import CrayfishPlotWidget
File "C:/OSGEO4~1/apps/qgis-rel-dev/./python\qgis\utils.py", line 798, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "C:/Users/PedroVenancio/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\crayfish\gui\plot_widget.py", line 38, in
import pyqtgraph
File "C:/OSGEO4~1/apps/qgis-rel-dev/./python\qgis\utils.py", line 798, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 664, in _load_unlocked
File "", line 627, in _load_backward_compatible
File "", line 259, in load_module
File "C:\Users\PedroVenancio\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\crayfish\gui\..\pyqtgraph-0.10.0-py2.py3-none-any.whl\pyqtgraph\__init__.py", line 204, in
from .graphicsItems.VTickGroup import *
File "C:/OSGEO4~1/apps/qgis-rel-dev/./python\qgis\utils.py", line 798, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 664, in _load_unlocked
File "", line 627, in _load_backward_compatible
File "", line 259, in load_module
File "C:\Users\PedroVenancio\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\crayfish\gui\..\pyqtgraph-0.10.0-py2.py3-none-any.whl\pyqtgraph\graphicsItems\VTickGroup.py", line 7, in
from .. import functions as fn
File "C:/OSGEO4~1/apps/qgis-rel-dev/./python\qgis\utils.py", line 798, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 664, in _load_unlocked
File "", line 627, in _load_backward_compatible
File "", line 259, in load_module
File "C:\Users\PedroVenancio\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\crayfish\gui\..\pyqtgraph-0.10.0-py2.py3-none-any.whl\pyqtgraph\functions.py", line 17, in
from . import debug
File "C:/OSGEO4~1/apps/qgis-rel-dev/./python\qgis\utils.py", line 798, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 664, in _load_unlocked
File "", line 627, in _load_backward_compatible
File "", line 259, in load_module
File "C:\Users\PedroVenancio\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\crayfish\gui\..\pyqtgraph-0.10.0-py2.py3-none-any.whl\pyqtgraph\debug.py", line 11, in
from . import ptime
File "C:/OSGEO4~1/apps/qgis-rel-dev/./python\qgis\utils.py", line 798, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 664, in _load_unlocked
File "", line 627, in _load_backward_compatible
File "", line 259, in load_module
File "C:\Users\PedroVenancio\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\crayfish\gui\..\pyqtgraph-0.10.0-py2.py3-none-any.whl\pyqtgraph\ptime.py", line 24, in
cstart = systime.clock() ### Required to start the clock in windows
AttributeError: module 'time' has no attribute 'clock'
Python version: 3.9.0 (tags/v3.9.0:9cf6752, Oct 5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)]
QGIS version: 3.18.0-Zürich Zürich, 981c306f
The function time.clock() has been removed, after having been deprecated since Python 3.3: use time.perf_counter() or time.process_time() instead, depending on your requirements, to have well-defined behavior. (Contributed by Matthias Bussonnier in bpo-36895.)
I'm getting this error with QGIS from new OSGeo4W installer, that uses Python 3.9:
From Python 3.8 (https://docs.python.org/3/whatsnew/3.8.html):
The function time.clock() has been removed, after having been deprecated since Python 3.3: use time.perf_counter() or time.process_time() instead, depending on your requirements, to have well-defined behavior. (Contributed by Matthias Bussonnier in bpo-36895.)
So, it needs to be updated.
Thanks!