How to use Anaconda?

78 views Asked by At

I am in Windows 10 and I need to switch between Python environments. I found there is a program named "Anaconda" for that.

After installing the heavy (1GB) Anaconda installer, with default options the command prompt still does not recognize conda command.

I searched and then found there should be "Anaconda Prompt", so I did Windows search on that, however, no chance:

The only way I was able to launch something that recognizes this program is opening the Anaconda Navigator, that proposed me an update, and it's still loading that.

Is there a simple way to switch between Python environments?

3

There are 3 answers

1
Heliton Martins On

Yes, you can add Anaconda (or miniconda, whatever) to your PATH. On Windows, search for "Path" on Start menu, and select "Edit environment variables for your account". Then, on the top square, select Path, and click Edit.... Then add the path to your conda's Scripts folder. You'll need to check your installation, mine is: C:\Users\<USERNAME>\miniconda3\Scripts (changing <USERNAME> to my actual username.

This will bring conda into scope for new terminals. Then run conda init.

NOTE: miniconda is just Anaconda without all its huge library of pre bundled packages. The only difference (apart from the installed size) is that you need to install with conda install or pip install any packages you want. Generally speaking, Anaconda is unecessary for most users.

7
tripleee On

Anaconda is not simple. If you are looking for a simple way to switch between Python versions or environments, maybe look at pyenv.

On Windows, there is also the py wrapper which lets you select which of one or more installed Python versions to use.

Any nontrivial software installation requires you to understand how the PATH works, and do basic troubleshooting. We have hundreds of previous questions about that topic; see e.g. Adding a directory to the PATH environment variable in Windows for your immediate problem.

What Anaconda provides is a package manager which handles complex dependencies. It is fairly popular in the scientific community, where you frequently need to manage complex interdependencies between third-party libraries, application suites, and scripts. If that's what you actually need, godspeed; but for merely managing your Python installation, it is arguably overkill.

0
serge On

I installed micromamba as Alexey suggested.

  1. Installation in PowerShell:

    Invoke-Expression ((Invoke-WebRequest -Uri https://micro.mamba.pm/install.ps1).Content)
    
  2. set MAMBA_ROOT_PREFIX to c:\micromamba

    micromamba -r c:\micromamba
    

and was able finally to get

micromamba create -n myenv
micromamba activate myenv