16

How can I update Python in the Anaconda base environment? Is Python intended to be upgradable in the base environment at all, or should one completely remove and reinstall Anaconda? Any version will eventually go out of support, so there should be some solution.

What I have tried so far, and did not result in Python getting updated:

  • conda update --all
  • conda update python and conda update anaconda
  • conda install python=3.9 or conda install anaconda=2021.11 do not finish after an hour and a half.
  • mamba install python=3.9 results in "package python_abi-3.7-2_cp37m requires python 3.7.*, but none of the providers can be installed"
  • No other suggestion is put forward here.
Szabolcs
  • 24,728
  • 9
  • 85
  • 174
  • https://stackoverflow.com/questions/57701571/what-is-the-right-way-to-update-anaconda-and-conda-base-environments – Niels Perfors Jan 23 '22 at 09:35
  • Maybe you can check the answer here [https://stackoverflow.com/questions/41535881/how-do-i-upgrade-to-python-3-6-with-conda] – Suvo Jan 23 '22 at 09:35
  • @NielsPerfors What suggestion is found there that I did not already list above? – Szabolcs Jan 23 '22 at 09:37
  • The Python in **base** not meant to be updated beyond patches. I recommend remove (after dumping other environments to YAML), then install Mambaforge, and stop using **base** for work (just activate the environment you want as default in your `~/.bash_profile`). However, if you'd like to continue trying to push the in-place upgrade, maybe try `mamba install python=3.9 anaconda=2021.11 conda=4.11`? If that still snags, you'd probably have to hack the `conda-meta/history` to remove the constraints that are stopping things (only advanced users should ever touch this file!). – merv Jan 23 '22 at 15:23
  • 1
    @merv Thanks! I was not aware that environments could be backed up to a YAML file. I will reinstall everything, and will install miniconda. At this point it seems like the least painful thing. – Szabolcs Jan 23 '22 at 15:39
  • Does this answer your question? [How do I upgrade to Python 3.6 with conda?](https://stackoverflow.com/questions/41535881/how-do-i-upgrade-to-python-3-6-with-conda) – Fato39 Jan 26 '23 at 14:02
  • @Fato39 I already explained why the suggestions in the answers you linked did not work. – Szabolcs Jan 26 '23 at 14:21
  • I realize that `conda install python=3.9` might not work, which is why the answer to this question should be "You should not." I added an answer to try and explain it. – Fato39 Jan 27 '23 at 10:50

4 Answers4

5

Official documentation by Anaconda advises against upgrading to another major version of Python. It mentions the method you have already tried:

conda install python=3.9

but the process did not finish for you. This is in line with their documentation which says:

It is not recommended, rather it is preferable to create a new environment. The resolver has to work very hard to determine exactly which packages to upgrade.

Instead, you should create a new environment as suggested by the documentation and answers to this question.

conda create -n py39 python=3.9 anaconda
Fato39
  • 746
  • 1
  • 11
  • 26
2

In the base environment, run mamba update python --no-pin (of course, you could do it with conda, but then you're up for a long wait!).

mrgou
  • 1,576
  • 2
  • 21
  • 45
  • Would you link to some documentation on this? `mamba` does not seem to be part of the `anaconda` installation by default. – rudolfbyker May 15 '23 at 07:11
0

I had a similar problem:

conda install anaconda=2022.10 resulted in unresolvable conflicts, conda install python=3.9 as well.

I finally managed to update by specifying both requirements within the same update command:

conda install anaconda=2022.10 python=3.9
taylorSeries
  • 505
  • 2
  • 6
  • 18
mitja
  • 61
  • 8
0
  1. Open the Anaconda prompt by searching for it in the start menu or by running "anaconda-prompt" in the command prompt.

Run this command in the Anaconda prompt to update the base environment: conda update --all

S.Rodgers
  • 13
  • 3