Can I update to Python 3.9 or 3.10 in Anaconda base (root)?
Asked Answered
A

4

37

Is there any way to update the current conda base (root) environment, which has Python 3.8.11 currently to Python 3.9 or 3.10? I know using a new virtual environment is the recommended way to go, but I still want to learn how to do it.

I tried using conda install python=3.9 and conda install python=3.10, which is recommended by a few posts a few years ago, but they didn't work and I ended up with the following error

Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: -
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed

Also, using conda update python only changed the micro version number (I think it upgraded from Python 3.8.10 to 3.8.11)

Aromaticity answered 11/10, 2021 at 9:24 Comment(0)
S
33

According to your error message you can't upgrade conda base to python 3.10 since this would lead to incompatibilities. (Supposedly there are some issues with the numpy package.) So you'll have to wait for the next Anaconda release.

However, the whole point of conda is using virtual environments:

conda create --name py10 python=3.10 

This allows you to install Python 3.10 right away.

Sipes answered 11/10, 2021 at 10:6 Comment(8)
Ah okay, so this basically creates a virtual environment right? I seeAromaticity
@Techie5879, not exactly. It creates a conda environment, which is located in the conda envs folder, by default. Normally, as long as I understand, common virtual environments may be located in the projects folderSignor
Is there a way to change py3.10 as the base (root) rather than 3.8? Since it's not available to update the python version in base (root).Retarded
Is there some resources to explain why it's best practice to create a different virtual environment for every new version of python like this? It seems like having a functional, up-to-date base environment has a lot of advantages.Waffle
Python is open source, and the packages are developed by 1000's of different software developers with different quality standards. There's no guarantee that all the packages work together seamlessly. Hence conda/pip provide a dependency management and conda/venv provide segregated virtual environments. This is crucial if you are working with multiple projects which are using a different combination of packages. If you are just just using Python for your homework you can probably live with just one Python base installation. After all your unit tests will warn you in case of inconsistencies.Sipes
Is there a way for updating normal base or any other enviroment to 3.10 instead of creating new oneServing
In general yes: conda.io/projects/conda/en/latest/user-guide/tasks/…Sipes
I strongly agree with the above comments. I have tried many times same things. I can move using the python virtual environment. Still, eventually, you have to come back again to the older version if you work with different packages because there is no guarantee you will get all packages that are compatible with 3.10. You have to wait until the next release. And You will not get significant accuracy by moving 3.9 to 3.10. I suggest you, please stay in python 3.9 and wait for the next release; otherwise, you can use the latest python base, whatever you want.Ode
M
26

Just do

conda update python and you should be fine. If you want specifically 3.10, you can do conda install python="3.10".

This will update your current environment version

Melodeemelodeon answered 22/3, 2022 at 20:13 Comment(7)
Secon command doesn't work. It gives me: CondaError: Invalid spec for 'conda update': python=3.10 Use 'conda install' instead.Celin
I use conda install python=3.10 It takes unresonable time and errors: Solving environment: failed with initial frozen solve. Retrying with flexible solve. Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source. Solving environment: failed with initial frozen solve. Retrying with flexible solve. Solving environment: - Found conflicts! Looking for incompatible packages. This can take several minutes. Press CTRL-C to abort. Examining conflict for _anaconda_depends openpyxl anaconda: 1%| | 3/361 [08/Retarded
I try this but even for hours it didn't finish its faileds lots of times and starts to resolve enviroment.Serving
The issues you're seeing with Solving Environment taking too long may be addressed here: #63735008Melodeemelodeon
A lot of conflicts like this: Package spyder conflicts for.Blowhole
Try using mamba instead of conda as the former performs better than the latter.Wysocki
Note that you can also specify a subversion, for example: conda install python=3.11.5Sebastian
R
3

The answer by @victormaricato is correct. "conda update python". I have used "conda update python" several times on the "base" environment. You should be fine. You must be patient because you are updating the foundation of your installation. It once took me 2.5 hours and it finally completed without error. A couple other times it failed because of too many conflicts.

If you NEED 3.10, you can do "conda install python='3.10'".

If you MUST, you can force v3.10 into your base using "conda install 'python=3.10' --force-reinstall". However, you risk corrupting your "base" environment. (Think of all those other car parts that depend on the earlier version of the car engine!)

Imagine trying to rip out an entire boiler room from under New York City streets!! Replacing the runtime engine in a virtual environment has MAJOR impact, because everything else depends on it.

The BEST practice is to create a new environment, leave your base alone and use it for administering other project-specific environments.

Don't pollute your base with too much stuff, because you need to use that to administer everything else.

You should always do a "conda update conda" first. Then do a "conda update --all". Then do your "conda update python".

You want to make sure conda is always the latest version, because they fix bugs and speed it up routinely. Once in a while there can be some specific conflict with conda itself, but that does not last long.

As someone else suggested, Mamba is faster, and 100% command-compatible with conda.

See Conda Command Reference

Mamba Reference Documentation Mamba installation and usage

Mamba installation from Anaconda

Raymond answered 17/11, 2023 at 21:34 Comment(0)
P
0

Use

mamba install -y python=3.10

its saves time, energy and life when you compare it with coda which takes ages

Pomfret answered 18/7, 2024 at 9:10 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.