diff --git a/src/python_coupling/helper/ModuleInit.cpp b/src/python_coupling/helper/ModuleInit.cpp
index 0058c7a713bbba4db5fc11449dd375c2c26dcb83..e917ff50b24f291f6942c8e009ba8ef866eb3e66 100644
--- a/src/python_coupling/helper/ModuleInit.cpp
+++ b/src/python_coupling/helper/ModuleInit.cpp
@@ -26,7 +26,7 @@
 #include "core/debug/CheckFunctions.h"
 
 // Workaround for OpenMPI library: it dynamically loads plugins which causes trouble when walberla itself is a shared lib
-#if defined(OPEN_MPI) && !defined(_WIN32)
+#if defined(OPEN_MPI) && !defined(_WIN32) && OMPI_MAJOR_VERSION < 3
 #define OPEN_MPI_WORKAROUND
 #include <dlfcn.h>
 #endif