Skip to content

Commit 05a5ce4

Browse files
committed
Fix setup.py
1 parent 58770aa commit 05a5ce4

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

setup.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -417,17 +417,18 @@ def _populate_hdf5_info(dirstosearch, inc_dirs, libs, lib_dirs):
417417
print(f"netcdf lib {has_has_not} parallel functions")
418418

419419
if has_parallel_support:
420+
# note(stubbiali): mpi4py is not available when using the in-tree build backend
420421
try:
421422
import mpi4py
422423
except ImportError:
423-
msg = "Parallel support requires mpi4py but it is not installed."
424-
raise ImportError(msg)
425-
426-
inc_dirs.append(mpi4py.get_include())
427-
# mpi_incdir should not be needed if using nc-config
428-
# (should be included in nc-config --cflags)
429-
if mpi_incdir is not None:
430-
inc_dirs.append(mpi_incdir)
424+
mpi4py = None
425+
426+
if mpi4py is not None:
427+
inc_dirs.append(mpi4py.get_include())
428+
# mpi_incdir should not be needed if using nc-config
429+
# (should be included in nc-config --cflags)
430+
if mpi_incdir is not None:
431+
inc_dirs.append(mpi_incdir)
431432

432433
# Name of file containing imports required for parallel support
433434
parallel_support_imports = "parallel_support_imports.pxi.in"

0 commit comments

Comments
 (0)