Error when trying to use conda on vs code: conda : The term 'conda' is not recognized as the name of a cmdlet
10,189
Try the following:
- Run Anaconda/Miniconda
- Activate the environment there:
conda activate your-env
- Start Visual Studio Code from the Anaconda/Miniconda terminal:
code
Then Visual Studio Code should recognize conda
:
Author by
Spaceball
Updated on June 04, 2022Comments
-
Spaceball almost 2 years
I am trying to build a basic machine learning algorithm, and to do so I am using the anaconda interpreter for python. However, even though visual studio code appears to have recognized conda as the interpreter, and I have the anaconda3 shell working as a separate application, I cannot get conda to work on vs code. Whenever I try to check for conda, I get the following error:
conda : The term 'conda' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + conda activate base + ~~~~~ + CategoryInfo : ObjectNotFound: (conda:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
I have tried the fixes linked here: 'Conda' is not recognized as internal or external command
however, they did not work for me. I tried setting conda to my path yet I still got the same error. Thanks in advance!
-
AMC over 3 yearsWhere are you trying to execute that command?
-
Jill Cheng over 3 years@Spaceball -Have you tried restarting VSCode after adding the conda system path?
-
Spaceball over 3 years@AMC I am executing it in powershell in the terminal in vscode, in the path for my project (i.e. C:\Users\User\Documents\Machine-Learning). Is this what you mean?
-
Spaceball over 3 years@JillCheng I just restarted VSCode and it appears that the issue remains.
-
Jill Cheng over 3 years@Spaceball -Could you find the three file locations "Anaconda3", "Anaconda3\Scripts", and "\Library\bin"? And could the conda environment be activated in a powershell terminal outside of VSCode?
-
Spaceball over 3 years@JillCheng - I could find these file locations in my computer. However, when I try to do anything with conda in the outside PowerShell terminal, I also get the same error.
-
Jill Cheng over 3 years@Spaceball -The content displayed on the terminal means that the terminal cannot find anaconda. Therefore, if the environment variables are configured correctly, it is recommended that you try to reinstall Anaconda.
-
Robert Sim almost 3 yearsIt seems like a bug to me if VS Code can locate the anaconda environment in the editor, but when you launch a terminal inside VS Code the environment can't be found.
-