DLT
DLT

Reputation: 441

Stop automatic `conda activate` when opening a terminal in VS Code

VS Code has started running conda activate every time I open a terminal in VSCode, be it PowerShell, WSL, or CMD.

I never set this up intentionally so have no idea why it does this or how to disable it. I've looked at all my settings in VS Code and cannot find anything.

How do I stop VS Code from running conda activate when a new terminal is opened?

Upvotes: 5

Views: 3243

Answers (2)

Ukant
Ukant

Reputation: 51

Open Powershell and run as Administrator, execute the following command

conda config --set auto_activate_base true

Then restart VS Code

Upvotes: 0

starball
starball

Reputation: 51353

Try putting the following in your settings.json file:

"python.terminal.activateEnvironment": false

You're getting this behaviour because the default value of that setting is true if not specified.

For more info, see VS Code's docs on Using Python environments in VS Code- in particular, the Working with Python interpreters section, and the Environments and Terminal windows section.

Quoting from that page:

Tip: To prevent automatic activation of a selected environment, add "python.terminal.activateEnvironment": false to your settings.json file (it can be placed anywhere as a sibling to the existing settings).

Reading the changelog, this setting was added in version 2018.9.0 of the Python extension for VS Code. The PR that added it was #1387.

Upvotes: 6

Related Questions