DEV Community

Easily add Anaconda Prompt to Windows Terminal to make life better

Cassie Breviu on December 05, 2019

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 ...
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
 
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
 
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
 
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
 
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
 
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
 
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
 
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
 
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.

Collapse
 
bhuvandv profile image
D V Bhuvan

This was really helpful, Thank you!