Skip to content

Commit ab90ac4

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

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

setup.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ def check_ifnetcdf4(netcdf4_includedir):
4747

4848
def check_has_parallel_support(inc_dirs: list) -> bool:
4949
has_parallel_support = False
50+
try:
51+
import mpi4py
52+
except ImportError:
53+
return has_parallel_support
5054

5155
for d in inc_dirs:
5256
ncmetapath = os.path.join(d,'netcdf_meta.h')
@@ -397,7 +401,6 @@ def _populate_hdf5_info(dirstosearch, inc_dirs, libs, lib_dirs):
397401
print(f"netcdf lib {has_has_not} parallel functions")
398402

399403
if has_parallel_support:
400-
import mpi4py
401404
inc_dirs.append(mpi4py.get_include())
402405
# mpi_incdir should not be needed if using nc-config
403406
# (should be included in nc-config --cflags)

0 commit comments

Comments
 (0)