From d9eca5e951fef2fd8101aa043c1c245152ce1418 Mon Sep 17 00:00:00 2001 From: jswhit2 Date: Thu, 19 Feb 2026 08:41:10 -0700 Subject: [PATCH] disable parallel support via env var --- Changelog | 1 + _build/utils.py | 4 ++++ setup.py | 12 +++++++++--- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Changelog b/Changelog index a1de04ffa..7ed7b2626 100644 --- a/Changelog +++ b/Changelog @@ -3,6 +3,7 @@ * Change default encoding for stringtochar/chartostring functions from 'utf-8' to 'utf-8'/'ascii' for dtype.kind='U'/'S' (issue #1464). * Fix DeprecationWarning for assigning to numpy.ndarray.shape for numpy >= 2.5.0 (issue #1468). + * Disable parallel support even if libs support it via DISABLE_PARALLEL_SUPPORT env var (issue #1389). version 1.7.4 (tag v1.7.4rel) ================================ diff --git a/_build/utils.py b/_build/utils.py index ce7938144..05f8e1995 100644 --- a/_build/utils.py +++ b/_build/utils.py @@ -113,6 +113,10 @@ def get_netcdf4_include_dir(): def netcdf4_has_parallel_support() -> bool: + # disable parallel support even if libs support it (issue #1389) + DISABLE_PARALLEL_SUPPORT = bool(int(os.environ.get('DISABLE_PARALLEL_SUPPORT', 0))) + if DISABLE_PARALLEL_SUPPORT: + return False netcdf4_incdir = get_netcdf4_include_dir() if os.path.exists(ncmetapath := os.path.join(netcdf4_incdir, "netcdf_meta.h")): with open(ncmetapath) as f: diff --git a/setup.py b/setup.py index 8c10999ea..8b78ff1d1 100644 --- a/setup.py +++ b/setup.py @@ -157,6 +157,8 @@ def extract_version(CYTHON_FNAME): USE_NCCONFIG = bool(int(os.environ.get('USE_NCCONFIG', 0))) # override use of setup.cfg with env var. USE_SETUPCFG = bool(int(os.environ.get('USE_SETUPCFG', 1))) +# disable parallel support even if libs support it (issue #1389) +DISABLE_PARALLEL_SUPPORT = bool(int(os.environ.get('DISABLE_PARALLEL_SUPPORT', 0))) setup_cfg = 'setup.cfg' # contents of setup.cfg will override env vars, unless @@ -412,9 +414,13 @@ def _populate_hdf5_info(dirstosearch, inc_dirs, libs, lib_dirs): (netcdf_lib_version > "4.4" and netcdf_lib_version < "4.5"): has_cdf5_format = True - has_parallel_support = check_has_parallel_support(inc_dirs) - has_has_not = "has" if has_parallel_support else "does not have" - print(f"netcdf lib {has_has_not} parallel functions") + if DISABLE_PARALLEL_SUPPORT: + has_parallel_support = False + print("parallel support disabled via DISABLE_PARALLEL_SUPPORT env var") + else: + has_parallel_support = check_has_parallel_support(inc_dirs) + has_has_not = "has" if has_parallel_support else "does not have" + print(f"netcdf lib {has_has_not} parallel functions") if has_parallel_support: # note(stubbiali): mpi4py is not available when using the in-tree build backend