diff --git a/brian2/codegen/runtime/cython_rt/extension_manager.py b/brian2/codegen/runtime/cython_rt/extension_manager.py index b2a56b2d2..e9d0b22b0 100644 --- a/brian2/codegen/runtime/cython_rt/extension_manager.py +++ b/brian2/codegen/runtime/cython_rt/extension_manager.py @@ -21,7 +21,13 @@ import Cython import Cython.Build as Cython_Build import Cython.Compiler as Cython_Compiler - from Cython.Utils import get_cython_cache_dir as base_cython_cache_dir + + try: + from Cython.Utils import get_cython_cache_dir as base_cython_cache_dir + except ImportError: + from Cython.Build.Cache import ( + get_cython_cache_dir as base_cython_cache_dir, # Cython 3.1, see cython/cython#6090 + ) except ImportError: Cython = None