Explain Codes LogoExplain Codes Logo

How can I run Conda?

tools
conda-installation
bashrc
environment-variables
Alex KataevbyAlex Kataev·Feb 10, 2025
TLDR
Execute **`conda activate`** to run your base Conda environment. For a different environment, use **`conda activate myenv`**, replacing 'myenv' with your environment's name. Verify installation with **`conda --version`**. If Conda commands fail, initialize with **`conda init`** or add Conda to PATH.

Adjust PATH for Conda

Your PATH is like the compass that points programs (like Conda) around your system. If conda isn't recognized, update your compass with the following (for Anaconda 3):

export PATH=~/anaconda3/bin:$PATH # Time for Conda to know its way home

To make it persistent, add this command to ~/.bashrc or ~/.bash_profile files. If you're using Z shell, add it to .zshrc instead. Now, run:

source ~/.bashrc # Bash into the new session

or

source ~/.bash_profile # Grab the profile and run

Anaconda 4 users can simply use the 'Anaconda Prompt' for all Conda commands.

Validate your installation

Before exploring Conda, ensure it’s properly installed and ready to go by:

conda --version # What's your version, Houston?

Facing an issue like "conda: command not found"? This indicates you need to check your shell files, then add the Conda bin directory to your PATH.

Initialization best practices

When initializing with conda init, always ensure any previous Conda configurations are cleared. Use the verbosity and dry run flags to preview what changes conda init would make with:

conda init --dry-run --verbose # Time for a Conda check

Confirmed all is well? Proceed to add the bin directory to your PATH manually, or using conda init.

Z shell compatibility

For Z shell users, update the .zshrc with PATH and source .zshrc to apply the changes.

Anaconda Navigator: Your GUI

Check if Anaconda Navigator is installed with:

conda install anaconda-navigator # Buckle up for an amazing GUI journey

It provides GUI for managing Conda environments and packages. No need to remember all those commands!

OS-specific Anaconda

Remember to install the appropriate Anaconda version specific to your Operating system.

Tuning with Conda version

For version controls like Conda version 4.6.9, use the --reverse flag for cleanup during shell initialization, allowing for a smooth launch.

Monitor to avoid hiccups

Finally, keep monitoring your environment. Ensure that your PATH is properly set up by running conda --v or conda --version to verify the installation.