How do I update Anaconda?

前端 未结 12 1616
慢半拍i
慢半拍i 2020-11-29 14:15

I have Anaconda installed on my computer and I\'d like to update it. In Navigator I can see that there are several individual packages that can be updated, but also an

相关标签:
12条回答
  • 2020-11-29 14:43

    On Mac, open a terminal and run the following two commands.

    conda update conda
    conda update anaconda
    

    Make sure to run each command multiple times to update to the current version.

    0 讨论(0)
  • 2020-11-29 14:44

    root is the old (pre-conda 4.4) name for the main environment; after conda 4.4, it was renamed to be base. source

    What 95% of people actually want

    In most cases what you want to do when you say that you want to update Anaconda is to execute the command:

    conda update --all
    

    (But this should be preceeded by conda update -n base conda so you have the latest conda version installed)

    This will update all packages in the current environment to the latest version -- with the small print being that it may use an older version of some packages in order to satisfy dependency constraints (often this won't be necessary and when it is necessary the package plan solver will do its best to minimize the impact).

    This needs to be executed from the command line, and the best way to get there is from Anaconda Navigator, then the "Environments" tab, then click on the triangle beside the base environment, selecting "Open Terminal":

    This operation will only update the one selected environment (in this case, the base environment). If you have other environments you'd like to update you can repeat the process above, but first click on the environment. When it is selected there is a triangular marker on the right (see image above, step 3). Or from the command line you can provide the environment name (-n envname) or path (-p /path/to/env), for example to update your dspyr environment from the screenshot above:

    conda update -n dspyr --all
    

    Update individual packages

    If you are only interested in updating an individual package then simply click on the blue arrow or blue version number in Navigator, e.g. for astroid or astropy in the screenshot above, and this will tag those packages for an upgrade. When you are done you need to click the "Apply" button:

    Or from the command line:

    conda update astroid astropy
    

    Updating just the packages in the standard Anaconda Distribution

    If you don't care about package versions and just want "the latest set of all packages in the standard Anaconda Distribution, so long as they work together", then you should take a look at this gist.

    Why updating the Anaconda package is almost always a bad idea

    In most cases updating the Anaconda package in the package list will have a surprising result: you may actually downgrade many packages (in fact, this is likely if it indicates the version as custom). The gist above provides details.

    Leverage conda environments

    Your base environment is probably not a good place to try and manage an exact set of packages: it is going to be a dynamic working space with new packages installed and packages randomly updated. If you need an exact set of packages then create a conda environment to hold them. Thanks to the conda package cache and the way file linking is used doing this is typically i) fast and ii) consumes very little additional disk space. E.g.

    conda create -n myspecialenv -c bioconda -c conda-forge python=3.5 pandas beautifulsoup seaborn nltk
    

    The conda documentation has more details and examples.

    pip, PyPI, and setuptools?

    None of this is going to help with updating packages that have been installed from PyPI via pip or any packages installed using python setup.py install. conda list will give you some hints about the pip-based Python packages you have in an environment, but it won't do anything special to update them.

    Commercial use of Anaconda or Anaconda Enterprise

    It is pretty much exactly the same story, with the exception that you may not be able to update the base environment if it was installed by someone else (say to /opt/anaconda/latest). If you're not able to update the environments you are using you should be able to clone and then update:

    conda create -n myenv --clone base
    conda update -n myenv --all
    
    0 讨论(0)
  • 2020-11-29 14:48

    Use:

    conda create -n py37 -c anaconda anaconda=5.3.1
    conda env export -n py37 --file env.yaml
    

    Locate the env.yaml file in C:\Windows\System32 and run the cmd as administrator:

    conda env update -n root -f env.yaml
    

    Then it works!

    0 讨论(0)
  • 2020-11-29 14:49

    I'm using Windows 10. The following updates everything and also installs some new packages, including a Python update (for me it was 3.7.3).

    At the shell, try the following (be sure to change where your Anaconda 3 Data is installed). It takes some time to update everything.

    conda update --prefix X:\XXXXData\Anaconda3 anaconda
    
    0 讨论(0)
  • 2020-11-29 14:57

    Here's the best practice (in my humble experience). Selecting these four packages will also update all other dependencies to the appropriate versions that will help you keep your environment consistent. The latter is a common problem others have expressed in earlier responses. This solution doesn't need the terminal.

    0 讨论(0)
  • 2020-11-29 14:58

    Open Anaconda cmd in base mode:

    Then use conda update conda to update Anaconda.

    You can then use conda update --all to update all the requirements for Anaconda:

    conda update conda
    conda update --all
    
    0 讨论(0)
提交回复
热议问题