Skip to content

Commit

Permalink
control stardist installation path
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Jan 20, 2025
1 parent 8034b8b commit 6babb66
Showing 1 changed file with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ public abstract class StardistAbstract implements Closeable {

private Service python;

private static String INSTALLATION_DIR = Mamba.BASE_PATH;

private static final List<String> STARDIST_DEPS = Arrays.asList(new String[] {"python=3.10", "stardist", "numpy", "appose"});

private static final List<String> STARDIST_CHANNELS = Arrays.asList(new String[] {"conda-forge", "default"});
Expand Down Expand Up @@ -208,7 +210,7 @@ private void createThresholdsFromBioimageio() throws IOException, ModelSpecsExce

private void createPythonService() throws IOException {
Environment env = new Environment() {
@Override public String base() { return new Mamba().getEnvsDir() + File.separator + "stardist"; }
@Override public String base() { return new Mamba(INSTALLATION_DIR).getEnvsDir() + File.separator + "stardist"; }
};
python = env.python();
python.debug(System.err::println);
Expand Down Expand Up @@ -345,7 +347,7 @@ public static void installRequirements() throws IOException, InterruptedExceptio
RuntimeException, MambaInstallException,
ArchiveException, URISyntaxException {

Mamba mamba = new Mamba();
Mamba mamba = new Mamba(INSTALLATION_DIR);
boolean stardistPythonInstalled = false;
try {
stardistPythonInstalled = mamba.checkAllDependenciesInEnv("stardist", STARDIST_DEPS);
Expand All @@ -357,4 +359,21 @@ public static void installRequirements() throws IOException, InterruptedExceptio
mamba.create("stardist", true, STARDIST_CHANNELS, STARDIST_DEPS);
};
}

/**
* Set the directory where the StarDist Python environment will be installed
* @param installationDir
* directory where the StarDist Python environment will be created
*/
public static void setInstallationDir(String installationDir) {
INSTALLATION_DIR = installationDir;
}

/**
*
* @return the directory where the StarDist Python environment will be created
*/
public static String getInstallationDir() {
return INSTALLATION_DIR;
}
}

0 comments on commit 6babb66

Please sign in to comment.