From a482a71291df07b742973ca5198b54615faa9b6b Mon Sep 17 00:00:00 2001 From: Florian Esser Date: Mon, 25 Nov 2024 14:43:34 +0100 Subject: [PATCH] build offline comfy UI release let installer be completely offline. Signed-off-by: Florian Esser --- WebUI/build/installer.nsh.template | 22 ---------------------- WebUI/build/scripts/pack-offline.js | 23 ++++++++++++++++++++++- service/requirements-arc.txt | 7 +++++++ 3 files changed, 29 insertions(+), 23 deletions(-) diff --git a/WebUI/build/installer.nsh.template b/WebUI/build/installer.nsh.template index 2f4ab0bd..fd889726 100644 --- a/WebUI/build/installer.nsh.template +++ b/WebUI/build/installer.nsh.template @@ -13,29 +13,7 @@ DetailPrint "Downloading and setting up python environment..." ; Display a popup message with OK/Cancel options - MessageBox MB_ICONQUESTION|MB_OKCANCEL "Before installing Python dependencies, please ensure you have a stable internet connection. This could take several minutes. Click OK to proceed or Cancel to abort installation." - ; Check the return value from MessageBox - StrCmp $R0 IDCANCEL cancel - Goto continue - - cancel: - Abort ; Abort the installation if Cancel is clicked - - continue: - nsExec::ExecToLog '"$INSTDIR\resources\env\python.exe" "$INSTDIR\resources\env\get-pip.py" "--no-warn-script-location"' - nsExec::ExecToLog '"$INSTDIR\resources\env\python.exe" "-m" "pip" "install" "$INSTDIR\resources\arc-ipex-wheels\bigdl_core_xe_23-2.6.0.dev0-cp311-cp311-win_amd64.whl"' - nsExec::ExecToLog '"$INSTDIR\resources\env\python.exe" "-m" "pip" "install" "$INSTDIR\resources\arc-ipex-wheels\bigdl_core_xe_addons_23-2.6.0.dev0-cp311-cp311-win_amd64.whl"' - nsExec::ExecToLog '"$INSTDIR\resources\env\python.exe" "-m" "pip" "install" "$INSTDIR\resources\arc-ipex-wheels\bigdl_core_xe_batch_23-2.6.0.dev0-cp311-cp311-win_amd64.whl"' - nsExec::ExecToLog '"$INSTDIR\resources\env\python.exe" "-m" "pip" "install" "$INSTDIR\resources\arc-ipex-wheels\intel_extension_for_pytorch-2.3.110+xpu-cp311-cp311-win_amd64.whl"' - nsExec::ExecToLog '"$INSTDIR\resources\env\python.exe" "-m" "pip" "install" "$INSTDIR\resources\arc-ipex-wheels\torch-2.3.1+cxx11.abi-cp311-cp311-win_amd64.whl"' - nsExec::ExecToLog '"$INSTDIR\resources\env\python.exe" "-m" "pip" "install" "$INSTDIR\resources\arc-ipex-wheels\torchaudio-2.3.1+cxx11.abi-cp311-cp311-win_amd64.whl"' - nsExec::ExecToLog '"$INSTDIR\resources\env\python.exe" "-m" "pip" "install" "$INSTDIR\resources\arc-ipex-wheels\torchvision-0.18.1+cxx11.abi-cp311-cp311-win_amd64.whl"' - - nsExec::ExecToLog '"$INSTDIR\resources\env\python.exe" "-m" "pip" "install" "-r" "$INSTDIR\resources\service\requirements-${PLATFORM}.txt" "--no-warn-script-location"' - nsExec::ExecToLog '"$INSTDIR\resources\env\python.exe" "-m" "pip" "install" "-r" "$INSTDIR\resources\service\requirements.txt" "--no-warn-script-location"' - nsExec::ExecToLog '"$INSTDIR\resources\env\python.exe" "-m" "pip" "install" "-r" "$INSTDIR\resources\ComfyUI\requirements.txt" "--no-warn-script-location"' - nsExec::ExecToLog '"$INSTDIR\resources\env\python.exe" "-m" "pip" "install" "-r" "$INSTDIR\resources\ComfyUI\custom_nodes\ComfyUI-GGUF\requirements.txt" "--no-warn-script-location"' end: DetailPrint "Installation completed." !macroend diff --git a/WebUI/build/scripts/pack-offline.js b/WebUI/build/scripts/pack-offline.js index 14e29f1c..e2c4e6a9 100644 --- a/WebUI/build/scripts/pack-offline.js +++ b/WebUI/build/scripts/pack-offline.js @@ -46,6 +46,22 @@ function unzippedPackagedPyenv(pyenvArchive) { return offlineEnvDir } +function installPip(getPipFilePath, workingDir) { + const runGetPip = spawn(pythonExe, [getPipFilePath], { cwd: workingDir }); + runGetPip.stdout.on('data', (data) => { + console.log(data.toString()); + }); + runGetPip.stderr.on('data', (data) => { + console.error(data.toString()); + }); + pipInstall.on('close', (code) => { + if (code !== 0) { + console.error('Failed to install pip'); + process.exit(1); + } + }); +} + function runPipInstall(requirementsFilePath, workingDir) { const pipInstall = spawn(pythonExe, ['-m', 'pip', 'install', '-r', requirementsFilePath], { cwd: workingDir }); pipInstall.stdout.on('data', (data) => { @@ -81,8 +97,13 @@ function main() { const offlineEnvDir = unzippedPackagedPyenv(zippedPyenv) const pythonExe = existingFileOrExit(path.join(offlineEnvDir, 'python.exe')); + const getPipFile = existingFileOrExit(path.join(offlineEnvDir, 'get-pip.py')); const platformSpecificRequirementsTxt = existingFileOrExit(path.join(__dirname, '..', '..', 'service', `requirements-${platform}.txt`)); - const requirementsTxt = existingFileOrExit(path.join(__dirname, '..', '..', 'service', `requirements-${platform}.txt`)); + const requirementsTxt = existingFileOrExit(path.join(__dirname, '..', '..', 'service', `requirements.txt`)); + const comfyUiRequirementsTxt = existingFileOrExit(path.join(__dirname, '..', '..', 'ComfyUI', `requirements.txt`)); + const requirementsTxt = existingFileOrExit(path.join(__dirname, '..', '..', 'ComfyUI', 'custom_nodes', 'ComfyUI-GGUF', `requirements.txt`)); + + installPip(getPipFile, offlineEnvDir) runPipInstall(platformSpecificRequirementsTxt, offlineEnvDir) runPipInstall(requirementsTxt, offlineEnvDir) diff --git a/service/requirements-arc.txt b/service/requirements-arc.txt index d64ae912..2720f6c8 100644 --- a/service/requirements-arc.txt +++ b/service/requirements-arc.txt @@ -2,8 +2,15 @@ --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/us/ --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/cn/ mkl-dpcpp==2024.2.1 +torch==2.3.1.post0+cxx11.abi +torchvision==0.18.1.post0+cxx11.abi +torchaudio==2.3.1.post0+cxx11.abi # IPEX-LLM --pre onednn-devel==2024.1.1 ipex_llm==2.2.0b2 +bigdl-core-xe-23==2.6.0b2 +bigdl-core-xe-addons-23==2.6.0b2 +bigdl-core-xe-batch-23==2.6.0b2 +onednn-devel==2024.1.1 \ No newline at end of file