DEV Community

Cassie Breviu for Microsoft Azure

Posted on • Edited on

Easily add Anaconda Prompt to Windows Terminal to make life better

I love the Windows Terminal and if you haven't tried it out yet I highly recommend it. Its super customizable which is absolutely lovely. Here are the steps to add Anaconda Prompt to Windows Terminal.

Prerequisites

Add Anaconda Prompt

  1. Open Windows Terminal and click the arrow and then settings. This will open the settings.json file to customize the terminal. Alt Text
  2. Duplicate the cmd settings by copying and pasting them below or highlight CTRL + D if using visual studio to duplicate the selected text. (I ♥ shortcuts) Alt Text
  3. Update the guid to something unique
  4. Update the name to Anaconda
  5. Next update the commandline to the cmd for Anaconda Prompt. The easiest way to do this is to grab the target path from the Anaconda Prompt shortcut.
    • Search for Anaconda Prompt in the windows search bar
    • Right click and open file location
    • Right click on the Anaconda Prompt shortcut
    • Click properties
    • Grab the target path
    • Delete the extra text to get the path (shown below)
    • If you prefer you can replace the "C:\Users\xxx" to "%USERPROFILE%" Alt Text The new terminal settings.json should look something like this: Alt Text
  6. Optional: Update the icon to the Anaconda navigator icon
    • It will be the same root path as above up to the anaconda3
    • Append \\Menu\\anaconda-navigator.ico to the end.
    • End result should look something like this: "icon": "%USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\Menu\\anaconda-navigator.ico"
  7. Save the changes to the settings.json file
  8. Open Windows Terminal
  9. Click the down arrow and select Anaconda
  10. BOOM! Anaconda in Windows Terminal. Alt Text
  11. Listen to Sir-Mix-A-Lot and rejoice in your awesomeness

Top comments (27)

Collapse
 
nikiluk profile image
Nikita Lukianets • Edited

In the newest version of Windows Terminal, the changes are done in the settings.json file. Just change USERNAME to yours for the "commandline" setting.

{
// Make changes here to the cmd.exe profile.
"guid": "{0caa0dad-35be-5f56-a8ff-afceee452369}",
"name": "Anaconda",
"icon": "%USERPROFILE%\Anaconda3\Menu\anaconda-navigator.ico",
"commandline": "cmd.exe /K C:\Users\USERNAME\Anaconda3\Scripts\activate.bat",
"hidden": false
},

Collapse
 
cassiebreviu profile image
Cassie Breviu

I updated to settings.json! Thanks!

Collapse
 
benjaminsandham profile image
benjamin-sandham

My username is bsand, so my commandline setting is

"cmd.exe /K C:\Users\bsand\anaconda3\Scripts\activate.bat"

However, the \b is highlighted, I think it is acting as an escape character. Do you have any suggestions?

Collapse
 
nikiluk profile image
Nikita Lukianets

Try instead
"commandline": "cmd.exe /K C:\\Users\bsand\\anaconda3\\Scripts\\activate.bat"

Collapse
 
emmatovar27 profile image
emmatovar27

If you want to have the Anaconda Icon can use this path.

"icon":"%USERPROFILE%\\Anaconda3\\Menu\\anaconda-navigator.ico"
Enter fullscreen mode Exit fullscreen mode
Collapse
 
cassiebreviu profile image
Cassie Breviu • Edited

AWESOME! I am going to add this to my setup. Do you mind if I add it into the blog post as well? Thank you :D

Collapse
 
emmatovar27 profile image
emmatovar27

No problem! :) Go ahead! Actually thanks for the blog post! :)

Collapse
 
naveensk23 profile image
Naveen Kumar

(base) C:\Users\navee> this is my actual anaconda prompt
(base) C:\WINDOWS\System32> this is anaconda prompt in windows terminal
in the windows terminal, I'm running anaconda prompt as administrator mode
help me change into the user mode with windows terminal

Collapse
 
cassiebreviu profile image
Cassie Breviu

Can you post the JSON here? For the startingDirectory change the JSON to the location you want the directory to open for startingDirectory.

Collapse
 
naveensk23 profile image
Naveen Kumar

{
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6106}",
"hidden": false,
"icon":"C:\Users\navee\anaconda3\Menu\anaconda-navigator.ico",
"name": "AnacondaPrompt",
"commandline": "cmd.exe /K
C:\Users\navee\anaconda3\Scripts\activate.bat"
},

Thread Thread
 
cassiebreviu profile image
Cassie Breviu • Edited

Not sure if I completely understand. Are you trying to run as admin in win term?

Thread Thread
 
naveensk23 profile image
Naveen Kumar • Edited

No, I'm not trying to run as admin.... while running in a Windows Terminal by default it's running in admin mode
I tried to change the path also, but every time in windows terminal, the anaconda prompt opening as administrator mode.
Anyways it won't make any difference if I run as administrator mode, so no probs
Thank You Cassie, thanks for ur time n support :)

Thread Thread
 
pypeter profile image
PY-Peter

Add "startingDirectory": "C:\Users\navee" to settings.json file.
Does that solve the problem?

Collapse
 
kar0n profile image
Karan Shah

I am facing the same problem is it resolved?

Collapse
 
asgaut profile image
Asgaut Eng

If anyone want to add a Miniconda Powershell prompt add this to the settings.json file:

        {
            // Miniconda Powershell prompt for local user install (non-admin install)
            "guid": "{1caa0dad-35be-5f56-a812-afceeeaa1234}",
            "name": "Miniconda",
            "commandline": "%windir%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -ExecutionPolicy ByPass -NoExit -Command \"& '%USERPROFILE%\\Miniconda3\\shell\\condabin\\conda-hook.ps1' ; conda activate '%USERPROFILE%\\Miniconda3' \"",
            "icon": "%USERPROFILE%\\Miniconda3\\Menu\\Iconleak-Atrous-PSConsole.ico",
            "hidden": false,
            "startingDirectory": "%HOMEPATH%"
        }
Enter fullscreen mode Exit fullscreen mode
Collapse
 
ivanthewebber profile image
Ivan • Edited

If you have trouble being creative on step 3 you can just use PowerShell

PS C:\Users\you> New-Guid

Guid
----
ea5220b1-590e-4aa3-8c83-3494f8fe9a6b
Enter fullscreen mode Exit fullscreen mode

docs.microsoft.com/en-us/powershel...

Collapse
 
Sloan, the sloth mascot
Comment deleted
Collapse
 
jfreeman2 profile image
jfreeman2 • Edited

@vpraharsha03 I'm experiencing the same issue. @cassieview any idea as to what could be causing this? Thanks for the post! It was very helpful

Collapse
 
vpraharsha03 profile image
PRAHAR~1

@jfreeman2 it turned out that i used unnecessary capitalization in the property name. I used commandLine instead of commandline
cmd.exe opens up because it is the default value when commandline property isn't specified or improperly specified.

Collapse
 
mzeidhassan profile image
Mohamed Zeid • Edited

My miniconda installation was a bit different, and this what ended up working for me.
It is installed at this path "C:\ProgramData\Miniconda3"

{
              // Miniconda 
                "guid": "{1caa0dad-35be-5f56-a812-afceeeaa1234}",
                "name": "Miniconda",
                "commandline": "cmd.exe /K %ProgramData%/Miniconda3/Scripts/activate.bat %ProgramData%/Miniconda3",
                "icon": "%ProgramData%\\Miniconda3\\Menu\\Iconleak-Atrous-PSConsole.ico",
                "hidden": false,
                "startingDirectory": "%HOMEPATH%"
            }'
Enter fullscreen mode Exit fullscreen mode
Collapse
 
soumya997 profile image
Soumyadip Sarkar • Edited

the key is changing the guide variable,
my cmd guide is 0caa0dad-35be-5f56-a8ff-afceeeaa6101
I changed the guide by adding one with the last digit of cmd's guide and the rest of the things will be similar.
My anaconda guide is 0caa0dad-35be-5f56-a8ff-afceeeaa6102

Collapse
 
dschneiderch profile image
Dominik Schneider

is there anyway to add a command to run in the conda environment? I'd like to set up a profile for radian github.com/randy3k/radian which is installed in a conda environment.

Collapse
 
cassiebreviu profile image
Cassie Breviu • Edited

Update the command line to the following:
"commandline": "cmd.exe /K %USERPROFILE%\\AppData\\Local\\Continuum\\anaconda3\\Scripts\\activate.bat & radian"

Collapse
 
dschneiderch profile image
Dominik Schneider

Thanks! I ended up with this actually - specifying the miniconda3 folder specifies the root environment which is not totally necessary in this case but useful if radian isn't in root.

 "commandline": "cmd.exe /K %USERPROFILE%/Miniconda3/Scripts/activate.bat %USERPROFILE%/Miniconda3 && radian.exe",

Enter fullscreen mode Exit fullscreen mode
Collapse
 
jitvimol profile image
Jitvimol

Thanks for the sharing. This is great!
Note for new comer, use double backslash in value of command line.