Download Anaconda Prompt

0 views
Skip to first unread message

Tiffany Crutch

unread,
Aug 3, 2024, 2:44:14 PM8/3/24
to worklaclauning

The Anaconda command prompt looks like normal windows command prompt and its start menu shortcut traces back to the cmd.exe file on windows in the C:\Windows\System32 directory, so I know it is just an instance of the command prompt with certain other characteristics or features. I am curious as to what all these other aspects are.

When I click on properties of the "Anaconda Prompt" shortcut, the target is "%windir%\System32\cmd.exe" /K" C:\ProgramData\Anaconda3\Scripts\activate.bat C:\ProgramData\Anaconda3 so it has some extra arguments. In those arguments is the difference between opening a vanilla command prompt and an Anaconda.

The next argument points to a bat file to activate an Anaconda script. Then it passes a path to a directory called "Anaconda3". I am fairly certain the path it passes as the final arg means it wants this path to be accessible as if it were in the user or system path environmental variable. Python.exe (Python 3) is in this directory, as well as a _conda.exe and an important Scripts folder, so if we don't have our python in the system or user path, this is how it is found, I am fairly certain.

Back to the .bat file, this does a lot of things. I always though bats were binaries, because of how they acted on the system, but they're really just like Bash Scripts for Windows. They are human readable and mine is as follows:

As I expected, when I called the activate.bat file in an ordinary (admin) command prompt, it turned into an Anaconda prompt with the "(base)" prefix before my current path you get when you click the startup shortcut. (base) C:\Users\User>. Interestingly, doing this only seems to work in the regular command prompt, not Git Bash, not WSL, not even Powershell, though there is a separate Powershell launcher that works. In its properties, it has the target:%windir%\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy ByPass -NoExit -Command "& 'C:\ProgramData\Anaconda3\shell\condabin\conda-hook.ps1' ; conda activate 'C:\ProgramData\Anaconda3' "
And if you run the ps1 file (a powershell like script), it has the same effect of putting you into the conda environment, because you can run the 'conda' command and help instructions appear.

Anyway that's just kind of the background context, which I learned in the last few hour researching, because I wanted to do my homework. I wanted and want to know is what Conda is doing in Windows when you open the Command Prompt through Anaconda. I'm pretty certain it is doing two main things: setting the path to include the C:\ProgramData\Anaconda3 directory, for the session, and activating it's base environment or any other virtual environment you tell it to launch that you may have created through it at some point, but does it do anything else of note?

I ask this not just because I am curious about what's really going on (I am), but I was also hoping to work with Conda in Git Bash and WSL, terminals I really like. I can currently use Conda's Python with them (the only Python on my machine) as it seems to exist independent of the program that installed it and manages packages for it, but I was specifically hoping to use the all the Conda environment management tools inside Git Bash or WSL. After thinking about it, I now don't believe this is possible. From a naive user perspective, one sort of assumes they can run any program anywhere, and that makes sense or would have made sense before we had sub-systems and systems within systems, but from a more aware point of view, Anaconda was installed for Windows and inside the C:\ProgramData\Anaconda3 directory are .exe and .bat files, not Linux/WSL compatible binaries and .sh or .bash files. It's like trying to run Windows_OS>Linux subsystem>Windows_file_again, but it doesn't work like that. WSL and Git Bash don't even have the same path structure somehow. Am I right in my thinking so far?

I enjoy Git Bash and WSL more than Powershell or cmd and I use them a lot for GCC and git. I do most of my coding in VS Code and launch these terminals there. I suppose at best I could install conda for git bash or wsl if such a thing existed, but even then it might not be able to talk to my main Conda or share environments. Otherwise I could either trying using venv for an environment, as that appears to work in these shells through python, or just use the normal command prompt to do everything if I really want to use Conda.

Thanks for sticking with me! To get good at something, you have to get to the point where it's all plainly obvious, otherwise you run the risk of being lost and confused at a time you least want to be.

Edit: Now that I'm back at it, I rediscovered my original hurdle: the fact couldn't use Conda's command prompt straight from the VS Code or how to activate it once I booted the normal command prompt. Now I know about the .bat startup script at least and could in theory activate it that way each time, but it's kind of awkward, or I could launch a prompt externally and navigate to my working directory, but that's clumsy too. I forgot that this was my first blocker, and on a related note I had similar issues with x64 Native Tools (a Visual Studio based command prompt). I wondered what that was as well, why it looked like an independent terminal but I couldn't launch it in VS Code.

For WSL, yes you are right. Running the conda that you installed for windows would be the same as trying to run any other program that you installed for windows -> it will fail because the binaries are not compatible. You would probably be able to install the linux version there, but as you pointed out, that is not what you want.

For git bash, the solution is more simple than you might think. You can set it up so that you can "talk"to your windows installed conda. Yes, you will need to have the equivalent setup to what you have already discovered for cmd and powershell, but conda already has everything you need to set it up.

I now don't believe this is possible. From a naive user perspective, one sort of assumes they can run any program anywhere, and that makes sense or would have made sense before we had sub-systems and systems within systems, but from a more aware point of view, Anaconda was installed for Windows and inside the C:\ProgramData\Anaconda3 directory are .exe and .bat files, not Linux/WSL compatible binaries and .sh or .bash files. It's like trying to run Windows_OS>Linux subsystem>Windows_file_again, but it doesn't work like that. WSL and Git Bash don't even have the same path structure somehow

Git bash however, is not a subsystem at all. Instead, it is a port of bash for windows. That means when you are in your git bash, you are still within your windows environment. Only the syntax for paths and commands is different (see above commands I have provided), but you are still in the same system.

A command line interface (or CLI) is a program on your computer that processes text commands to do various tasks. Conda is a CLI program, which means it can only be used via the command line. On Windows computers, Anaconda recommends that you use the Anaconda Prompt CLI to work with conda. MacOS and Linux users can use their built-in command line applications.

If you installed Miniconda instead of Anaconda Distribution (see Should I use Anaconda Distribution or Miniconda?), Anaconda Navigator is not included. Use the command conda install anaconda-navigator to manually install Navigator onto your computer.

Learn to use Anaconda Navigator to launch an application. Then, create and run a simple Python program with Spyder and Jupyter Notebook. Watch our short training videos on Anaconda Learning to get up and running with Jupyter Notebook and JupyterLab, along with several other popular integrated development environments (IDEs):

Navigator and the CLI interact with conda in similar but distinct ways, and each have their benefits and drawbacks. Anaconda recommends that you learn the basics of both to determine what is preferable for your programming workflow. See My first Python program: Hello, Anaconda! to go through a short programming exercise and get a better idea for what you prefer.

Jupyter Notebook is a web-based development application that you can launch from Navigator. The resources below can help get you started and provide more information about using notebooks for your education, research, and work:

I want to manage my Envs via command prompt. What can I do? Usually, Anaconda installs a shortcut to the "Anaconda Prompt", which executes "%windir%\System32\cmd.exe "/K" C:\anaconda\Scripts\activate.bat C:\anaconda".

(I have a separate anaconda install under C:\anaconda so I need to be explicit about this. I know, this is not good, but I didn't really know Pro installs Miniconda when I installed Pro, and I absolutely can't lose the C:\anaconda install, so bear with me here.)

I have installed Anaconda on my Ubuntu 16.04 operating system. The instructions I was following seemed to think I would have a desktop icon, but I don't. I eventually found out that I needed to type anaconda-navigator in my terminal to open it.

I am now trying to open an anaconda prompt. The lack of search results on how to do so, leads me to believe that it's very trivial under normal circumstances. But I don't see any icon, and when I look for anaconda or prompt in my apps, Ubuntu returns nothing.

Reading this, you would think that I would still have to activate the base environment at terminal start since I did not type yes, but I did not have to do that, likely since I only updated an Anaconda installation with this step already done. After this update, the terminal always showed the (base) in front.

I have trained a model that works well for my data, but I have a lot of it and going through ever image and apply the model to the data is time consuming. Is there a way that I can use the command window in anaconda prompt to open a folder, go through every image and apply the masks, and then save the masks as a PNG file?

While primarily for QuPath (which is nice since it can generate intensity measurements and such, or just output masks), this video also has a section at the end that looks like it is more related to Fiji Cellpose installation for QuPath and Fiji - YouTube
Pretty sure CellProfiler can do this in batch as well.

c80f0f1006
Reply all
Reply to author
Forward
0 new messages