Skip to content Skip to sidebar Skip to footer

Visual Studio Code Terminal Doesn't Activate Conda Environment

I read this Stack Overflow post on a similar issue, but the suggestions there don't seem to be working. I installed Visual Studio Code on my Windows machine and added the Python ex

Solution 1:

First, open the Anaconda prompt (How to access Anaconda command prompt in Windows 10 (64-bit)), and type:

conda activate tom

To activate your virtual environment.

Then to open Visual Studio Code in this active environment, type

code

And it should work.

Solution 2:

I was facing the same issue for a long time and nothing seemed to work. Out of nowhere, VS Code suggested me the following in a notification prompt:

We noticed you're using a conda environment. If you are experiencing issues with this environment in the integrated terminal, we recommend that you let the Python extension change "terminal.integrated.inheritEnv" to false in your user settings.

I clicked yes on it and worked. You can also manually set this in your settings.json as follows:

  1. Press Shift + Command + P to open command palette.
  2. Type settings.json and select `Preferences: Open Settings (JSON)
  3. In the JSON file, add the key-value pair "terminal.integrated.inheritEnv": false
  4. Save the JSON file

Solution 3:

  1. In Vscode hit ctrl+` to open your terminal.
  2. Then within the terminal type: conda init.
  3. Close and reopen the terminal.
  4. Use Conda normally.

Solution 4:

This seems to be because the Anaconda installation recommends not changing the windows PATH to reference anaconda, as it can clash with other installations, I had no problems when my PATH variable was modified. It seems like vs code (or most likely the Python extension) is still not activating anaconda correctly itself.

Solution 5:

enter image description here

I was helped by switching the terminal from powershell to cmd

Post a Comment for "Visual Studio Code Terminal Doesn't Activate Conda Environment"