Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying to Install Sklearn on Python 3.8 Gives an Error

I'm trying to install sklearn (scikit-learn) on Python 3.8 on Windows 10 using the following:

pip install sklearn

I've also used:

pip3 install sklearn

pip install scikit-learn 

pip install -U scikit-learn 

As well as:

pip install --only-binary :all: sklearn

I've also tried upgrading pip/setuptools.

There is a long block of errors; among them, the portion which seems to be relevant mentions Fortran:

  customize GnuFCompiler
  Could not locate executable g77
  Could not locate executable f77
  customize IntelVisualFCompiler
  Could not locate executable ifort
  Could not locate executable ifl
  customize AbsoftFCompiler
  Could not locate executable f90
  customize CompaqVisualFCompiler
  Could not locate executable DF
  customize IntelItaniumVisualFCompiler
  Could not locate executable efl
  customize Gnu95FCompiler
  Could not locate executable gfortran
  Could not locate executable f95
  customize G95FCompiler
  Could not locate executable g95
  customize IntelEM64VisualFCompiler
  customize IntelEM64TFCompiler
  Could not locate executable efort
  Could not locate executable efc
  customize PGroupFlangCompiler
  Could not locate executable flang
  don't know how to compile Fortran code on platform 'nt'
    NOT AVAILABLE

Another part of the error:

No module named 'numpy.distutils._msvccompiler' in numpy.distutils;

I'm just wondering if this is because of the newness of 3.8? Is there a workaround anyone is aware of?

It seems to revolve around NumPy. I've uninstalled that package and reinstalled it.

like image 243
Ray's Web Presence Avatar asked Nov 07 '19 21:11

Ray's Web Presence


2 Answers

Just found this GitHub issue saying the following (16 days ago):

Python 3.8 is not officially supported by NumPy yet. We strongly suggest you stick with python 3.7 for now, until you see a 3.8 designation in the "Programming Language" section of the PyPI numpy page (probably several weeks) or until an Anaconda release with Python 3.8 is available (probably several months)

So it looks like it might be the underlying dependencies just not working with 3.8 yet. I actually had a similar issue with another package last week. You will probably have luck if you get a 3.7.5 install. Make sure you get the right platform (x86 for 32-bit, x64 for 64 bit) and make sure you check the box to add it to your path.

I'm guessing you're on Windows yes? If so then after the install open a powershell and enter gcm python and gcm pip to make sure they are being pulled from the 3.7 install. If not, you'll have to edit PATH in the system environment variables and move the new Python37 directory before Python38 in your PATH.

Hope that solves the issue!

like image 144
ufoxDan Avatar answered Sep 18 '22 12:09

ufoxDan


Try to run pip install --pre -f https://sklearn-nightly.scdn8.secure.raxcdn.com scikit-learn. It worked for me.

like image 45
Ayesha Majid Ali Avatar answered Sep 21 '22 12:09

Ayesha Majid Ali