安装scikit-learn问题

柳俊彦
2023-12-01

1.问题描述如下:
---------------------------------------------------------------------------------------------------------------------------------

(pytorch) [root@cento ~]# conda install scikit-learn

Solving environment: failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/linux-64/repodata.json>
Elapsed: -

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
SSLError(MaxRetryError('HTTPSConnectionPool(host=\'mirrors.tuna.tsinghua.edu.cn\', port=443): Max retries exceeded with url: /anaconda/cloud/conda-forge/linux-64/repodata.json (Caused by SSLError(SSLError("bad handshake: Error([(\'SSL routines\', \'ssl3_get_server_certificate\', \'certificate verify failed\')])")))'))
---------------------------------------------------------------------------------------------------------------------------------

2.解决方法:
=========================================================================

2.1 删除清华源,恢复默认源:
(pytorch) [root@cento ~]# conda config --remove-key channels


2.2 使用conda安装sklearn
(pytorch) [root@cento ~]# conda install scikit-learn
Solving environment: | 
Warning: 4 possible package resolutions (only showing differing packages):
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main::certifi-2021.5.30-py37h06a4308_0, https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main::openssl-1.1.1l-h7f8727e_0
  - defaults::certifi-2021.5.30-py37h06a4308_0, https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main::openssl-1.1.1l-h7f8727e_0
  - defaults::openssl-1.1.1l-h7f8727e_0, https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main::certifi-2021.5.30-py37h06a4308_0
  - defaults::certifi-2021.5.30-py37h06a4308_0, defaults::openssl-1.1.1l-h7f8727edone


==> WARNING: A newer version of conda exists. <==
  current version: 4.5.11
  latest version: 4.10.3

Please update conda by running

    $ conda update -n base -c defaults conda

## Package Plan ##

  environment location: /usr/anaconda3/envs/pytorch

  added / updated specs: 
    - scikit-learn


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    scikit-learn-0.24.2        |   py37ha9443f7_0         7.1 MB  defaults
    ca-certificates-2021.9.30  |       h06a4308_1         123 KB  defaults
    libgfortran-ng-7.3.0       |       hdf63c60_0         1.3 MB  defaults
    joblib-1.0.1               |     pyhd3eb1b0_0         207 KB  defaults
    scipy-1.6.2                |   py37h91f5cce_0        19.9 MB  defaults
    threadpoolctl-2.2.0        |     pyh0d69192_0          16 KB  defaults
    ------------------------------------------------------------
                                           Total:        28.6 MB

The following NEW packages will be INSTALLED:

    joblib:          1.0.1-pyhd3eb1b0_0    defaults                                               
    libgfortran-ng:  7.3.0-hdf63c60_0      defaults                                               
    scikit-learn:    0.24.2-py37ha9443f7_0 defaults                                               
    scipy:           1.6.2-py37h91f5cce_0  defaults                                               
    threadpoolctl:   2.2.0-pyh0d69192_0    defaults                                               

The following packages will be UPDATED:

    ca-certificates: 2021.7.5-h06a4308_1   https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main --> 2021.9.30-h06a4308_1 defaults

Proceed ([y]/n)? y


Downloading and Extracting Packages
scikit-learn-0.24.2  | 7.1 MB    | ############################## | 100% 
ca-certificates-2021 | 123 KB    | ########################## | 100% 
libgfortran-ng-7.3.0 | 1.3 MB    | ################################## | 100% 
joblib-1.0.1         | 207 KB    | ######################################### | 100% 
scipy-1.6.2          | 19.9 MB   |################################### | 100% 
threadpoolctl-2.2.0  | 16 KB     | ###################################### | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: / 

    Installed package of scikit-learn can be accelerated using scikit-learn-intelex.
    More details are available here: https://intel.github.io/scikit-learn-intelex

    For example:

        $ conda install scikit-learn-intelex
        $ python -m sklearnex my_application.py

    

done
=======================================

 类似资料: