diff --git a/aksetup_helper.py b/aksetup_helper.py
index 73c0e4feea717db170f2d0607bfc961c09d97968..a8ba81183da72f76a5fd7fcdd25c71f540384991 100644
--- a/aksetup_helper.py
+++ b/aksetup_helper.py
@@ -39,7 +39,10 @@ def get_numpy_incpath():
     # importing numpy will fail if numpy was installed by pip because of
     # setup_requires. Doing the following should avoid that
     # http://stackoverflow.com/questions/19919905/how-to-bootstrap-numpy-installation-in-setup-py
-    __builtins__.__NUMPY_SETUP__ = False
+    if isinstance(__builtins__, dict):
+        __builtins__["__NUMPY_SETUP__"] = False
+    else:
+        __builtins__.__NUMPY_SETUP__ = False
     import numpy
     return numpy.get_include()