Search code examples
pythonpipanacondapypi

Does conda update packages from pypi installed using pip install?


I use Anaconda (because it is awesome), and the packages available through conda install are quite extensive. However now and then I do need to install a package that isn't available in the conda repositories, and so get it from pypi instead.

My question: when I run the command conda update --all, will conda also update these pypi packages? Or do I have to update them separately? The conda docs don't seem to contain an answer to this. This question and answer seems to indicate that no, conda does not manage pypi packages, but I'm still uncertain.


Solution

  • No, conda update and conda install don't update packages installed with pip (or install them using pip).

    These conda commands only check your "default" anaconda-channels or the ones specified with -c, they ignore everything else. One exception is conda list which shows also the packages installed with pip, these are marked with <pip> and won't be updated.

    One example using pip and six:

    $ conda create -n testenv python=3.5
    Fetching package metadata .................
    Solving package specifications: .
    
    Package plan for installation in environment testenv:
    
    The following NEW packages will be INSTALLED:
    
        pip:            9.0.1-py35_1
        python:         3.5.3-3
        setuptools:     27.2.0-py35_1
        vs2015_runtime: 14.0.25123-0
        wheel:          0.29.0-py35_0
    
    Proceed ([y]/n)? y
    
    $ activate testenv
    

    Installing six with pip (old version):

    (testenv) $ pip install six==1.6
    Collecting six==1.6
      Downloading six-1.6.0-py2.py3-none-any.whl
    Installing collected packages: six
    Successfully installed six-1.6.0
    

    conda update doesn't update it (note that six isn't listed in the "all requested packages" but it's listed in conda list):

    (testenv) $ conda update --all
    Fetching package metadata .................
    Solving package specifications: .
    
    # All requested packages already installed.
    # packages in environment at testenv:
    #
    pip                       9.0.1                    py35_1
    python                    3.5.3                         3
    setuptools                27.2.0                   py35_1
    vs2015_runtime            14.0.25123                    0
    wheel                     0.29.0                   py35_0
    
    (testenv) $ conda list
    # packages in environment at testenv:
    #
    pip                       9.0.1                    py35_1
    python                    3.5.3                         3
    setuptools                27.2.0                   py35_1
    six                       1.6.0                     <pip>
    vs2015_runtime            14.0.25123                    0
    wheel                     0.29.0                   py35_0
    

    But it can be upgraded with pip:

    (testenv) $ pip install six --upgrade
    Collecting six
      Using cached six-1.10.0-py2.py3-none-any.whl
    Installing collected packages: six
      Found existing installation: six 1.6.0
        Uninstalling six-1.6.0:
          Successfully uninstalled six-1.6.0
    Successfully installed six-1.10.0
    

    Just to show that there is a newer version of six in the anaconda channel (which was ignored when I did conda update):

    (testenv) $ conda install six
    Fetching package metadata .................
    Solving package specifications: .
    
    Package plan for installation in environment testenv:
    
    The following NEW packages will be INSTALLED:
    
        six: 1.10.0-py35_0
    
    Proceed ([y]/n)?