diff --git a/CMakeLists.txt b/CMakeLists.txt
index bf740e74d1a29d6e822e44698388d2984e7c7fb9..79537a4d7d5fc840434a92ec4961d2353cbfec9f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,6 +18,8 @@ include(DuneMacros)
 set(DUNE_PYTHON_INSTALL_EDITABLE 1)
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDUNE_ISTL_SUPPORT_OLD_CATEGORY_INTERFACE=1")
 
+dune_python_force_version(3)
+
 # start a dune project with information from dune.module
 dune_project()
 
diff --git a/python/setup.py b/python/setup.py
index d847cb90064e734efe22ea0646129fa8bb86be35..713ffbab9d5761f775764a67c2807a017a817da4 100644
--- a/python/setup.py
+++ b/python/setup.py
@@ -29,6 +29,7 @@ setup(name='dune.codegen',
       description='Performance optimizing form compiler for the Dune project',
       author='Dominic Kempf <dominic.kempf@iwr.uni-heidelberg.de>',
       url='https://gitlab.dune-project.org/dominic/dune-codegen.git',
+      python_requires='>=3',
       packages=['dune.codegen',
                 'dune.codegen.blockstructured',
                 'dune.codegen.cgen',