6

I am using the latest Anaconda Navigator (for Python 3.9), and I know how to make a new environment with Python 3.11 in Anaconda. However, whenever I create a new environment, there are hardly any packages there. The base has all the packages I need and when I try a new environment with Python 11, I always run into silly problems like basic packages such as pandas not being there.

To update python to 3.11 in the base environment, I have tried everything I could find online. I went into the environment in Anaconda, typed in Python and clicked "mark for specific version update" for 3.11, and when I did I was met with the infamous "The following packages will be modified" box and it was blank for a long time. I also tried Choco and that did not work. I also tried some stuff in command line but to no avail.

Essentially what I want is to either update the base to 3.11 or have a new environment where there's all the base packages and 3.11. If only the point and click updating in Anaconda worked!

Johnn-1231
  • 85
  • 1
  • 1
  • 5
  • I came across the same issue and in the end gave up on Anaconda. I installed Python 3.11 and Jupyter directly and then all the packages I actually use using PIP. Works without problems and easy to keep up to date with PIP. – user19077881 Jan 23 '23 at 23:54
  • @user19077881 you could have just used `pip` with your anaconda installation. – juanpa.arrivillaga Jan 24 '23 at 00:06
  • So, the best way is to keep track of individual `environment.yml` files specifying each environment. If you are just dumping everything into the base environment (which sort of defeats the purpose of using virtual environments) you can always export a specification using `conda env export --no-builds > environment.yml`, this will be messier than a hand kept file, but you can use it to create a new environment with the same dependencies. – juanpa.arrivillaga Jan 24 '23 at 00:08
  • you can try to add the `--from-history` tag to `conda env export` as well, as this just puts the libraries that you "specifically asked for", which will be less messy. So all in all, `conda env export --from-history --no-builds > environment.yml` – juanpa.arrivillaga Jan 24 '23 at 00:13

2 Answers2

3

Anaconda is not yet (as of 23 January 2023) building for Python 3.11 (see the Anaconda Cloud builds of anaconda). When it is finally building, one could create a new environment with

## not functional yet
conda create -n anaconda_py311 python=3.11 anaconda

However, Conda Forge has mostly completed its Python 3.11 migration of packages, so pretty much everything one would want is available through that. That is, you cannot use the anaconda package, but instead must explicitly specify the packages you require, such as

conda create -n py311 -c conda-forge python=3.11 scikit-learn pandas scipy

including whatever additional packages you desire.

merv
  • 67,214
  • 13
  • 180
  • 245
3

Conda allows you to install a new version of python within or for a given environment. For example, to update Python to 3.11 (or any other version) in the current environment do:

conda install -c conda-forge python=3.11

To update python for another environment just do:

conda install -n _env-name_-c conda-forge python=3.11 

Notes:

  • -c conda-forge is optional.
  • you can verify the version of python installed by python --version
  • upgrading the python distribution will trigger updates/downgrades of several packages, review the update plan carefully.
  • beware of compatibility issues.
damian sa
  • 31
  • 6