Problems Installing Scipy and Sklearn

I am quite new into programming and I am struggling much to install scipy with the errors. I did not had any problems installing other libraries:

Failed cleaning build dir for scipy

and

Failed building wheel for scipy

With sklearn I am facing the problem :

Failed building wheel for scikit-learn

just found this info on the web regarding this issue :

pip does not work well for Windows because the standard pip package index site, PyPI, does not yet have Windows wheels for some packages, such as SciPy. via

In case this is correct , how can I solve it ?

4

3 Answers

Installing these packages on Windows requires a compiler. Instead, I would recommend you visit Christoph Gohlke's Unofficial Windows Binaries for Python Extension Packages, where he has already built the wheels for you.

Once you download the wheel, you can install using pip. For example:

pip install numpy‑1.12.1+mkl‑cp36‑cp36m‑win_amd64.whl

An alternative is to install Anaconda.

This worked for me

pip install --pre --extra-index scikit-learn

I encountered the issue and tried various solutions from the web, but all failed, so bad...

Finally, I solved it by:

$ python3 -m pip install --upgrade pip
  • the following way is not recommended (?)
    pip3 install --upgrade pip
    

Root cause:

  • The pip tool is too old.
    • Before the upgrade, the pip version was 9.0.1 .
    • After the upgrade, the pip version is 20.0.3 .
    • Hence, you can check your pip version by
      $ pip --version  # for python2
      $ pip3 --version # for python3
      
      and try to upgrade the pip tool to fix it

Scenario:

  • Dockerfile, ubuntu:16.04, ubuntu:18.04, docker build, python3

References

  • Installing scikit-learn
    $ sudo apt-get install python3-sklearn python3-sklearn-lib python3-sklearn-doc
    
    • for global, not for virtualenv
James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article