diff --git a/extmod/moduheapq.c b/extmod/moduheapq.c
index 8112b552559d6474738041d096f27caf359afb25..5c5ed06a1fec2a9a224ede4a0b09418262c0a93c 100644
--- a/extmod/moduheapq.c
+++ b/extmod/moduheapq.c
@@ -24,8 +24,6 @@
  * THE SOFTWARE.
  */
 
-#include <unistd.h>
-
 #include "py/nlr.h"
 #include "py/objlist.h"
 #include "py/runtime0.h"
diff --git a/extmod/modujson.c b/extmod/modujson.c
index b5384bbc4e09111780a5eb524db5613f052fcfbd..747a86ac6a8ff55f306da7d516dff181668ddd07 100644
--- a/extmod/modujson.c
+++ b/extmod/modujson.c
@@ -25,8 +25,6 @@
  */
 
 #include <stdio.h>
-#include <unistd.h>
-#include <string.h>
 
 #include "py/nlr.h"
 #include "py/objlist.h"
diff --git a/extmod/moduzlib.c b/extmod/moduzlib.c
index 8b72d14ac42133d37585bd3bb79de752553c4002..31544059e8eda5f88e77a4e9fef5dce6f258c5af 100644
--- a/extmod/moduzlib.c
+++ b/extmod/moduzlib.c
@@ -25,11 +25,6 @@
  */
 
 #include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <time.h>
-#include <sys/time.h>
-#include <math.h>
 
 #include "py/nlr.h"
 #include "py/runtime.h"
diff --git a/py/compile.c b/py/compile.c
index d95d8f73bc4004b400aeb26669dac16404038742..6c54ddeb83ec8a2a77f09ec17cff32bb72eec125 100644
--- a/py/compile.c
+++ b/py/compile.c
@@ -29,7 +29,6 @@
 #include <stdio.h>
 #include <string.h>
 #include <assert.h>
-#include <math.h>
 
 #include "py/scope.h"
 #include "py/emit.h"
diff --git a/py/objfloat.c b/py/objfloat.c
index 2e8b7f74e9cd215a14c07817003239ffd0026f8f..b94caf3c06a542e666dd6437527041e919705552 100644
--- a/py/objfloat.c
+++ b/py/objfloat.c
@@ -28,7 +28,6 @@
 #include <stdio.h>
 #include <string.h>
 #include <assert.h>
-#include <math.h>
 
 #include "py/nlr.h"
 #include "py/parsenum.h"
@@ -37,6 +36,8 @@
 
 #if MICROPY_PY_BUILTINS_FLOAT
 
+#include <math.h>
+
 #if MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_FLOAT
 #include "py/formatfloat.h"
 #endif