conda update scikit-learn (also scipy and numpy)

前端 未结 2 582
北海茫月
北海茫月 2021-01-18 16:36

I think I have made a mess using pip install when I am supposed to use conda. As a result I couldn\'t update the scikit-learn package to the latest version. I uninstalled sc

相关标签:
2条回答
  • 2021-01-18 17:11

    It looks like the versions reported by conda do not match the versions you're importing when you run Python. This makes me think that you've installed these packages in multiple places, and have your $PYTHONPATH variable set so that Python is finding different installations (sometimes installing some toolkit will add this in your bash/sh startup script) Try running

    $ echo $PYTHONPATH
    

    If anything is shown here, find your startup script and comment that out. After making sure that $PYTHONPATH is empty, try the following:

    $ conda update conda  # make sure package listing is up-to-date
    $ conda remove numpy scipy scikit-learn
    $ conda install scikit-learn
    

    That has generally worked for me in the past.

    0 讨论(0)
  • 2021-01-18 17:24

    Note: Don't use pip command if you are using Anaconda or Miniconda

    I tried following commands:

    !conda update conda 
    !pip install -U scikit-learn
    

    It will install the required packages also will show in the conda list but if you try to import that package it will not work.

    On the website http://scikit-learn.org/stable/install.html it is mentioned as: Warning To upgrade or uninstall scikit-learn installed with Anaconda or conda you should not use the pip.

    Following Worked for me for scikit-learn on Anaconda-Jupyter Notebook.

    Upgrading my scikit-learn from 0.19.1 to 0.19.2 in anaconda installed on Ubuntu on Google VM instance:

    Run the following commands in the terminal:

    First, check existing available packages with versions by using:

    conda list    
    

    It will show different packages and their installed versions in the output. Here check for scikit-learn. e.g. for me, the output was:

    scikit-learn              0.19.1           py36hedc7406_0  
    

    Now I want to Upgrade to 0.19.2 July 2018 release i.e. latest available version.

    conda config --append channels conda-forge
    conda install scikit-learn=0.19.2
    

    Now check the required version of the scikit-learn is installed correctly or not by using:

    conda list 
    

    For me the Output was:

    scikit-learn              0.19.2          py36_blas_openblasha84fab4_201  [blas_openblas]  conda-forge
    
    0 讨论(0)
提交回复
热议问题