Explain Codes LogoExplain Codes Logo

How do I update Anaconda?

python
conda
package-management
environment-management
Anton ShumikhinbyAnton Shumikhin·Oct 7, 2024
TLDR

Perform the 'update-conda trifecta' by executing the following commands:

# Update Conda, the ground control to your package rocket conda update conda # Update all installed packages in the current Anaconda environment conda update --all # Update Anaconda distribution for a journey in a package galaxy far far away conda update anaconda

These commands ensure that Conda itself, all installed packages, and the Anaconda distribution are updated. Mac users, welcome aboard. For Windows users, remember to run Anaconda Prompt as Administrator to enjoy seamless updates.

Straight to code: Essential commands

To keep your Anaconda up-to-date and working flawlessly, you should get familiar with these commands:

Update Conda itself

# Who can best get rid of Conda's wrinkles? Conda itself! conda update -n base conda

Use environments to control package versions

# Create a new environment faster than Thanos can snap fingers conda create --name myenv

When the base environment refuses to cooperate, clone an environment:

# If one environment fails, its clone is ready to rescue conda create --clone myenv --name myenv_clone

Update individual packages

Different strokes for different folks. Update a specific package via the command line:

# Single package's spa treatment conda update <package_name>

For Pip packages, the Pip guy is your best friend:

# Pip says, 'No package left behind!' pip install --upgrade <package_name>

Install a specific version of Anaconda

# Anaconda time machine ride! conda install anaconda=version_number

Deep dive: Understanding and troubleshooting

The "custom" label mystery solved

When updating Anaconda, a "custom" label can suddenly appear. Stay calm and continue with the mission:

# Jedi command against the dark force of "custom" label conda update anaconda

Too much updating with "conda update --all"

conda update --all might lead to better things, or cause unstable environments. Keep checking and use back-ups:

# Going apocalyptic? Turn back time: conda list --revisions conda install --revision X

Save some disk space with Conda environments

Using package cache and file linking, Conda environments are very efficient:

# Give your disk a break, let Conda do the heavy lifting! conda create --name mynewenv

Ensuring complete updates

# The 'Twice-as-Sure' mantra to ensure all packages are up-to-date conda update conda conda update anaconda