Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I launch an exe within a conda env

I'm using vscode in Windows 10 as my code editor, and want to make an easy way to launch it with the correct conda env to allow debugging.

Currently I am having to open a command prompt, then activate the conda env, then paste the shortcut to vscode into the prompt to execute. Like so:

cmd
activate env-name
"C:\Program Files (x86)\Microsoft VS Code\Code.exe"

I have tried creating a batch file to wrap these calls, but unfortunately once I call "source activate" to start the conda env, the batch commands after this are not executed as it is considered another instance.

Any tips? Other than writing a vscode extension to handle this (which I'm seriously tempted to do, but it's such a simple problem...)

like image 584
gcasey Avatar asked May 13 '16 01:05

gcasey


1 Answers

You might want to run source activate env-name as a task in visual studio. https://code.visualstudio.com/Docs/editor/tasks

tasks.json

{
    "version": "0.1.0",
    "command": "cmd",
    "isShellCommand": true,
    "suppressTaskName": true,
    "args": [],
    "tasks": [
        {
            "taskName": "development",
            "args": ["source", "activate", "env-name"]
        }
    ]
}
like image 98
Steffen Avatar answered Nov 15 '22 09:11

Steffen