From 269c640dbce3089e06835d550df5d699d8bc929c Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Tue, 8 Oct 2024 23:33:01 +0200 Subject: [PATCH] got rid of conda --- lollms/media.py | 2 +- lollms/services/stt/whisper/lollms_whisper.py | 7 +-- lollms/utilities.py | 57 ------------------- 3 files changed, 3 insertions(+), 63 deletions(-) diff --git a/lollms/media.py b/lollms/media.py index 6ffc9b9..38fc54d 100644 --- a/lollms/media.py +++ b/lollms/media.py @@ -8,7 +8,7 @@ License: Apache 2.0 """ from lollms.utilities import PackageManager from lollms.com import LoLLMsCom -from lollms.utilities import trace_exception, run_async, install_conda_package +from lollms.utilities import trace_exception, run_async from lollms.types import MSG_OPERATION_TYPE, SENDER_TYPES from lollms.client_session import Session from ascii_colors import ASCIIColors diff --git a/lollms/services/stt/whisper/lollms_whisper.py b/lollms/services/stt/whisper/lollms_whisper.py index 91d3931..3bade02 100644 --- a/lollms/services/stt/whisper/lollms_whisper.py +++ b/lollms/services/stt/whisper/lollms_whisper.py @@ -5,9 +5,6 @@ from pathlib import Path from lollms.app import LollmsApplication -from lollms.paths import LollmsPaths -from lollms.config import TypedConfig, ConfigTemplate, BaseConfig -from lollms.utilities import PackageManager, install_conda_package from lollms.stt import LollmsSTT from dataclasses import dataclass from PIL import Image, PngImagePlugin @@ -22,13 +19,13 @@ try: if not pm.is_installed("openai-whisper"): pm.install("openai-whisper") try: - install_conda_package("conda-forge::ffmpeg") + pass#install_conda_package("conda-forge::ffmpeg") except Exception as ex: trace_exception(ex) ASCIIColors.red("Couldn't install ffmpeg") except: try: - install_conda_package("conda-forge::ffmpeg") + pass#install_conda_package("conda-forge::ffmpeg") except Exception as ex: trace_exception(ex) ASCIIColors.red("Couldn't install ffmpeg") diff --git a/lollms/utilities.py b/lollms/utilities.py index 01bf201..f8860cc 100644 --- a/lollms/utilities.py +++ b/lollms/utilities.py @@ -40,63 +40,6 @@ import subprocess from functools import partial -def install_conda_utility(): - import platform - if platform.system()=="Windows": - conda_path = Path(sys.executable).parent.parent/"miniconda3"/"condabin"/"conda" - else: - conda_path = Path(sys.executable).parent.parent.parent/"miniconda3"/"bin"/"conda" - ASCIIColors.red("Conda path:") - ASCIIColors.yellow(conda_path) - process = subprocess.Popen(f'{conda_path} install conda -y', shell=True) - - # Wait for the process to finish - process.wait() - #from conda.cli.python_api import run_command, Commands - # Create a new Conda environment with the specified Python version - #run_command(Commands.CREATE, "-n", env_name, f"python={python_version}") - -def install_conda_package(package_name): - try: - import platform - if platform.system()=="Windows": - conda_path = Path(sys.executable).parent.parent/"miniconda3"/"condabin"/"conda" - else: - conda_path = Path(sys.executable).parent.parent.parent/"miniconda3"/"bin"/"conda" - ASCIIColors.red("Conda path:") - ASCIIColors.yellow(conda_path) - process = subprocess.Popen(f'{conda_path} install {package_name} -y', shell=True) - - # Wait for the process to finish - process.wait() - #from conda.cli.python_api import run_command, Commands - # Create a new Conda environment with the specified Python version - #run_command(Commands.CREATE, "-n", env_name, f"python={python_version}") - return True - except Exception as ex: - trace_exception(ex) - return False - -def create_conda_env(env_name, python_version): - from lollms.security import sanitize_shell_code - env_name = sanitize_shell_code(env_name) - python_version = sanitize_shell_code(python_version) - # Activate the Conda environment - import platform - if platform.system()=="Windows": - conda_path = Path(sys.executable).parent.parent/"miniconda3"/"condabin"/"conda" - else: - conda_path = Path(sys.executable).parent.parent.parent/"miniconda3"/"bin"/"conda" - ASCIIColors.red("Conda path: ",flush=True, end="") - ASCIIColors.yellow(conda_path) - process = subprocess.Popen(f'{conda_path} create --name {env_name} python={python_version} -y', shell=True) - - # Wait for the process to finish - process.wait() - #from conda.cli.python_api import run_command, Commands - # Create a new Conda environment with the specified Python version - #run_command(Commands.CREATE, "-n", env_name, f"python={python_version}") - def run_pip_in_env(env_name, pip_args, cwd=None): import platform # Set the current working directory if provided, otherwise use the current directory