diff --git a/model-optimizer/mo/utils/versions_checker.py b/model-optimizer/mo/utils/versions_checker.py index c2dacbb675001c..5b8317f866f9cb 100644 --- a/model-optimizer/mo/utils/versions_checker.py +++ b/model-optimizer/mo/utils/versions_checker.py @@ -187,17 +187,16 @@ def version_check(name, installed_v, required_v, sign, not_satisfied_v, exit_cod return exit_code -def get_environment_variables(): +def get_environment_setup(): """ + Get environment setup such as python version Checks if installed modules versions satisfy required versions in requirements file :return: a dictionary of environment variables """ env_params = dict() - exec("import sys") python_version = "{}.{}.{}".format(sys.version_info.major, sys.version_info.minor, sys.version_info.micro) - exec("del sys") env_params['python_version'] = python_version return env_params @@ -217,6 +216,8 @@ def check_requirements(framework=None): if framework is None: framework_suffix = "" elif framework == "tf": + # TODO: requirements file must be determined based on input model (TF1 or TF2) + # and not by installed TensorFlow version try: exec("import tensorflow") tf_version = sys.modules["tensorflow"].__version__ @@ -233,7 +234,7 @@ def check_requirements(framework=None): file_name = "requirements{}.txt".format(framework_suffix) requirements_file = os.path.realpath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, file_name)) - env_params = get_environment_variables() + env_params = get_environment_setup() requirements_list = get_module_version_list_from_file(requirements_file, env_params) not_satisfied_versions = [] exit_code = 0