From 7a0151ac0bcceb22f729a870ad2e98d40ecfba35 Mon Sep 17 00:00:00 2001 From: martinb-bb <105685594+martinb-bb@users.noreply.github.com> Date: Fri, 24 Feb 2023 16:23:02 -0500 Subject: [PATCH] split imports --- .../forecast/forecast_controller.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/openbb_terminal/forecast/forecast_controller.py b/openbb_terminal/forecast/forecast_controller.py index 4e70c68fffa..52dab20f617 100644 --- a/openbb_terminal/forecast/forecast_controller.py +++ b/openbb_terminal/forecast/forecast_controller.py @@ -28,8 +28,7 @@ except ModuleNotFoundError: try: import whisper - from transformers import pipeline - import yt_dlp + import transformers from whisper.tokenizer import LANGUAGES, TO_LANGUAGE_CODE from openbb_terminal.forecast.whisper_utils import str2bool @@ -38,11 +37,23 @@ try: except ModuleNotFoundError: raise ModuleNotFoundError( - "Please install whisper model. Instructions can be found here: \n" + "Please use poetry to install latest whisper model and dependencies. \n" + "poetry install -E forecast \n" + "\n" + "If you are not using poetry, please install whisper model. Instructions can be found here: \n" "https://github.com/openai/whisper \n" "Please install the transformers library with the following command: \n" "pip install transformers \n" - "Please install the yt_dlp library with the following command: \n" + ) + +try: + import yt_dlp +except ModuleNotFoundError: + raise ModuleNotFoundError( + "Please use poetry to install latest yt-dlp library and dependencies. \n" + "poetry install -E forecast \n" + "\n" + "If you are not using poetry, please install the yt_dlp library with the following command: \n" "pip install yt_dlp \n" )