diff --git a/pyproject.toml b/pyproject.toml
index c347e4642bec77a20b2b5446a3dbafcab0263688..b8e34812fbed6cf19f3fbf08ff1a28210d4723b8 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -9,10 +9,6 @@ requires = [
 ]
 build-backend = "setuptools.build_meta"
 
-[tool.setuptools_scm]
-# added --abbrev=8 to force consistent length
-git_describe_command = "git describe --dirty --tags --long --match \"*[0-9]*\" --abbrev=8"
-
 [tool.pytest.ini_options]
 testpaths = ["Tests"]
 norecursedirs = ["Tests/Data"]
diff --git a/setup.py b/setup.py
index 33a36c70c668b72ae64f86ddd7201627778cfcb4..b5f045ebb08fab971839c4c1d77611c4986e7ea9 100644
--- a/setup.py
+++ b/setup.py
@@ -35,7 +35,7 @@ if "SETUPTOOLS_SCM_LOCAL_SCHEME" in os.environ:
 
 cmake_args = [f"--preset {cmake_preset}", "-B ."]
 if "SKBUILD_GENERATOR" in os.environ:
-    cmake_args.extend(['-G', os.environ["SKBUILD_GENERATOR"]])
+    cmake_args.extend(["-G", os.environ["SKBUILD_GENERATOR"]])
 
 setup(
     name="ogs",
@@ -58,5 +58,8 @@ setup(
         # This would be in line with PEP 440, switch OGS versioning too?
         "version_scheme": "no-guess-dev",
         "local_scheme": scm_local_scheme,
+        # Was in pyproject.toml but it somehow reset the version scheme. Maybe
+        # it is better to do all scm config here.
+        "git_describe_command": 'git describe --dirty --tags --long --match "*[0-9]*" --abbrev=8',
     },
 )