/// <summary> /// Determine if we need to adjust the Jupyter kernel path to get this to launch in an Anaconda-only /// installation. This is currently isolated to Python-based kernels that are launched. /// </summary> /// <param name="info">The original process information created to launch the kernel</param> /// <returns>The corrected process information and arguments if modified, or the original process information</returns> public ProcessStartInfo AdjustLaunchCommandForAnaconda(ProcessStartInfo info) { // The special processing is for Anaconda installations of Python. Let's see if we fall into that bucket. var anacondaPythonPath = KernelManager.GetAnacondaPythonPath(); if (!string.IsNullOrWhiteSpace(anacondaPythonPath) && Directory.Exists(anacondaPythonPath)) { // We have an Anaconda path. Now let's see if we can launch Python from the command line. // If we can, we're going to assume the environment is all set. If not, we will assume we // need to use our special Anaconda startup. if (!TestLaunchProcess("python.exe", "-h")) { var newArguments = string.Format("/C {0}\\condabin\\activate.bat {0} & {0}\\python.exe {1}", anacondaPythonPath, info.Arguments); if (TestLaunchProcess("cmd.exe", newArguments + " -h")) { info.FileName = "cmd.exe"; info.Arguments = newArguments; } } } return(info); }
public KernelApp(string kernelName) { KernelName = kernelName; Manager = new KernelManager(kernelName); }