diff --git a/stripy/spherical.py b/stripy/spherical.py
index <HASH>..<HASH> 100755
--- a/stripy/spherical.py
+++ b/stripy/spherical.py
@@ -404,6 +404,8 @@ class sTriangulation(object):
             if not guarantee_convergence:
                 break
 
+        import warnings
+
         if ierr < 0:
             warnings.warn('ierr={} in gradg\n{}'.format(ierr, _ier_codes[ierr]))
Fix an error that could occur in sTriangulation.gradient_xyz, adding a missing "import warnings".