loading...
Microsoft Azure

Easily add Anaconda Prompt to Windows Terminal to make life better

cassieview profile image Cassie Updated on ・2 min read

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

Discussion

pic
Editor guide
Collapse
nikiluk profile image
Nikita Lukianets

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
cassieview profile image
Cassie Author

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
cassieview profile image
Cassie Author

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
cassieview profile image
Cassie Author

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
cassieview profile image
Cassie Author

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

Thread Thread
naveensk23 profile image
Naveen Kumar

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
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
cassieview profile image
Cassie Author

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",

Collapse
oneextrafact profile image
oneextrafact

As my last task in the regular Anaconda prompt, I ran

import uuid
uuid.uuid4()

Thanks so much for a helpful post!

Collapse
citizen428 profile image
Michael Kohl

Update the guid to something unique by changing the last number

Or by using an online generator like guidgenerator.com/online-guid-gene...

Nice guide though! :-)