1

I have sklearn 0.19 installed on my computer thanks to

> conda install scikit-learn=0.19

and the terminal says

# All requested packages already installed.
# packages in environment at /home/pierre/anaconda3:
...

but when I do this in Spyder:

print('The scikit-learn version is {}.'.format(sklearn.__version__))

it still shows

The scikit-learn version is 0.17.1.

What should I do to make Spyder use the correct version of sklearn?

More informations:

I have Python 2.7 installed in Spyder.

I don't see the interpreter icon when I go in "Tools":

MSeifert
  • 145,886
  • 38
  • 333
  • 352
MysteryGuy
  • 1,091
  • 2
  • 18
  • 43

1 Answers1

2

You're probably using another Python interpreter in Spyder, one which has an old scikit-learn version installed.

The easiest solution is to use the Spyder in the environment where you also have the new scikit-learn version. Check if it's installed using:

$ conda install spyder

Then start the spyder from that environment.


Alternatively you could also set the interpreter of your Spyder to the environment where you have the new scikit-learn:

To change the interpreter used by Spyder (partially based on this post on "How to change python version in anaconda spyder") you need to open the "Tools" -> "Preferences" (or using the keyboard shortcut: Ctrl + Alt + Shift + P):

enter image description here

and select your Python interpreter in the section "Python interpreter" -> "Use the following interpreter":

enter image description here

MSeifert
  • 145,886
  • 38
  • 333
  • 352
  • Actually, it is Python 3.5 but when I change , I have a warning message saying that it's a risk because Spyder is executed with Python 2 and indeed, after that the script does not run – MysteryGuy Aug 25 '17 at 12:49