Skip to content

Commit

Permalink
build offline comfy UI release
Browse files Browse the repository at this point in the history
let installer be completely offline.

Signed-off-by: Florian Esser <[email protected]>
  • Loading branch information
florianesser-tng committed Nov 25, 2024
1 parent 09124f2 commit a482a71
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 23 deletions.
22 changes: 0 additions & 22 deletions WebUI/build/installer.nsh.template
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 22 additions & 1 deletion WebUI/build/scripts/pack-offline.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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)

Expand Down
7 changes: 7 additions & 0 deletions service/requirements-arc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit a482a71

Please sign in to comment.