pythonscikit-learnupgrade

scikit-learn doesn't upgrade


I am trying to upgrade my scikit-learn package. My current version is 1.0.2. I'm following the installation instruction here: https://scikit-learn.org/stable/install.html#install-official-release

I am trying to upgrade by:

pip install -U scikit-learn

This give the following messages in the terminal:

(nec37) xyz@VUSELNX-51ZNMR2:~/PycharmProjects/Xyz(master)$ pip install -U scikit-learn
Requirement already satisfied: scikit-learn in /home/miniconda3/envs/nec37/lib/python3.7/site-packages (1.0.2)
Requirement already satisfied: threadpoolctl>=2.0.0 in /home/miniconda3/envs/nec37/lib/python3.7/site-packages (from scikit-learn) (3.1.0)
Requirement already satisfied: joblib>=0.11 in /home/miniconda3/envs/nec37/lib/python3.7/site-packages (from scikit-learn) (1.3.2)
Requirement already satisfied: numpy>=1.14.6 in /home/miniconda3/envs/nec37/lib/python3.7/site-packages (from scikit-learn) (1.21.6)
Requirement already satisfied: scipy>=1.1.0 in /home/miniconda3/envs/nec37/lib/python3.7/site-packages (from scikit-learn) (1.7.3)

The same happens when I also use: pip3 install -U scikit-learn

The version still remains the same:

(nec37) xyz@VUSELNX-51ZNMR2:~/PycharmProjects/xyz(master)$ python -c "import sklearn;
 print(sklearn.__version__)"
1.0.2

How to upgrade it?

Update
when I try:

pip install -I -U scikit-learn

I get the following with no upgrade.

Installing collected packages: threadpoolctl, numpy, joblib, scipy, scikit-learn
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
hdbscan 0.8.28 requires cython>=0.27, which is not installed.
Successfully installed joblib-1.3.2 numpy-1.21.6 scikit-learn-1.0.2 scipy-1.7.3 threadpoolctl-3.1.0

(ims37) C:\Users\xyz\PycharmProjects\peakpickingdilemma>python -c "import sklearn; print(sklearn.__version__)"
1.0.2

Solution

  • The last version of scikit-learn to support Python 3.7, is 1.0.2, according to PyPI.

    If you want to use a newer version of scikit-learn, you'll have to use a more recent version of Python.

    (I usually go to the PyPI page of the package, select "Release history", then pick the most recent bug-fix release of every major.minor version, and scroll down to check the supported Python versions listed on the left-hand side. There's probably a better way, but this work for a quick scan of compatible releases.)


    Perhaps an obvious note, but Python 3.7 was end-of-life mid 2023; there are no security fixes for it since then.

    If you have to use Python 3.7, then expect you'll also have to use older package versions. You're essentially timetravelling to the past, and shouldn't expect newer packages to be able to be used.