38

I installed scikit-learn from GitHub a couple of weeks ago:

pip install git+git://github.com/scikit-learn/scikit-learn@master

I went to GitHub and there have been several changes to the master branch since then.

How can I update my local installation of scikit-learn?

I tried pip install scikit-learn --upgrade but I got:

Requirement already up-to-date
Cleaning up ...
Amelio Vazquez-Reina
  • 91,494
  • 132
  • 359
  • 564

4 Answers4

30

pip searches for the library in the Python package index. Your version is newer than the newest one in there, so pip won't update it.

You'll have to reinstall from Git:

$ pip install git+git://github.com/scikit-learn/scikit-learn@main
adrin
  • 4,511
  • 3
  • 34
  • 50
Blender
  • 289,723
  • 53
  • 439
  • 496
  • Thanks. I presume that I need to uninstall the package then first? The odd thing is that pip could in principle remember that I got this from the git repository in first place, right? Is there a design decision behind this? – Amelio Vazquez-Reina Jul 17 '13 at 21:57
  • 5
    @user815423426: Pip will just upgrade the package. – Blender Jul 17 '13 at 21:58
  • @user815423426: As for the auto-upgrade, I have no clue. From what I can tell, Pip just packages the module into an egg and installs it. I'm sure it's possible to have it store the download URL somewhere, but I don't personally know if that's just a missing feature or a conscious design choice. – Blender Jul 17 '13 at 22:01
  • 6
    You don't need to uninstall the package, it will do it itself. – Alexis Métaireau Jul 17 '13 at 22:23
  • 13
    you don't need the -U flag for upgrade? – user25064 Jul 13 '15 at 11:46
  • 4
    I would strongly recomment to uninstall before re-installing. It occured to me that a newly committed file did not come forward and lost time looking around. – Wtower Dec 01 '15 at 23:58
  • if you use anaconda, having the git packages in an environment file will allow you to update everything by simply updating the whole environment using the file. See this answer: https://stackoverflow.com/questions/19042389/conda-installing-upgrading-directly-from-github/32799944#32799944 – Dschoni Sep 10 '18 at 10:12
22

You need to install the version from github, or locally.

The way I usually do is that I git clone the repository locally and I run python setup.py install or python setup.py develop on it so I'm sure about the version being used.

Re-issuing the command you've done the first time with the upgrade flag would do the trick otherwise.:

pip install --upgrade git+git://github.com/scikit-learn/scikit-learn@main
adrin
  • 4,511
  • 3
  • 34
  • 50
Alexis Métaireau
  • 10,767
  • 5
  • 24
  • 34
13

What worked for me was to use --force-reinstall:

pip install --force-reinstall --no-deps git+git://github.com/scikit-learn/scikit-learn@main

--no-deps to avoid reinstalling all the dependencies

Smart Manoj
  • 5,230
  • 4
  • 34
  • 59
Michael Litvin
  • 3,976
  • 1
  • 34
  • 40
0

IIRC, Pip installs based on pypi. If you want to upgrade to the version that is currently hosted on github, then you are going to have to use the url from github.

Games Brainiac
  • 80,178
  • 33
  • 141
  • 199