Skip to content

Install expected missing pip dependencies + update ComfyUI v0.3.16 #996

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions assets/requirements/windows_cpu.compiled
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file was autogenerated by uv via the following command:
# uv pip compile assets\ComfyUI\requirements.txt assets\ComfyUI\custom_nodes\ComfyUI-Manager\requirements.txt --emit-index-annotation --emit-index-url --index-strategy unsafe-best-match -o assets\requirements\windows_cpu.compiled
# uv pip compile assets\ComfyUI\requirements.txt assets\ComfyUI\custom_nodes\ComfyUI-Manager\requirements.txt --emit-index-annotation --emit-index-url --index-strategy unsafe-best-match -o assets\requirements\windows_cpu.compiled --index-url https://pypi.org/simple
--index-url https://pypi.org/simple

aiohappyeyeballs==2.4.6
Expand All @@ -14,6 +14,9 @@ aiosignal==1.3.2
attrs==25.1.0
# via aiohttp
# from https://pypi.org/simple
av==14.2.0
# via -r assets/ComfyUI/requirements.txt
# from https://pypi.org/simple
certifi==2025.1.31
# via requests
# from https://pypi.org/simple
Expand Down Expand Up @@ -271,5 +274,7 @@ wrapt==1.17.2
# via deprecated
# from https://pypi.org/simple
yarl==1.18.3
# via aiohttp
# via
# -r assets/ComfyUI/requirements.txt
# aiohttp
# from https://pypi.org/simple
10 changes: 7 additions & 3 deletions assets/requirements/windows_nvidia.compiled
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file was autogenerated by uv via the following command:
# uv pip compile assets\ComfyUI\requirements.txt assets\ComfyUI\custom_nodes\ComfyUI-Manager\requirements.txt --emit-index-annotation --emit-index-url --index-strategy unsafe-best-match -o assets\requirements\windows_nvidia.compiled --override assets\override.txt
# uv pip compile assets\ComfyUI\requirements.txt assets\ComfyUI\custom_nodes\ComfyUI-Manager\requirements.txt --emit-index-annotation --emit-index-url --index-strategy unsafe-best-match -o assets\requirements\windows_nvidia.compiled --override assets\override.txt --index-url https://pypi.org/simple --extra-index-url https://download.pytorch.org/whl/cu126
--index-url https://pypi.org/simple
--extra-index-url https://download.pytorch.org/whl/cu126

Expand All @@ -15,6 +15,9 @@ aiosignal==1.3.2
attrs==25.1.0
# via aiohttp
# from https://pypi.org/simple
av==14.2.0
# via -r assets/ComfyUI/requirements.txt
# from https://pypi.org/simple
certifi==2025.1.31
# via requests
# from https://pypi.org/simple
Expand Down Expand Up @@ -113,7 +116,6 @@ networkx==3.4.2
# from https://pypi.org/simple
numpy==1.26.4
# via
# --override assets/override.txt
# -r assets/ComfyUI/requirements.txt
# scipy
# soundfile
Expand Down Expand Up @@ -279,5 +281,7 @@ wrapt==1.17.2
# via deprecated
# from https://pypi.org/simple
yarl==1.18.3
# via aiohttp
# via
# -r assets/ComfyUI/requirements.txt
# aiohttp
# from https://pypi.org/simple
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"config": {
"frontendVersion": "1.9.19",
"comfyUI": {
"version": "0.3.14",
"optionalBranch": "desktop-release-feb192025"
"version": "0.3.16",
"optionalBranch": ""
},
"managerCommit": "1434b12c343b58a401f1c9f913965ceb0cfd089e",
"uvVersion": "0.5.31"
Expand Down
12 changes: 8 additions & 4 deletions src/install/installationManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class InstallationManager implements HasTelemetry {
if (state === 'upgraded') installation.upgradeConfig();

// Install updated manager requirements
if (installation.needsManagerPackageUpdate) await this.updateManagerPackages(installation);
if (installation.needsRequirementsUpdate) await this.updatePackages(installation);

// Resolve issues and re-run validation
if (installation.hasIssues) {
Expand Down Expand Up @@ -273,16 +273,20 @@ export class InstallationManager implements HasTelemetry {
}

@trackEvent('installation_manager:manager_packages_update')
private async updateManagerPackages(installation: ComfyInstallation) {
private async updatePackages(installation: ComfyInstallation) {
const sendLogIpc = (data: string) => {
log.info(data);
this.appWindow.send(IPC_CHANNELS.LOG_MESSAGE, data);
};
await this.appWindow.loadPage('desktop-update');
await installation.virtualEnvironment.installComfyUIManagerRequirements({

// Using requirements.txt again here ensures that uv installs the expected packages from the previous step (--dry-run)
const callbacks: ProcessCallbacks = {
onStdout: sendLogIpc,
onStderr: sendLogIpc,
});
};
await installation.virtualEnvironment.installComfyUIRequirements(callbacks);
await installation.virtualEnvironment.installComfyUIManagerRequirements(callbacks);
await installation.validate();
}

Expand Down
8 changes: 4 additions & 4 deletions src/main-process/comfyInstallation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ export class ComfyInstallation {
}

/** `true` if Manager needs toml and uv to be installed, otherwise `false`. */
get needsManagerPackageUpdate() {
return this.validation.managerPythonPackages === 'warning';
get needsRequirementsUpdate() {
return this.validation.upgradePackages === 'warning';
}

/**
Expand Down Expand Up @@ -136,9 +136,9 @@ export class ComfyInstallation {
// Python packages
try {
const result = await venv.hasRequirements();
if (result === 'manager-upgrade') {
if (result === 'package-upgrade') {
validation.pythonPackages = 'OK';
validation.managerPythonPackages = 'warning';
validation.upgradePackages = 'warning';
} else {
validation.pythonPackages = result;
if (result !== 'OK') log.error('Virtual environment is incomplete.');
Expand Down
2 changes: 1 addition & 1 deletion src/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export interface InstallValidation {
uv?: ValidationIssueState;
git?: ValidationIssueState;
vcRedist?: ValidationIssueState;
managerPythonPackages?: ValidationIssueState;
upgradePackages?: ValidationIssueState;
}

const electronAPI = {
Expand Down
27 changes: 21 additions & 6 deletions src/virtualEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ export class VirtualEnvironment implements HasTelemetry {
}
}

private async installComfyUIRequirements(callbacks?: ProcessCallbacks): Promise<void> {
async installComfyUIRequirements(callbacks?: ProcessCallbacks): Promise<void> {
log.info(`Installing ComfyUI requirements from ${this.comfyUIRequirementsPath}`);
const installCmd = getPipInstallArgs({
requirementsFile: this.comfyUIRequirementsPath,
Expand Down Expand Up @@ -531,7 +531,7 @@ export class VirtualEnvironment implements HasTelemetry {
* `'manager-upgrade'` if `uv` and `toml` are missing,
* or `'error'` when any other combination of packages are missing.
*/
async hasRequirements(): Promise<'OK' | 'error' | 'manager-upgrade'> {
async hasRequirements(): Promise<'OK' | 'error' | 'package-upgrade'> {
const checkRequirements = async (requirementsPath: string) => {
const args = ['pip', 'install', '--dry-run', '-r', requirementsPath];
log.info(`Running direct process command: ${args.join(' ')}`);
Expand All @@ -557,20 +557,35 @@ export class VirtualEnvironment implements HasTelemetry {
return venvOk;
};

// Manager upgrade in 0.4.18
// Manager upgrade in 0.4.18 - uv, toml (exactly)
const isManagerUpgrade = (output: string) => {
return output.search(/\bWould install 2 packages(\s+\+ (toml|uv)==[\d.]+){2}\s*$/) !== -1;
};

// Package upgrade in 0.4.21 - aiohttp, av, yarl
const isPackageUpgrade = (output: string) => {
const lines = output.split('\n');
for (const line of lines) {
// Ignore lines that aren't package changes
if (line.search(/^\s*(\+|-) /) === -1) continue;
// An unexpected package means this is not a package upgrade
if (line.search(/^\s*(\+|-) (aiohttp|av|yarl)==/) !== -1) return false;
}
return true;
};

const coreOutput = await checkRequirements(this.comfyUIRequirementsPath);
const managerOutput = await checkRequirements(this.comfyUIManagerRequirementsPath);

const coreOk = hasAllPackages(coreOutput);
const managerOk = hasAllPackages(managerOutput);

if (coreOk && isManagerUpgrade(managerOutput)) {
log.info('ComfyUI-Manager requires toml and uv. Installing.');
return 'manager-upgrade';
const ugpradeCore = isPackageUpgrade(coreOutput);
const upgradeManager = isManagerUpgrade(managerOutput);

if ((managerOk && ugpradeCore) || (coreOk && upgradeManager) || (ugpradeCore && upgradeManager)) {
log.info('Package update of known packages required. Core:', ugpradeCore, 'Manager:', upgradeManager);
return 'package-upgrade';
}

return coreOk && managerOk ? 'OK' : 'error';
Expand Down
Loading