diff --git a/README.md b/README.md index 51cc1e4..ebdf086 100644 --- a/README.md +++ b/README.md @@ -108,9 +108,8 @@ Parallax Windows CLI adopts modern C++ design patterns and mainly contains the f ### 1. Download and Install Download the latest installer from the Release page: -``` -Gradient_Parallax_PC_Setup_v1.0.0.0.exe -``` + +[Parallax_Win_Setup.exe](https://github.com/GradientHQ/parallax_win_cli/releases/latest/download/Parallax_Win_Setup.exe) ### 2. Environment Check ```cmd diff --git a/src/parallax/cli/commands/base_command.h b/src/parallax/cli/commands/base_command.h index 3891de3..15a43d9 100644 --- a/src/parallax/cli/commands/base_command.h +++ b/src/parallax/cli/commands/base_command.h @@ -210,6 +210,15 @@ class WSLCommand : public BaseCommand { command); } + // Build venv activation command with CUDA environment + std::string BuildVenvActivationCommand(const CommandContext& context) { + // Filter out Windows paths and add CUDA path + // Use single quotes and careful escaping for PowerShell/CMD compatibility + return "cd ~/parallax && " + "export PATH=/usr/local/cuda-12.8/bin:$(echo '$PATH' | tr ':' '\\n' | grep -v '/mnt/c' | paste -sd ':' -) && " + "source ./venv/bin/activate"; + } + // Escape arguments for safe passing through bash -c "..." // This prevents command injection and correctly handles spaces/special chars // Note: This is for WSL bash layer, not Windows PowerShell layer diff --git a/src/parallax/cli/commands/cmd_command.cpp b/src/parallax/cli/commands/cmd_command.cpp index 4b6795d..77a5a7b 100644 --- a/src/parallax/cli/commands/cmd_command.cpp +++ b/src/parallax/cli/commands/cmd_command.cpp @@ -130,13 +130,13 @@ std::string CmdCommand::BuildCommand(const CommandContext& context, std::string full_command; if (options.use_venv) { - // Execute in virtual environment - full_command = "cd ~/parallax && source ./venv/bin/activate"; + // Execute in virtual environment with CUDA PATH + full_command = BuildVenvActivationCommand(context); // Add proxy support (similar to implementation in model_commands.cpp) if (!context.proxy_url.empty()) { - full_command += " && HTTP_PROXY=\"" + context.proxy_url + - "\" HTTPS_PROXY=\"" + context.proxy_url + "\" " + + full_command += " && HTTP_PROXY='" + context.proxy_url + + "' HTTPS_PROXY='" + context.proxy_url + "' " + command; } else { full_command += " && " + command; @@ -144,8 +144,8 @@ std::string CmdCommand::BuildCommand(const CommandContext& context, } else { // Execute directly in WSL if (!context.proxy_url.empty()) { - full_command = "HTTP_PROXY=\"" + context.proxy_url + - "\" HTTPS_PROXY=\"" + context.proxy_url + "\" " + + full_command = "HTTP_PROXY='" + context.proxy_url + + "' HTTPS_PROXY='" + context.proxy_url + "' " + command; } else { full_command = command; diff --git a/src/parallax/cli/commands/model_commands.cpp b/src/parallax/cli/commands/model_commands.cpp index 7aec956..0149317 100644 --- a/src/parallax/cli/commands/model_commands.cpp +++ b/src/parallax/cli/commands/model_commands.cpp @@ -40,14 +40,13 @@ bool ModelRunCommand::RunParallaxScript(const CommandContext& context) { // Build run command: parallax run [user parameters...] std::string run_command = BuildRunCommand(context); - // Build complete WSL command: cd ~/parallax && source ./venv/bin/activate - // && parallax run [args...] - std::string full_command = "cd ~/parallax && source ./venv/bin/activate"; + // Build complete WSL command with venv activation and CUDA environment + std::string full_command = BuildVenvActivationCommand(context); // If proxy is configured, add proxy environment variables if (!context.proxy_url.empty()) { - full_command += " && HTTP_PROXY=\"" + context.proxy_url + - "\" HTTPS_PROXY=\"" + context.proxy_url + "\" " + + full_command += " && HTTP_PROXY='" + context.proxy_url + + "' HTTPS_PROXY='" + context.proxy_url + "' " + run_command; } else { full_command += " && " + run_command; @@ -95,14 +94,13 @@ CommandResult ModelJoinCommand::ExecuteImpl(const CommandContext& context) { // Build cluster join command: parallax join [user parameters...] std::string join_command = BuildJoinCommand(context); - // Build complete WSL command: cd ~/parallax && source ./venv/bin/activate - // && parallax join [args...] - std::string full_command = "cd ~/parallax && source ./venv/bin/activate"; + // Build complete WSL command with venv activation and CUDA environment + std::string full_command = BuildVenvActivationCommand(context); // If proxy is configured, add proxy environment variables if (!context.proxy_url.empty()) { - full_command += " && HTTP_PROXY=\"" + context.proxy_url + - "\" HTTPS_PROXY=\"" + context.proxy_url + "\" " + + full_command += " && HTTP_PROXY='" + context.proxy_url + + "' HTTPS_PROXY='" + context.proxy_url + "' " + join_command; } else { full_command += " && " + join_command; diff --git a/src/parallax/environment/software_installer2.cpp b/src/parallax/environment/software_installer2.cpp index f075d2b..3c9bc2c 100644 --- a/src/parallax/environment/software_installer2.cpp +++ b/src/parallax/environment/software_installer2.cpp @@ -257,23 +257,11 @@ ComponentResult ParallaxProjectInstaller::Install() { true); if (!is_update_mode) { - // Only install sgl_kernel during first installation (use real-time - // output) - std::string install_sgl_cmd = - "cd ~/parallax && source ./venv/bin/activate && pip install " - "https://github.com/sgl-project/whl/releases/download/v0.3.7/" - "sgl_kernel-0.3.7+cu128-cp310-abi3-manylinux2014_x86_64.whl " - "--force-reinstall"; - if (!proxy_url.empty()) { - install_sgl_cmd = - "cd ~/parallax && source ./venv/bin/activate && HTTP_PROXY=\"" + - proxy_url + "\" HTTPS_PROXY=\"" + proxy_url + - "\" pip install " - " https://github.com/sgl-project/whl/releases/download/v0.3.7/" - "sgl_kernel-0.3.7+cu128-cp310-abi3-manylinux2014_x86_64.whl " - "--force-reinstall"; - } - commands.emplace_back("install_sgl_kernel", install_sgl_cmd, 600, true); + // Add CUDA environment variable to system profile (only during first installation) + std::string add_cuda_env_cmd = + "grep -q '/usr/local/cuda-12.8/bin' ~/.bashrc || " + "echo 'export PATH=/usr/local/cuda-12.8/bin:$PATH' >> ~/.bashrc"; + commands.emplace_back("add_cuda_env", add_cuda_env_cmd, 30, false); } // Execute command sequence