diff --git a/standalone/CMakeLists.txt b/standalone/CMakeLists.txt
index 8b380f70a77286e2b799ad7ad0e34d2a6d86fab0..8963be33c93d0b3b350bf24d66c406162d6d43c8 100644
--- a/standalone/CMakeLists.txt
+++ b/standalone/CMakeLists.txt
@@ -54,20 +54,20 @@ if (CODEGEN_PRIVATE_VENV)
 			message( WARNING "Could not find ${CODEGEN_VENV_REQUIREMENTS}" )
 		endif()
 
-		# get the find pystencils-sfg file
-		execute_process( 
-			COMMAND ${PystencilsSfg_PYTHON_INTERPRETER} -m pystencilssfg cmake make-find-module
-			WORKING_DIRECTORY ${CMAKE_FIND_PACKAGE_REDIRECTS_DIR}
-		)
-		# renaming it
-		file(RENAME ${CMAKE_FIND_PACKAGE_REDIRECTS_DIR}/FindPystencilsSfg.cmake ${CMAKE_FIND_PACKAGE_REDIRECTS_DIR}/pystencilssfg-config.cmake)
-
-                # Find it
-                find_package( PystencilsSfg REQUIRED )
-
 		set( _sfg_private_venv_done TRUE CACHE BOOL "" )
 		mark_as_advanced(_sfg_private_venv_done)
 	endif()
 	set(_sfg_cache_python_init ${_venv_python_exe})
 	set(PystencilsSfg_PYTHON_INTERPRETER ${_sfg_cache_python_init} CACHE PATH "Path to the Python executable used to run pystencils-sfg")
 endif()
+
+# get the find pystencils-sfg file
+execute_process( 
+	COMMAND ${PystencilsSfg_PYTHON_INTERPRETER} -m pystencilssfg cmake make-find-module
+	WORKING_DIRECTORY ${CMAKE_FIND_PACKAGE_REDIRECTS_DIR}
+)
+# renaming it
+file(RENAME ${CMAKE_FIND_PACKAGE_REDIRECTS_DIR}/FindPystencilsSfg.cmake ${CMAKE_FIND_PACKAGE_REDIRECTS_DIR}/pystencilssfg-config.cmake)
+
+# Find it
+find_package( PystencilsSfg REQUIRED )