diff --git a/requirements.txt b/requirements.txt index aecc36d84..0fc8dfe32 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,7 +8,6 @@ enzyme gitpython langdetect Pillow -pip<=9.0.1 py-pretty pycountry pytz diff --git a/update_modules.py b/update_modules.py index ed25717a5..c7a629e60 100644 --- a/update_modules.py +++ b/update_modules.py @@ -1,21 +1,28 @@ -import pip +import subprocess +from subprocess import check_output +import logging +import os +import sys try: - pip.main(['install', '--user', 'gitpython']) -except SystemExit as e: - pass + logging.info('Installing Python modules required for Bazarr...') -try: - pip.main(['install', '--user', 'langdetect']) -except SystemExit as e: - pass + command = sys.executable + ' -m pip --disable-pip-version-check -q -q install -r ' + os.path.join(os.path.dirname(__file__), 'requirements.txt') -try: - pip.main(['install', '--user', 'apprise']) -except SystemExit as e: - pass + if os.name == 'nt': + codepage = check_output("chcp", shell=True, stderr=subprocess.STDOUT) + encoding = codepage.split(':')[-1].strip() -try: - pip.main(['install', '--user', 'tzlocal']) -except SystemExit as e: - pass \ No newline at end of file + process = check_output(command, shell=True, stderr=subprocess.STDOUT) + + if os.name == 'nt': + process = process.decode(encoding) +except: + logging.error('Unable to install requirements using command line PIP. Is PIP installed and included in system path?') + pass +else: + if process == "": + logging.info('Required Python modules installed if missing.') + else: + for line in process.splitlines(): + logging.error(line) \ No newline at end of file