Skip to content

Commit 615c01f

Browse files
committed
set has_parallel_support to False when mpi4py is not available
1 parent cd5e5fc commit 615c01f

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

setup.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
from setuptools.dist import Distribution
88
from typing import List
99

10+
try:
11+
import mpi4py
12+
except ImportError:
13+
has_mpi4py = False
14+
15+
1016
open_kwargs = {'encoding': 'utf-8'}
1117

1218

@@ -47,6 +53,8 @@ def check_ifnetcdf4(netcdf4_includedir):
4753

4854
def check_has_parallel_support(inc_dirs: list) -> bool:
4955
has_parallel_support = False
56+
if not has_mpi4py:
57+
return has_parallel_support
5058

5159
for d in inc_dirs:
5260
ncmetapath = os.path.join(d,'netcdf_meta.h')
@@ -397,7 +405,6 @@ def _populate_hdf5_info(dirstosearch, inc_dirs, libs, lib_dirs):
397405
print(f"netcdf lib {has_has_not} parallel functions")
398406

399407
if has_parallel_support:
400-
import mpi4py
401408
inc_dirs.append(mpi4py.get_include())
402409
# mpi_incdir should not be needed if using nc-config
403410
# (should be included in nc-config --cflags)

0 commit comments

Comments
 (0)