How do I upgrade to Python 3.6 with conda?

517,070

Solution 1

Anaconda has not updated python internally to 3.6.

a) Method 1

  1. If you wanted to update you will type conda update python

  2. To update anaconda type conda update conda

  3. If you want to upgrade between major python version like 3.5 to 3.6, you'll have to do

     conda install python=$pythonversion$
    

b) Method 2 - Create a new environment (Better Method)

conda create --name py36 python=3.6

c) To get the absolute latest python(3.6.5 at time of writing)

conda create --name py365 python=3.6.5 --channel conda-forge

You can see all this from here

Also, refer to this for force upgrading

EDIT: Anaconda now has a Python 3.6 version here

Solution 2

Creating a new environment will install python 3.6:

$ conda create --name 3point6 python=3.6
Fetching package metadata .......
Solving package specifications: ..........

Package plan for installation in environment /Users/dstansby/miniconda3/envs/3point6:

The following NEW packages will be INSTALLED:

    openssl:    1.0.2j-0     
    pip:        9.0.1-py36_1 
    python:     3.6.0-0      
    readline:   6.2-2        
    setuptools: 27.2.0-py36_0
    sqlite:     3.13.0-0     
    tk:         8.5.18-0     
    wheel:      0.29.0-py36_0
    xz:         5.2.2-1      
    zlib:       1.2.8-3 

Solution 3

I found this page with detailed instructions to upgrade Anaconda to a major newer version of Python (from Anaconda 4.0+). First,

conda update conda
conda remove argcomplete conda-manager

I also had to conda remove some packages not on the official list:

  • backports_abc
  • beautiful-soup
  • blaze-core

Depending on packages installed on your system, you may get additional UnsatisfiableError errors - simply add those packages to the remove list. Next, install the version of Python,

conda install python==3.6

which takes a while, after which a message indicated to conda install anaconda-client, so I did

conda install anaconda-client

which said it's already there. Finally, following the directions,

conda update anaconda

I did this in the Windows 10 command prompt, but things should be similar in Mac OS X.

Solution 4

In the past, I have found it quite difficult to try to upgrade in-place.

Note: my use-case for Anaconda is as an all-in-one Python environment. I don't bother with separate virtual environments. If you're using conda to create environments, this may be destructive because conda creates environments with hard-links inside your Anaconda/envs directory.

So if you use environments, you may first want to export your environments. After activating your environment, do something like:

conda env export > environment.yml

After backing up your environments (if necessary), you may remove your old Anaconda (it's very simple to uninstall Anaconda):

$ rm -rf ~/anaconda3/

and replace it by downloading the new Anaconda, e.g. Linux, 64 bit:

$ cd ~/Downloads
$ wget https://repo.continuum.io/archive/Anaconda3-4.3.0-Linux-x86_64.sh 

(see here for a more recent one),

and then executing it:

$ bash Anaconda3-4.3.0-Linux-x86_64.sh 

Solution 5

I'm using a Mac OS Mojave

These 4 steps worked for me.

  1. conda update conda
  2. conda install python=3.6
  3. conda install anaconda-client
  4. conda update anaconda
Share:
517,070

Related videos on Youtube

Aryaman
Author by

Aryaman

Updated on January 05, 2022

Comments

  • Aryaman
    Aryaman over 2 years

    I'm new to Conda package management and I want to get the latest version of Python to use f-strings in my code. Currently my version is (python -V):

    Python 3.5.2 :: Anaconda 4.2.0 (x86_64)
    

    How would I upgrade to Python 3.6?

    • ericmjl
      ericmjl about 7 years
      The second answer is, I think, the better answer, especially for those who have a "master"/"default" environment in which the latest and greatest is continually updated.
    • Charlie Parker
      Charlie Parker about 3 years
      delete original env, create new env with the right python version with original name and re-run your installation script e.g. install.sh
  • darthbith
    darthbith over 7 years
    Unless Continuum have changed how conda operates, you cannot upgrade major Python versions by conda update python. See here: conda.pydata.org/docs/py2or3.html#update-or-upgrade-python
  • Jonah Graham
    Jonah Graham about 7 years
    If your conda installation is for Python 2.7 then conda create will create a 2.7 version. changing command to conda create --name 3point6 python=3 (adding =3 at the end) makes a python3 version.
  • David Stansby
    David Stansby about 7 years
    It will indeed. I've changed my answer to specify python 3.6!
  • Tim Richardson
    Tim Richardson over 6 years
    conda install python=$pythonversion$ e.g. conda install python=3.6
  • fredrik
    fredrik over 5 years
    conda update python just took me from 3.6.5 to 3.7.0. Neat!
  • Hansang
    Hansang over 4 years
    FYI method a) works for changing between different versions of python as well, as long as it doesn't break any dependencies within the venv
  • n1000
    n1000 over 4 years
    @fredrik conda update python bricked my conda installation.
  • ncmathsadist
    ncmathsadist over 3 years
    It works. It will use "flexible solve" when solving the environment. Thanks.
  • Charlie Parker
    Charlie Parker about 3 years
    your solution makes me have to install all my old packages again from scratch. You should mention how to get around that. The title says upgrade so that is a sensible expectation for a good answer.
  • Charlie Parker
    Charlie Parker about 3 years
    your solution makes me have to install all my old packages again from scratch. You should mention how to get around that. The title says upgrade so that is a sensible expectation for a good answer.
  • Andres Silva
    Andres Silva almost 3 years
    I believe it is conda update conda not conda update anaconda.
  • alelom
    alelom almost 3 years
    page link now broken.
  • Bill
    Bill over 2 years
    This worked fine for me (upgraded from 3.6 -> 3.9 within an environment with many packages in it). Not sure what all the other complicated answers are for. Thanks.