Q:

conda update scikit-learn (also scipy and numpy)

I think I have made a mess using pip install when I am supposed to use conda. As a result I couldn't update the scikit-learn package to the latest version. I uninstalled scikit-learn with both conda and pip, and then installed again using conda but now I have issue import sklearn:
Python 2.7.11 |Anaconda custom (x86_64)| (default, Dec  6 2015, 18:57:58) 
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org

from sklearn import metrics
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/bowang/anaconda/lib/python2.7/site-packages/sklearn/metrics/__init__.py", line 7, in <module>
    from .ranking import auc
ImportError: No module named ranking 

Also there seems to be confusions with which version of sklearn/numpy/scipy it actually uses:
$ conda update scikit-learn
Using Anaconda Cloud api site https://api.anaconda.org
Fetching package metadata: ......
Solving package specifications: .........

# All requested packages already installed.
# packages in environment at /Users/bowang/anaconda:
#
scikit-learn              0.15.2               np18py27_0    http://repo.continuum.io/pkgs/free/osx-64/scikit-learn-0.15.2-np18py27_0.tar.bz2

$ conda update scipy
Using Anaconda Cloud api site https://api.anaconda.org
Fetching package metadata: ......
Solving package specifications: .........

# All requested packages already installed.
# packages in environment at /Users/bowang/anaconda:
#
scipy                     0.14.0               np18py27_0    http://repo.continuum.io/pkgs/free/osx-64/scipy-0.14.0-np18py27_0.tar.bz2

Above shows I still can't update to the latest versions but:
$ python
Python 2.7.11 |Anaconda custom (x86_64)| (default, Dec  6 2015, 18:57:58) 
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import scipy
>>> scipy.__version__
'0.17.0'
>>> import numpy
>>> numpy.__version__
'1.11.0'
>>> import sklearn
>>> sklearn.__version__
'0.17.1'

Is there a way to clean up and resolve all the confusions here and allow me to update and thus use the latest versions of sklearn/numpy/scipy? Thanks!

A:

It looks like the versions reported by conda do not match the versions you're importing when you run Python. This makes me think that you've installed these packages in multiple places, and have your $PYTHONPATH variable set so that Python is finding different installations (sometimes installing some toolkit will add this in your bash/sh startup script) Try running
$ echo $PYTHONPATH

If anything is shown here, find your startup script and comment that out.
After making sure that $PYTHONPATH is empty, try the following:
$ conda update conda  # make sure package listing is up-to-date
$ conda remove numpy scipy scikit-learn
$ conda install scikit-learn

That has generally worked for me in the past.

