()
| 61 | |
| 62 | |
| 63 | def install_backend(): |
| 64 | if not os.path.exists(BACKEND_DIR): |
| 65 | print("Installing the WebUI backend..") |
| 66 | |
| 67 | # create the conda env |
| 68 | run([conda, "create", "-y", "--prefix", SYSTEM_DIR], cwd=ROOT_DIR) |
| 69 | |
| 70 | print("Installing packages..") |
| 71 | |
| 72 | # install python 3.10 and git in the conda env |
| 73 | run([conda, "install", "-y", "--prefix", SYSTEM_DIR, "-c", "conda-forge", "python=3.10", "git"], cwd=ROOT_DIR) |
| 74 | |
| 75 | if not os.path.exists(WEBUI_DIR): |
| 76 | env = dict(os.environ) |
| 77 | env.update(get_env()) |
| 78 | |
| 79 | # print info |
| 80 | run_in_conda(["git", "--version"], cwd=ROOT_DIR, env=env) |
| 81 | run_in_conda(["python", "--version"], cwd=ROOT_DIR, env=env) |
| 82 | |
| 83 | # clone webui |
| 84 | run_in_conda(["git", "clone", WEBUI_REPO, WEBUI_DIR], cwd=ROOT_DIR, env=env) |
| 85 | |
| 86 | # install the appropriate version of torch using torchruntime |
| 87 | run_in_conda(["python", "-m", "pip", "install", "torchruntime"], cwd=WEBUI_DIR, env=env) |
| 88 | run_in_conda(["python", "-m", "torchruntime", "install", "torch", "torchvision"], cwd=WEBUI_DIR, env=env) |
| 89 | |
| 90 | |
| 91 | def start_backend(): |
no test coverage detected