From 348304587cb323068d71de35635495f1ed95a063 Mon Sep 17 00:00:00 2001 From: Christopher Teubert Date: Mon, 29 Jul 2024 17:25:57 -0700 Subject: [PATCH] Checks --- src/progpy/data_models/lstm_model.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/progpy/data_models/lstm_model.py b/src/progpy/data_models/lstm_model.py index 4e27de4..f02205d 100644 --- a/src/progpy/data_models/lstm_model.py +++ b/src/progpy/data_models/lstm_model.py @@ -2,6 +2,7 @@ # National Aeronautics and Space Administration. All Rights Reserved. from collections import abc +import importlib.util from itertools import chain import matplotlib.pyplot as plt from numbers import Number @@ -535,7 +536,10 @@ def from_data(cls, inputs, outputs, event_states=None, t_met=None, **kwargs): params['normalization'] = (z_mean, z_std) # Tensorflow is imported here to avoid importing it if not needed - from tensorflow import keras + try: + from tensorflow import keras + except ImportError as e: + raise ImportError("Missing required dependencies for data-driven model. ProgPy was imported directly. Instead import with datadriven dependencies using pip3 install progpy[datadriven] or pip3 install -e '.[datadriven]' (if installing from local copy)") # Build model callbacks = [ ]