Skip to content

Commit

Permalink
Activate conda env if it runs in Windows
Browse files Browse the repository at this point in the history
This fix was proposed originally by @msphan, but the master diverged.
I include it in this commit by cimply copy-pasting the relevant lines.
We could reproduce the bug separately, and in my case using omnipose.
The fix works for both of us.

Signed-off-by: Minh-Son  PHAN <minh-son.phan@pasteur.fr>
  • Loading branch information
tinevez committed Mar 10, 2024
1 parent 8b266ca commit 9622b31
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package fiji.plugin.trackmate.cellpose;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import ij.IJ;

public abstract class AbstractCellposeSettings
{

Expand Down Expand Up @@ -88,6 +91,14 @@ public List< String > toCmdLine( final String imagesDir )
final String lastItem = split[ split.length - 1 ];
if ( lastItem.toLowerCase().startsWith( "python" ) )
{
// Activate conda env if it runs in Windows.
if ( IJ.isWindows() )
{
final String envname = split[ split.length - 2 ];
cmd.addAll( Arrays.asList( "cmd.exe", "/c", "conda", "activate", envname ) );
cmd.add( "&" );
}

// Calling Cellpose from python.
cmd.add( executablePath );
cmd.add( "-m" );
Expand Down

0 comments on commit 9622b31

Please sign in to comment.