From 00e7bd819a64c22aeb1372a5f7b5a0585e7c66e9 Mon Sep 17 00:00:00 2001 From: Frederick Roy Date: Wed, 7 Aug 2024 17:22:58 +0900 Subject: [PATCH] check on python3 dependencies (#437) --- bindings/SofaRuntime/package/__init__.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/bindings/SofaRuntime/package/__init__.py b/bindings/SofaRuntime/package/__init__.py index 3ff98119..c8954853 100644 --- a/bindings/SofaRuntime/package/__init__.py +++ b/bindings/SofaRuntime/package/__init__.py @@ -18,6 +18,21 @@ ###################### MODULES INPORTS & UNLOAD FEATURES ###################### ############################################################################### + +try: + import numpy +except ModuleNotFoundError as error: + Sofa.msg_error("SofaRuntime",str(error)) + Sofa.msg_error("SofaRuntime", 'numpy is mandatory for SofaPython3') + sys.exit(1) + +try: + import scipy +except ModuleNotFoundError as error: + Sofa.msg_warning("SofaRuntime",str(error)) + Sofa.msg_warning("SofaRuntime", "scipy is strongly recommended for SofaPython3") + pass + # Keep a list of the modules always imported in the Sofa-PythonEnvironment try: __SofaPythonEnvironment_importedModules__