--- a/scalene/scalene_nvidia_gpu.py
+++ b/scalene/scalene_nvidia_gpu.py
@@ -3,8 +3,6 @@
 import sys
 from typing import Tuple
 
-import pynvml
-
 from scalene.scalene_accelerator import ScaleneAccelerator
 
 
@@ -18,6 +16,7 @@
         self.__pid = os.getpid()
         self.__has_per_pid_accounting = False
         with contextlib.suppress(Exception):
+            import pynvml
             pynvml.nvmlInit()
             # Try to actually get utilization and memory usage.
             # If this fails, we disable GPU profiling.
