@@ -470,7 +470,7 @@ public void start() {
470
470
public void startPythonProcess () {
471
471
try {
472
472
// Determine Python executable
473
- String pythonCommand = findPythonExecutable ();
473
+ String pythonCommand = findSystemPythonExecutable ();
474
474
if (pythonCommand == null ) {
475
475
error ("Python is not installed or not found in system PATH." );
476
476
return ;
@@ -528,7 +528,7 @@ public void startPythonProcess() {
528
528
* Finds the Python executable and returns its path.
529
529
* Checks both "python3" and "python" commands.
530
530
*/
531
- private String findPythonExecutable () {
531
+ private String findSystemPythonExecutable () {
532
532
try {
533
533
ProcessBuilder processBuilder = new ProcessBuilder ("python3" , "--version" );
534
534
Process process = processBuilder .start ();
@@ -545,6 +545,22 @@ private String findPythonExecutable() {
545
545
546
546
return null ; // Python not found
547
547
}
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
+
548
564
549
565
550
566
@@ -562,7 +578,7 @@ private String findPythonExecutable() {
562
578
public void installPipPackages (List <String > packages ) throws IOException {
563
579
List <String > commandArgs = new ArrayList <>(List .of ("-m" , "pip" , "install" ));
564
580
commandArgs .addAll (packages );
565
- ProcessBuilder pipProcess = new ProcessBuilder (findPythonExecutable ());
581
+ ProcessBuilder pipProcess = new ProcessBuilder (findVenvPythonExecutable ());
566
582
pipProcess .command ().addAll (commandArgs );
567
583
Process proc = pipProcess .redirectErrorStream (true ).start ();
568
584
new Thread (() -> {
0 commit comments