Skip to content

Commit 00e7bd8

Browse files
authored
check on python3 dependencies (#437)
1 parent 4238417 commit 00e7bd8

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

bindings/SofaRuntime/package/__init__.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,21 @@
1818
###################### MODULES INPORTS & UNLOAD FEATURES ######################
1919
###############################################################################
2020

21+
22+
try:
23+
import numpy
24+
except ModuleNotFoundError as error:
25+
Sofa.msg_error("SofaRuntime",str(error))
26+
Sofa.msg_error("SofaRuntime", 'numpy is mandatory for SofaPython3')
27+
sys.exit(1)
28+
29+
try:
30+
import scipy
31+
except ModuleNotFoundError as error:
32+
Sofa.msg_warning("SofaRuntime",str(error))
33+
Sofa.msg_warning("SofaRuntime", "scipy is strongly recommended for SofaPython3")
34+
pass
35+
2136
# Keep a list of the modules always imported in the Sofa-PythonEnvironment
2237
try:
2338
__SofaPythonEnvironment_importedModules__

0 commit comments

Comments
 (0)