Check for uvicorn and set the PATH env variable before checking

This commit is contained in:
cmdr2 2022-10-10 21:04:23 +05:30
parent 199fa4a0f5
commit 9aa46f92dc

View File

@ -1,5 +1,6 @@
import os import os
import shutil import shutil
import platform
from installer import app, helpers from installer import app, helpers
@ -28,7 +29,11 @@ Downloading packages necessary for Stable Diffusion UI..
''') ''')
def is_valid_env(): def is_valid_env():
if shutil.which("uvicorn") is None: path = os.environ['PATH']
path += os.path.join(app.project_env_dir_path, 'Scripts' if platform.system() == 'Windows' else 'bin')
if shutil.which("uvicorn", path=path) is None:
helpers.log("uvicorn not found!")
return False return False
return helpers.modules_exist_in_env(('uvicorn', 'fastapi')) return helpers.modules_exist_in_env(('uvicorn', 'fastapi'))