Luca
Luca

Reputation: 1810

Update python in base conda environment

I have a clean Anaconda installation that, for some reason, came with Python 3.8.8, while I know the latest stable release should be 3.10. If I run

conda update python

I'm asked if I want to install 3.8.12.

I know I can create a new environment with

conda create -n py310 python=3.10

However I'd like to "replace" the base 3.8.8 environment with a new 3.10 one. Is it possible to update python in the base environment? If not, can I create a new environment and then replace the base environment with the new one?

Upvotes: 5

Views: 6353

Answers (3)

Iamgroot
Iamgroot

Reputation: 96

Try using

conda activate base
conda install python=3.n

Upvotes: 1

Chr1s
Chr1s

Reputation: 288

You shouldn't worry much about the base environment. For any serious work, you should rather create a dedicated conda environment, because the base environment needs to contain all the dependencies of conda itself which might be in conflict with what you want to install.

In case you're working in any kind of container I would anyway strongly suggest to use a more lightweight installation method for your environment than conda.

And if you only need one environment, you also don't need the feature of the separate environments. You can for example install a plain Python 3.10 or 3.11 from python.org and simply use pip to install the packages you need.

Upvotes: 1

darthbith
darthbith

Reputation: 19597

I think this is a deliberate choice in conda, to keep on the same minor version of Python. If you would like to update to a new minor version, you can do

conda install python=3.X

However, Python 3.10 may not be a good choice (or even possible) in your base environment, because it is possible that not all dependencies have been built for 3.10 yet. You'll probably have better luck with Python 3.9.

Upvotes: 2

Related Questions