6

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.

  • 1
    Have you tried `pip install -U scikit-learn`? This is what they suggest on their website. – ufoxDan Nov 07 '19 at 21:26
  • I have and should have added that - I've also tried again just now to be sure. Will add to question. It did result in the same error message. Thanks! – Ray's Web Presence Nov 07 '19 at 21:31
  • 1
    Can you please try `pip install --upgrade pip` then try installing again? – ufoxDan Nov 07 '19 at 21:35
  • This also didn't work, although my pip is now upgraded. I also ran the command `pip install --upgrade setuptools`, as I ran into an error afterward and came across that as a proposed solution – Ray's Web Presence Nov 07 '19 at 22:06

3 Answers3

6

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!

ufoxDan
  • 559
  • 2
  • 12
  • Looks like that's the route I'll go. Was excited for the walrus operator, but alas - thanks! Will definitely fuss about in the environment variables and get that part working. – Ray's Web Presence Nov 07 '19 at 22:35
3

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

Alex Baranowski
  • 859
  • 9
  • 20
0

Try this in command prompt:

py -m pip install -U scikit-learn
Ruli
  • 2,184
  • 10
  • 21
  • 30
sami
  • 1
  • Is it possible to add an explanation on the given command? Use [edit](https://stackoverflow.com/posts/65451897/edit) to add more details. – Ruli Dec 25 '20 at 21:33