Skip to content

Commit 076dabe

Browse files
committed
Add deep import for numpy to resolve scipy import error
1 parent a95af93 commit 076dabe

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pyomo/common/dependencies.py

+5
Original file line numberDiff line numberDiff line change
@@ -964,6 +964,11 @@ def _finalize_matplotlib(module, available):
964964
def _finalize_numpy(np, available):
965965
if not available:
966966
return
967+
# scipy has a dependence on numpy.testing, and if we don't import it
968+
# as part of resolving numpy, then certain deferred scipy imports
969+
# fail when run under pytest.
970+
import numpy.testing
971+
967972
from . import numeric_types
968973

969974
# Register ndarray as a native type to prevent 1-element ndarrays

0 commit comments

Comments
 (0)