TransWikia.com

Not able to install latest version of scikit-learn

Super User Asked on November 27, 2020

I am working on Debian Stable Linux with Python version 3.7.3 which is otherwise working very well. I have scikit-learn (sklearn) version 0.22.2 installed and I want to upgrade it to latest version 0.23

I am using following commands but they are not working:

$ python3 -m pip install --user scikit-learn 
Requirement already satisfied: scikit-learn in /home/abcd/.local/lib/python3.7/site-packages (0.22.2)
Requirement already satisfied: joblib>=0.11 in /home/abcd/.local/lib/python3.7/site-packages (from scikit-learn) (0.14.1)
Requirement already satisfied: numpy>=1.11.0 in /home/abcd/.local/lib/python3.7/site-packages (from scikit-learn) (1.18.1)
Requirement already satisfied: scipy>=0.17.0 in /home/abcd/.local/lib/python3.7/site-packages (from scikit-learn) (1.4.1)


$ python3 -m pip install --user sklearn
Requirement already satisfied: sklearn in /home/abcd/.local/lib/python3.7/site-packages (0.0)
Requirement already satisfied: scikit-learn in /home/abcd/.local/lib/python3.7/site-packages (from sklearn) (0.22.2)
Requirement already satisfied: joblib>=0.11 in /home/abcd/.local/lib/python3.7/site-packages (from scikit-learn->sklearn) (0.14.1)
Requirement already satisfied: scipy>=0.17.0 in /home/abcd/.local/lib/python3.7/site-packages (from scikit-learn->sklearn) (1.4.1)
Requirement already satisfied: numpy>=1.11.0 in /home/abcd/.local/lib/python3.7/site-packages (from scikit-learn->sklearn) (1.18.1)

Where is the problem and how can it be solved?

Note: pip is also upgraded to the latest version.

As pointed out in comments, output of pip show command:

$ python3 -m pip show scikit-learn
Name: scikit-learn
Version: 0.22.2
Summary: A set of python modules for machine learning and data mining
Home-page: http://scikit-learn.org
Author: None
Author-email: None
License: new BSD
Location: /home/abcd/.local/lib/python3.7/site-packages
Requires: joblib, scipy, numpy
Required-by: yellowbrick, tsfresh, sklearn, pingouin, MindsDB, lightwood

2 Answers

I am using following commands but they are not working:

$ python3 -m pip install --user scikit-learn
[...]
$ python3 -m pip install --user sklearn

When updating an existing, installed Python package with pip install, you should typically include the --upgrade (-U) option e.g.:

python3 -m pip install --upgrade --user scikit-learn

python3 -m pip install --upgrade --user sklearn

This option automates the process of uninstalling the prior version of the package and then collects and installs the most recent version available to pip.

Technically, you can also uninstall the package yourself with pip uninstall before using pip install, but using the --upgrade option saves a step.


Depending on your needs, it is also possible to use the --ignore-installed (-I) option (which simply ignores any installed packages and overwrites them). But this can break your system depending on the circumstances and shouldn't be used for general upgrades.


Correct answer by Anaksunaman on November 27, 2020

You can try installing it from Debian packages archive. Open terminal and run:

sudo apt-get update
sudo apt-get install python3-sklearn python3-sklearn-lib

Answered by Ruby on November 27, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP