33

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)

jeffhale
  • 3,759
  • 7
  • 40
  • 56
Techie5879
  • 516
  • 1
  • 5
  • 13

2 Answers2

30

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.

Peter
  • 10,959
  • 2
  • 30
  • 47
  • Ah okay, so this basically creates a virtual environment right? I see – Techie5879 Oct 11 '21 at 10:09
  • 1
    @Techie5879, not exactly. It creates a [conda environment](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html), 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 folder – Diogo Feb 04 '22 at 15:30
  • 11
    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). – CN_Cabbage Apr 09 '22 at 04:28
  • 6
    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. – Elliott Collins Apr 16 '22 at 02:04
  • 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. – Peter Apr 16 '22 at 20:09
  • 1
    Is there a way for updating normal base or any other enviroment to 3.10 instead of creating new one – Sarper Makas Aug 19 '22 at 16:27
  • In general yes: https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#updating-an-environment – Peter Aug 19 '22 at 16:39
  • 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. – Hafez Ahmad Oct 31 '22 at 16:44
18

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

Victor Maricato
  • 672
  • 8
  • 25
  • 1
    Secon command doesn't work. It gives me: `CondaError: Invalid spec for 'conda update': python=3.10 Use 'conda install' instead.` – Banik Apr 04 '22 at 18:15
  • 9
    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/ – CN_Cabbage Apr 09 '22 at 04:31
  • 3
    I try this but even for hours it didn't finish its faileds lots of times and starts to resolve enviroment. – Sarper Makas Aug 19 '22 at 16:28
  • The issues you're seeing with Solving Environment taking too long may be addressed here: https://stackoverflow.com/questions/63734508/stuck-at-solving-environment-on-anaconda – Victor Maricato Sep 06 '22 at 16:28
  • 1
    A lot of conflicts like this: Package spyder conflicts for. – keramat Feb 01 '23 at 05:38
  • 1
    Try using ```mamba``` instead of ```conda``` as the former performs better than the latter. – ajthealchemist Apr 29 '23 at 16:35