diff --git a/bin/setup-dunepy.py b/bin/setup-dunepy.py
index 767b3d5a64b7c0537526bc0625c8745a39eff77a..4a5de840227222dd853723dff1fd3d166fdc00d8 100755
--- a/bin/setup-dunepy.py
+++ b/bin/setup-dunepy.py
@@ -98,6 +98,18 @@ def main(argv):
         deps = resolve_order(deps)
         deps += [masterModule]
 
+    if execute == "install":
+        for m in deps:
+            moddir = duneModules[1][m]
+            pythonModule = toBuildDir(builddir,moddir,m)
+            print("calling install_python for %s (%s)" % (m,pythonModule))
+            try:
+                command = ['cmake', '--build', '.', '--target', 'install_python']
+                proc = subprocess.Popen(command, cwd=pythonModule, stdout = subprocess.PIPE)
+                stdout, stderr = proc.communicate()
+                logger.debug(buffer_to_str(stdout))
+            except FileNotFoundError:
+                print("Warning: build dir not found possibly module is installed then python bindings should be already available")
 
     dunepy = get_dune_py_dir()
     dunepyBase = os.path.realpath( os.path.join(dunepy,"..") )
@@ -113,18 +125,5 @@ def main(argv):
     print("CMake output")
     print(output)
 
-    if execute == "install":
-        for m in deps:
-            moddir = duneModules[1][m]
-            pythonModule = toBuildDir(builddir,moddir,m)
-            print("calling install_python for %s (%s)" % (m,pythonModule))
-            try:
-                command = ['cmake', '--build', '.', '--target', 'install_python']
-                proc = subprocess.Popen(command, cwd=pythonModule, stdout = subprocess.PIPE)
-                stdout, stderr = proc.communicate()
-                logger.debug(buffer_to_str(stdout))
-            except FileNotFoundError:
-                print("Warning: build dir not found possibly module is installed then python bindings should be already available")
-
 if __name__ == "__main__":
     main(sys.argv[1:])