@@ -470,7 +470,7 @@ public void start() {
470470 public void startPythonProcess () {
471471 try {
472472 // Determine Python executable
473- String pythonCommand = findPythonExecutable ();
473+ String pythonCommand = findSystemPythonExecutable ();
474474 if (pythonCommand == null ) {
475475 error ("Python is not installed or not found in system PATH." );
476476 return ;
@@ -528,7 +528,7 @@ public void startPythonProcess() {
528528 * Finds the Python executable and returns its path.
529529 * Checks both "python3" and "python" commands.
530530 */
531- private String findPythonExecutable () {
531+ private String findSystemPythonExecutable () {
532532 try {
533533 ProcessBuilder processBuilder = new ProcessBuilder ("python3" , "--version" );
534534 Process process = processBuilder .start ();
@@ -545,6 +545,22 @@ private String findPythonExecutable() {
545545
546546 return null ; // Python not found
547547 }
548+ 549+ 550+ private String findVenvPythonExecutable () {
551+ String venv = getDataDir () + fs + "venv" ;
552+ String venvPython = Platform .getLocalInstance ().isWindows ()
553+ ? venv + fs + "Scripts" + fs + "python.exe"
554+ : venv + fs + "bin" + fs + "python" ;
555+ 556+ File check = new File (venvPython );
557+ if (!check .exists ()){
558+ error ("Could not find %s" , venvPython );
559+ return null ;
560+ }
561+ return venvPython ;
562+ }
563+ 548564
549565
550566
@@ -562,7 +578,7 @@ private String findPythonExecutable() {
562578 public void installPipPackages (List <String > packages ) throws IOException {
563579 List <String > commandArgs = new ArrayList <>(List .of ("-m" , "pip" , "install" ));
564580 commandArgs .addAll (packages );
565- ProcessBuilder pipProcess = new ProcessBuilder (findPythonExecutable ());
581+ ProcessBuilder pipProcess = new ProcessBuilder (findVenvPythonExecutable ());
566582 pipProcess .command ().addAll (commandArgs );
567583 Process proc = pipProcess .redirectErrorStream (true ).start ();
568584 new Thread (() -> {
0 commit comments