Skip to content
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

Fixed: Install pytorch separately in fallback installation. #271

Merged
merged 1 commit into from
Nov 16, 2024
Merged
Changes from all 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
34 changes: 30 additions & 4 deletions src/virtualEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,39 @@ export class VirtualEnvironment {
}

private async installComfyUIRequirements(callbacks?: ProcessCallbacks): Promise<void> {
log.info(`Installing ComfyUI requirements from ${this.comfyUIRequirementsPath}`);
const installCmd = ['pip', 'install', '-r', this.comfyUIRequirementsPath];

if (process.platform === 'win32') {
installCmd.push('--index-url', 'https://download.pytorch.org/whl/cu121');
log.info('Installing PyTorch CUDA 12.1');
await this.runUvCommandAsync(
[
'pip',
'install',
'torch',
'torchvision',
'torchaudio',
'--index-url',
'https://download.pytorch.org/whl/cu121',
],
callbacks
);
}

if (process.platform === 'darwin') {
log.info('Installing PyTorch Nightly for macOS.');
await this.runUvCommandAsync(
[
'pip',
'install',
'torch',
'torchvision',
'torchaudio',
'--extra-index-url',
'https://download.pytorch.org/whl/nightly/cpu',
],
callbacks
);
}
log.info(`Installing ComfyUI requirements from ${this.comfyUIRequirementsPath}`);
const installCmd = ['pip', 'install', '-r', this.comfyUIRequirementsPath];
const { exitCode } = await this.runUvCommandAsync(installCmd, callbacks);
if (exitCode !== 0) {
throw new Error(`Failed to install requirements.txt: exit code ${exitCode}`);
Expand Down
Loading