-
Notifications
You must be signed in to change notification settings - Fork 415
Description
Describe the bug
This bug is probably due to some weirdness in my company's Windows installation, I experienced this issue not only with dotnet interactive. The problem is that when commands are executed within a conda environment, the command line argument looks like conda activate <env>&<command>. Now, this looks perfectly fine. If I enable the debugging logs to get the exact command that is run and I execute it within cmd, it does exactly what it should. However, if dotnet interactive tries to execute the command, basically it is as if the activation of the environment never happens - so the PATH is not altered and <command> might not even exist (in my case, there's no global Jupyter installation).
If this problem did exist on another PC, I'd speculate that ShellExecute or CreateProcess or whatever is internally used just don't properly support this command line syntax. I encountered the same problem with a completely different application (MikTeX, where I tried to run pygmentize in an environment - no way, not with &, not with &&, not with cmd /k ... or cmd /c ..., it just does not work), which worked well on my private PC.
I would propose a very simple fix: change from "activation + ordinary execution" into "execution via conda":
| return await CommandLine.Execute(CondaPath, $"activate {environmentName}&{command} {args}"); |
to
$"conda run -n {environmentName} {command} {args}"and
| return CommandLine.StartProcess(CondaPath, $"activate {Name}&{command} {args}", workingDir, output, error); |
to
$"conda run -n {Name} {command} {args}"
Currently, I have a very ugly workaround, where I create a jupyter.bat in my PATH which simply contains @conda run -n <environment> jupyter %* (hardcoded environment, very unflexible) and change all my kernel paths to also invoke conda run instead of the kernel directly. This works at least if I only use a single environment, but is of course not very nice. But it makes me think that the two changes proposed above should also work.
Please complete the following:
Which version of .NET Interactive are you using?
Version: 1.0.632301+7d35ce3be7eb7a603527a3683b691d5e9922adca
Library version: 1.0.0-beta.25323.1+7d35ce3be7eb7a603527a3683b691d5e9922adca
- OS
- Windows 11
- Frontend
- Visual Studio Code