diff --git a/utils/raspberrypi/ctt/ctt_tools.py b/utils/raspberrypi/ctt/ctt_tools.py
index 48e0aac2..41c4efb6 100644
--- a/utils/raspberrypi/ctt/ctt_tools.py
+++ b/utils/raspberrypi/ctt/ctt_tools.py
@@ -14,7 +14,12 @@ import imutils
 import sys
 import matplotlib.pyplot as plt
 from sklearn import cluster as cluster
-from sklearn.neighbors.nearest_centroid import NearestCentroid as get_centroids
+try:
+    # From sklearn version 0.22 onwards, NearestCentroid is no longer in the
+    # nearest_centroid module
+    from sklearn.neighbors.nearest_centroid import NearestCentroid as get_centroids
+except (ModuleNotFoundError):
+    from sklearn.neighbors import NearestCentroid as get_centroids
 
 """
 This file contains some useful tools, the details of which aren't important to
