diff --git a/loopy/compiled.py b/loopy/compiled.py
index a29f357b08e4383c1e6ea1b9b79db8330e8498a0..5a522ee0bce01ce6b6c58bdb4025811d601aea73 100644
--- a/loopy/compiled.py
+++ b/loopy/compiled.py
@@ -310,13 +310,18 @@ def generate_value_arg_setup(gen, kernel, cl_kernel, impl_arg_info, options):
     work_around_arg_count_bug = False
     warn_about_arg_count_bug = False
 
-    from pyopencl.characterize import has_struct_arg_count_bug
-
     devices = cl_kernel.context.devices
 
-    count_bug_per_dev = [
-            has_struct_arg_count_bug(dev)
-            for dev in devices]
+    try:
+        from pyopencl.characterize import has_struct_arg_count_bug
+
+    except ImportError:
+        count_bug_per_dev = [False]*len(devices)
+
+    else:
+        count_bug_per_dev = [
+                has_struct_arg_count_bug(dev)
+                for dev in devices]
 
     if any(count_bug_per_dev):
         if all(count_bug_per_dev):