Failing to install Sk-learn (scikit-learn) in Google Colab directly from Github

SantoshGupta7 picture SantoshGupta7 · Jul 21, 2018 · Viewed 8.2k times · Source

I am using Google Colaboratory, which seems to have sk-learn built-in already somehow, because all you have to do to import the TSNE module is from sklearn.manifold import TSNE

I have forked a version of sklearn from their github that I am trying to install, but it is failing to install. To isolate the problem I am just trying to install sk-learn directly from Github, and figuring out why it is failing to install.

Here is the code I used

!pip install https://github.com/scikit-learn/scikit-learn/archive/master.zip

Here is the output

Collecting https://github.com/Santosh-Gupta/scikit-learn/archive/master.zip
  Downloading https://github.com/Santosh-Gupta/scikit-learn/archive/master.zip (6.6MB)
    100% |████████████████████████████████| 6.6MB 3.8MB/s 
Requirement already satisfied: numpy>=1.8.2 in /usr/local/lib/python3.6/dist-packages (from scikit-learn==0.20.dev0) (1.14.5)
Requirement already satisfied: scipy>=0.13.3 in /usr/local/lib/python3.6/dist-packages (from scikit-learn==0.20.dev0) (0.19.1)
Building wheels for collected packages: scikit-learn
  Running setup.py bdist_wheel for scikit-learn ... error
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-req-build-j3idof1a/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-wvc5lddz --python-tag cp36:
  Partial import of sklearn during the build process.
  blas_opt_info:
  blas_mkl_info:
  customize UnixCCompiler
    libraries mkl_rt not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
    NOT AVAILABLE

  blis_info:
  customize UnixCCompiler
    libraries blis not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
    NOT AVAILABLE

  openblas_info:
  customize UnixCCompiler
  customize UnixCCompiler
    libraries openblas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
    NOT AVAILABLE

  atlas_3_10_blas_threads_info:
  Setting PTATLAS=ATLAS
  customize UnixCCompiler
    libraries tatlas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu/atlas', '/usr/lib/x86_64-linux-gnu']
    NOT AVAILABLE

  atlas_3_10_blas_info:
  customize UnixCCompiler
    libraries satlas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu/atlas', '/usr/lib/x86_64-linux-gnu']
    NOT AVAILABLE

  atlas_blas_threads_info:
  Setting PTATLAS=ATLAS
  customize UnixCCompiler
    libraries ptf77blas,ptcblas,atlas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu/atlas', '/usr/lib/x86_64-linux-gnu']
    NOT AVAILABLE

  atlas_blas_info:
  customize UnixCCompiler
  get_default_fcompiler: matching types: '['gnu95', 'intel', 'lahey', 'pg', 'absoft', 'nag', 'vast', 'compaq', 'intele', 'intelem', 'gnu', 'g95', 'pathf95', 'nagfor']'
  customize Gnu95FCompiler
  Found executable /usr/bin/gfortran
  customize Gnu95FCompiler
  customize Gnu95FCompiler using config
  compiling '_configtest.c':

  /* This file is generated from numpy/distutils/system_info.py */
  void ATL_buildinfo(void);
  int main(void) {
    ATL_buildinfo();
    return 0;
  }

  C compiler: x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.6-sXpGnM/python3.6-3.6.3=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC

  compile options: '-c'
  x86_64-linux-gnu-gcc: _configtest.c
  x86_64-linux-gnu-gcc -pthread _configtest.o -lf77blas -lcblas -latlas -o _configtest
  ATLAS version 3.10.3 built by buildd on Tue Sep 19 15:17:33 UTC 2017:
     UNAME    : Linux lcy01-26 4.4.0-96-generic #119-Ubuntu SMP Tue Sep 12 14:59:54 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
     INSTFLG  : -1 0 -a 1 -l 1
     ARCHDEFS : -DATL_OS_Linux -DATL_ARCH_x86SSE2 -DATL_CPUMHZ=2600 -DATL_SSE2 -DATL_SSE1 -DATL_USE64BITS -DATL_GAS_x8664
     F2CDEFS  : -DAdd_ -DF77_INTEGER=int -DStringSunStyle
     CACHEEDGE: 1048576
     F77      : /usr/bin/gfortran, version GNU Fortran (Ubuntu 7.2.0-5ubuntu1) 7.2.0
     F77FLAGS : -g -O2 -fdebug-prefix-map=/build/atlas-jedIp7/atlas-3.10.3=. -fstack-protector-strong -m64 -fPIC
     SMC      : /usr/bin/gcc, version gcc (Ubuntu 7.2.0-5ubuntu1) 7.2.0
     SMCFLAGS : -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/build/atlas-jedIp7/atlas-3.10.3=. -fstack-protector-strong -m64 -fPIC
     SKC      : /usr/bin/gcc, version gcc (Ubuntu 7.2.0-5ubuntu1) 7.2.0
     SKCFLAGS : -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/build/atlas-jedIp7/atlas-3.10.3=. -fstack-protector-strong -m64 -fPIC
  success!
  removing: _configtest.c _configtest.o _configtest
  customize UnixCCompiler
  customize UnixCCompiler
    FOUND:
      language = c
      define_macros = [('HAVE_CBLAS', None), ('ATLAS_INFO', '"\\"3.10.3\\""')]
      libraries = ['f77blas', 'cblas', 'atlas', 'f77blas', 'cblas']
      library_dirs = ['/usr/lib/x86_64-linux-gnu']

    FOUND:
      language = c
      define_macros = [('HAVE_CBLAS', None), ('ATLAS_INFO', '"\\"3.10.3\\""')]
      libraries = ['f77blas', 'cblas', 'atlas', 'f77blas', 'cblas']
      library_dirs = ['/usr/lib/x86_64-linux-gnu']

  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-req-build-j3idof1a/setup.py", line 250, in <module>
      setup_package()
    File "/tmp/pip-req-build-j3idof1a/setup.py", line 246, in setup_package
      setup(**metadata)
    File "/usr/local/lib/python3.6/dist-packages/numpy/distutils/core.py", line 135, in setup
      config = configuration()
    File "/tmp/pip-req-build-j3idof1a/setup.py", line 140, in configuration
      config.add_subpackage('sklearn')
    File "/usr/local/lib/python3.6/dist-packages/numpy/distutils/misc_util.py", line 1024, in add_subpackage
      caller_level = 2)
    File "/usr/local/lib/python3.6/dist-packages/numpy/distutils/misc_util.py", line 993, in get_subpackage
      caller_level = caller_level + 1)
    File "/usr/local/lib/python3.6/dist-packages/numpy/distutils/misc_util.py", line 930, in _get_configuration_from_setup_py
      config = setup_module.configuration(*args)
    File "sklearn/setup.py", line 83, in configuration
      maybe_cythonize_extensions(top_path, config)
    File "/tmp/pip-req-build-j3idof1a/sklearn/_build_utils/__init__.py", line 74, in maybe_cythonize_extensions
      import Cython
  ModuleNotFoundError: No module named 'Cython'

  ----------------------------------------
  Failed building wheel for scikit-learn
  Running setup.py clean for scikit-learn
Failed to build scikit-learn
Installing collected packages: scikit-learn
  Found existing installation: scikit-learn 0.19.2
    Uninstalling scikit-learn-0.19.2:
      Successfully uninstalled scikit-learn-0.19.2
  Running setup.py install for scikit-learn ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-req-build-j3idof1a/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-i2vd3phi/install-record.txt --single-version-externally-managed --compile:
    Partial import of sklearn during the build process.
    blas_opt_info:
    blas_mkl_info:
    customize UnixCCompiler
      libraries mkl_rt not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
      NOT AVAILABLE

    blis_info:
    customize UnixCCompiler
      libraries blis not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
      NOT AVAILABLE

    openblas_info:
    customize UnixCCompiler
    customize UnixCCompiler
      libraries openblas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
      NOT AVAILABLE

    atlas_3_10_blas_threads_info:
    Setting PTATLAS=ATLAS
    customize UnixCCompiler
      libraries tatlas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu/atlas', '/usr/lib/x86_64-linux-gnu']
      NOT AVAILABLE

    atlas_3_10_blas_info:
    customize UnixCCompiler
      libraries satlas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu/atlas', '/usr/lib/x86_64-linux-gnu']
      NOT AVAILABLE

    atlas_blas_threads_info:
    Setting PTATLAS=ATLAS
    customize UnixCCompiler
      libraries ptf77blas,ptcblas,atlas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu/atlas', '/usr/lib/x86_64-linux-gnu']
      NOT AVAILABLE

    atlas_blas_info:
    customize UnixCCompiler
    get_default_fcompiler: matching types: '['gnu95', 'intel', 'lahey', 'pg', 'absoft', 'nag', 'vast', 'compaq', 'intele', 'intelem', 'gnu', 'g95', 'pathf95', 'nagfor']'
    customize Gnu95FCompiler
    Found executable /usr/bin/gfortran
    customize Gnu95FCompiler
    customize Gnu95FCompiler using config
    compiling '_configtest.c':

    /* This file is generated from numpy/distutils/system_info.py */
    void ATL_buildinfo(void);
    int main(void) {
      ATL_buildinfo();
      return 0;
    }

    C compiler: x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.6-sXpGnM/python3.6-3.6.3=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC

    compile options: '-c'
    x86_64-linux-gnu-gcc: _configtest.c
    x86_64-linux-gnu-gcc -pthread _configtest.o -lf77blas -lcblas -latlas -o _configtest
    ATLAS version 3.10.3 built by buildd on Tue Sep 19 15:17:33 UTC 2017:
       UNAME    : Linux lcy01-26 4.4.0-96-generic #119-Ubuntu SMP Tue Sep 12 14:59:54 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
       INSTFLG  : -1 0 -a 1 -l 1
       ARCHDEFS : -DATL_OS_Linux -DATL_ARCH_x86SSE2 -DATL_CPUMHZ=2600 -DATL_SSE2 -DATL_SSE1 -DATL_USE64BITS -DATL_GAS_x8664
       F2CDEFS  : -DAdd_ -DF77_INTEGER=int -DStringSunStyle
       CACHEEDGE: 1048576
       F77      : /usr/bin/gfortran, version GNU Fortran (Ubuntu 7.2.0-5ubuntu1) 7.2.0
       F77FLAGS : -g -O2 -fdebug-prefix-map=/build/atlas-jedIp7/atlas-3.10.3=. -fstack-protector-strong -m64 -fPIC
       SMC      : /usr/bin/gcc, version gcc (Ubuntu 7.2.0-5ubuntu1) 7.2.0
       SMCFLAGS : -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/build/atlas-jedIp7/atlas-3.10.3=. -fstack-protector-strong -m64 -fPIC
       SKC      : /usr/bin/gcc, version gcc (Ubuntu 7.2.0-5ubuntu1) 7.2.0
       SKCFLAGS : -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/build/atlas-jedIp7/atlas-3.10.3=. -fstack-protector-strong -m64 -fPIC
    success!
    removing: _configtest.c _configtest.o _configtest
    customize UnixCCompiler
    customize UnixCCompiler
      FOUND:
        language = c
        define_macros = [('HAVE_CBLAS', None), ('ATLAS_INFO', '"\\"3.10.3\\""')]
        libraries = ['f77blas', 'cblas', 'atlas', 'f77blas', 'cblas']
        library_dirs = ['/usr/lib/x86_64-linux-gnu']

      FOUND:
        language = c
        define_macros = [('HAVE_CBLAS', None), ('ATLAS_INFO', '"\\"3.10.3\\""')]
        libraries = ['f77blas', 'cblas', 'atlas', 'f77blas', 'cblas']
        library_dirs = ['/usr/lib/x86_64-linux-gnu']

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-req-build-j3idof1a/setup.py", line 250, in <module>
        setup_package()
      File "/tmp/pip-req-build-j3idof1a/setup.py", line 246, in setup_package
        setup(**metadata)
      File "/usr/local/lib/python3.6/dist-packages/numpy/distutils/core.py", line 135, in setup
        config = configuration()
      File "/tmp/pip-req-build-j3idof1a/setup.py", line 140, in configuration
        config.add_subpackage('sklearn')
      File "/usr/local/lib/python3.6/dist-packages/numpy/distutils/misc_util.py", line 1024, in add_subpackage
        caller_level = 2)
      File "/usr/local/lib/python3.6/dist-packages/numpy/distutils/misc_util.py", line 993, in get_subpackage
        caller_level = caller_level + 1)
      File "/usr/local/lib/python3.6/dist-packages/numpy/distutils/misc_util.py", line 930, in _get_configuration_from_setup_py
        config = setup_module.configuration(*args)
      File "sklearn/setup.py", line 83, in configuration
        maybe_cythonize_extensions(top_path, config)
      File "/tmp/pip-req-build-j3idof1a/sklearn/_build_utils/__init__.py", line 74, in maybe_cythonize_extensions
        import Cython
    ModuleNotFoundError: No module named 'Cython'

    ----------------------------------------
  Rolling back uninstall of scikit-learn
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-req-build-j3idof1a/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-i2vd3phi/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-req-build-j3idof1a/

I also tried the more traditional command

!pip install git+https://github.com/scikit-learn/scikit-learn.git

Which pretty much gives me the same results

Collecting git+https://github.com/scikit-learn/scikit-learn.git
  Cloning https://github.com/scikit-learn/scikit-learn.git to /tmp/pip-req-build-35q123ah
Requirement already satisfied: numpy>=1.8.2 in /usr/local/lib/python3.6/dist-packages (from scikit-learn==0.20.dev0) (1.14.5)
Requirement already satisfied: scipy>=0.13.3 in /usr/local/lib/python3.6/dist-packages (from scikit-learn==0.20.dev0) (0.19.1)
Building wheels for collected packages: scikit-learn
  Running setup.py bdist_wheel for scikit-learn ... error
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-req-build-35q123ah/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-mmpe1xku --python-tag cp36:
  Partial import of sklearn during the build process.
  blas_opt_info:
  blas_mkl_info:
  customize UnixCCompiler
    libraries mkl_rt not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
    NOT AVAILABLE

  blis_info:
  customize UnixCCompiler
    libraries blis not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
    NOT AVAILABLE

  openblas_info:
  customize UnixCCompiler
  customize UnixCCompiler
    libraries openblas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
    NOT AVAILABLE

  atlas_3_10_blas_threads_info:
  Setting PTATLAS=ATLAS
  customize UnixCCompiler
    libraries tatlas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu/atlas', '/usr/lib/x86_64-linux-gnu']
    NOT AVAILABLE

  atlas_3_10_blas_info:
  customize UnixCCompiler
    libraries satlas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu/atlas', '/usr/lib/x86_64-linux-gnu']
    NOT AVAILABLE

  atlas_blas_threads_info:
  Setting PTATLAS=ATLAS
  customize UnixCCompiler
    libraries ptf77blas,ptcblas,atlas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu/atlas', '/usr/lib/x86_64-linux-gnu']
    NOT AVAILABLE

  atlas_blas_info:
  customize UnixCCompiler
  get_default_fcompiler: matching types: '['gnu95', 'intel', 'lahey', 'pg', 'absoft', 'nag', 'vast', 'compaq', 'intele', 'intelem', 'gnu', 'g95', 'pathf95', 'nagfor']'
  customize Gnu95FCompiler
  Found executable /usr/bin/gfortran
  customize Gnu95FCompiler
  customize Gnu95FCompiler using config
  compiling '_configtest.c':

  /* This file is generated from numpy/distutils/system_info.py */
  void ATL_buildinfo(void);
  int main(void) {
    ATL_buildinfo();
    return 0;
  }

  C compiler: x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.6-sXpGnM/python3.6-3.6.3=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC

  compile options: '-c'
  x86_64-linux-gnu-gcc: _configtest.c
  x86_64-linux-gnu-gcc -pthread _configtest.o -lf77blas -lcblas -latlas -o _configtest
  ATLAS version 3.10.3 built by buildd on Tue Sep 19 15:17:33 UTC 2017:
     UNAME    : Linux lcy01-26 4.4.0-96-generic #119-Ubuntu SMP Tue Sep 12 14:59:54 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
     INSTFLG  : -1 0 -a 1 -l 1
     ARCHDEFS : -DATL_OS_Linux -DATL_ARCH_x86SSE2 -DATL_CPUMHZ=2600 -DATL_SSE2 -DATL_SSE1 -DATL_USE64BITS -DATL_GAS_x8664
     F2CDEFS  : -DAdd_ -DF77_INTEGER=int -DStringSunStyle
     CACHEEDGE: 1048576
     F77      : /usr/bin/gfortran, version GNU Fortran (Ubuntu 7.2.0-5ubuntu1) 7.2.0
     F77FLAGS : -g -O2 -fdebug-prefix-map=/build/atlas-jedIp7/atlas-3.10.3=. -fstack-protector-strong -m64 -fPIC
     SMC      : /usr/bin/gcc, version gcc (Ubuntu 7.2.0-5ubuntu1) 7.2.0
     SMCFLAGS : -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/build/atlas-jedIp7/atlas-3.10.3=. -fstack-protector-strong -m64 -fPIC
     SKC      : /usr/bin/gcc, version gcc (Ubuntu 7.2.0-5ubuntu1) 7.2.0
     SKCFLAGS : -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/build/atlas-jedIp7/atlas-3.10.3=. -fstack-protector-strong -m64 -fPIC
  success!
  removing: _configtest.c _configtest.o _configtest
  customize UnixCCompiler
  customize UnixCCompiler
    FOUND:
      language = c
      define_macros = [('HAVE_CBLAS', None), ('ATLAS_INFO', '"\\"3.10.3\\""')]
      libraries = ['f77blas', 'cblas', 'atlas', 'f77blas', 'cblas']
      library_dirs = ['/usr/lib/x86_64-linux-gnu']

    FOUND:
      language = c
      define_macros = [('HAVE_CBLAS', None), ('ATLAS_INFO', '"\\"3.10.3\\""')]
      libraries = ['f77blas', 'cblas', 'atlas', 'f77blas', 'cblas']
      library_dirs = ['/usr/lib/x86_64-linux-gnu']

  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-req-build-35q123ah/setup.py", line 250, in <module>
      setup_package()
    File "/tmp/pip-req-build-35q123ah/setup.py", line 246, in setup_package
      setup(**metadata)
    File "/usr/local/lib/python3.6/dist-packages/numpy/distutils/core.py", line 135, in setup
      config = configuration()
    File "/tmp/pip-req-build-35q123ah/setup.py", line 140, in configuration
      config.add_subpackage('sklearn')
    File "/usr/local/lib/python3.6/dist-packages/numpy/distutils/misc_util.py", line 1024, in add_subpackage
      caller_level = 2)
    File "/usr/local/lib/python3.6/dist-packages/numpy/distutils/misc_util.py", line 993, in get_subpackage
      caller_level = caller_level + 1)
    File "/usr/local/lib/python3.6/dist-packages/numpy/distutils/misc_util.py", line 930, in _get_configuration_from_setup_py
      config = setup_module.configuration(*args)
    File "sklearn/setup.py", line 83, in configuration
      maybe_cythonize_extensions(top_path, config)
    File "/tmp/pip-req-build-35q123ah/sklearn/_build_utils/__init__.py", line 74, in maybe_cythonize_extensions
      import Cython
  ModuleNotFoundError: No module named 'Cython'

  ----------------------------------------
  Failed building wheel for scikit-learn
  Running setup.py clean for scikit-learn
Failed to build scikit-learn
Installing collected packages: scikit-learn
  Found existing installation: scikit-learn 0.19.2
    Uninstalling scikit-learn-0.19.2:
      Successfully uninstalled scikit-learn-0.19.2
  Running setup.py install for scikit-learn ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-req-build-35q123ah/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-d1gnws67/install-record.txt --single-version-externally-managed --compile:
    Partial import of sklearn during the build process.
    blas_opt_info:
    blas_mkl_info:
    customize UnixCCompiler
      libraries mkl_rt not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
      NOT AVAILABLE

    blis_info:
    customize UnixCCompiler
      libraries blis not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
      NOT AVAILABLE

    openblas_info:
    customize UnixCCompiler
    customize UnixCCompiler
      libraries openblas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
      NOT AVAILABLE

    atlas_3_10_blas_threads_info:
    Setting PTATLAS=ATLAS
    customize UnixCCompiler
      libraries tatlas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu/atlas', '/usr/lib/x86_64-linux-gnu']
      NOT AVAILABLE

    atlas_3_10_blas_info:
    customize UnixCCompiler
      libraries satlas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu/atlas', '/usr/lib/x86_64-linux-gnu']
      NOT AVAILABLE

    atlas_blas_threads_info:
    Setting PTATLAS=ATLAS
    customize UnixCCompiler
      libraries ptf77blas,ptcblas,atlas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu/atlas', '/usr/lib/x86_64-linux-gnu']
      NOT AVAILABLE

    atlas_blas_info:
    customize UnixCCompiler
    get_default_fcompiler: matching types: '['gnu95', 'intel', 'lahey', 'pg', 'absoft', 'nag', 'vast', 'compaq', 'intele', 'intelem', 'gnu', 'g95', 'pathf95', 'nagfor']'
    customize Gnu95FCompiler
    Found executable /usr/bin/gfortran
    customize Gnu95FCompiler
    customize Gnu95FCompiler using config
    compiling '_configtest.c':

    /* This file is generated from numpy/distutils/system_info.py */
    void ATL_buildinfo(void);
    int main(void) {
      ATL_buildinfo();
      return 0;
    }

    C compiler: x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.6-sXpGnM/python3.6-3.6.3=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC

    compile options: '-c'
    x86_64-linux-gnu-gcc: _configtest.c
    x86_64-linux-gnu-gcc -pthread _configtest.o -lf77blas -lcblas -latlas -o _configtest
    ATLAS version 3.10.3 built by buildd on Tue Sep 19 15:17:33 UTC 2017:
       UNAME    : Linux lcy01-26 4.4.0-96-generic #119-Ubuntu SMP Tue Sep 12 14:59:54 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
       INSTFLG  : -1 0 -a 1 -l 1
       ARCHDEFS : -DATL_OS_Linux -DATL_ARCH_x86SSE2 -DATL_CPUMHZ=2600 -DATL_SSE2 -DATL_SSE1 -DATL_USE64BITS -DATL_GAS_x8664
       F2CDEFS  : -DAdd_ -DF77_INTEGER=int -DStringSunStyle
       CACHEEDGE: 1048576
       F77      : /usr/bin/gfortran, version GNU Fortran (Ubuntu 7.2.0-5ubuntu1) 7.2.0
       F77FLAGS : -g -O2 -fdebug-prefix-map=/build/atlas-jedIp7/atlas-3.10.3=. -fstack-protector-strong -m64 -fPIC
       SMC      : /usr/bin/gcc, version gcc (Ubuntu 7.2.0-5ubuntu1) 7.2.0
       SMCFLAGS : -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/build/atlas-jedIp7/atlas-3.10.3=. -fstack-protector-strong -m64 -fPIC
       SKC      : /usr/bin/gcc, version gcc (Ubuntu 7.2.0-5ubuntu1) 7.2.0
       SKCFLAGS : -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/build/atlas-jedIp7/atlas-3.10.3=. -fstack-protector-strong -m64 -fPIC
    success!
    removing: _configtest.c _configtest.o _configtest
    customize UnixCCompiler
    customize UnixCCompiler
      FOUND:
        language = c
        define_macros = [('HAVE_CBLAS', None), ('ATLAS_INFO', '"\\"3.10.3\\""')]
        libraries = ['f77blas', 'cblas', 'atlas', 'f77blas', 'cblas']
        library_dirs = ['/usr/lib/x86_64-linux-gnu']

      FOUND:
        language = c
        define_macros = [('HAVE_CBLAS', None), ('ATLAS_INFO', '"\\"3.10.3\\""')]
        libraries = ['f77blas', 'cblas', 'atlas', 'f77blas', 'cblas']
        library_dirs = ['/usr/lib/x86_64-linux-gnu']

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-req-build-35q123ah/setup.py", line 250, in <module>
        setup_package()
      File "/tmp/pip-req-build-35q123ah/setup.py", line 246, in setup_package
        setup(**metadata)
      File "/usr/local/lib/python3.6/dist-packages/numpy/distutils/core.py", line 135, in setup
        config = configuration()
      File "/tmp/pip-req-build-35q123ah/setup.py", line 140, in configuration
        config.add_subpackage('sklearn')
      File "/usr/local/lib/python3.6/dist-packages/numpy/distutils/misc_util.py", line 1024, in add_subpackage
        caller_level = 2)
      File "/usr/local/lib/python3.6/dist-packages/numpy/distutils/misc_util.py", line 993, in get_subpackage
        caller_level = caller_level + 1)
      File "/usr/local/lib/python3.6/dist-packages/numpy/distutils/misc_util.py", line 930, in _get_configuration_from_setup_py
        config = setup_module.configuration(*args)
      File "sklearn/setup.py", line 83, in configuration
        maybe_cythonize_extensions(top_path, config)
      File "/tmp/pip-req-build-35q123ah/sklearn/_build_utils/__init__.py", line 74, in maybe_cythonize_extensions
        import Cython
    ModuleNotFoundError: No module named 'Cython'

    ----------------------------------------
  Rolling back uninstall of scikit-learn
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-req-build-35q123ah/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-d1gnws67/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-req-build-35q123ah/

From what I have looked up, it seems that the biggest issue in failing to install is the dependencies are not installed. However, Google Colab seems to have all of it installed. In fact, sk-learn already seems to be installed.

When I run this line

!pip install -U scikit-learn

The output is

Requirement already up-to-date: scikit-learn in /usr/local/lib/python3.6/dist-packages (0.19.2)

Answer

SantoshGupta7 picture SantoshGupta7 · Jul 22, 2018

The issue was that I needed to install Cython. I'm not sure why this is since Cython seems to be already installed, but adding this line of code worked

!pip install Cython

Also if you're following this advice, don't forget to uninstall sk-learn first and then reload whatever modules you're using.

For example

!pip uninstall sklearn -y
!pip install Cython
!pip install https://github.com/Santosh-Gupta/scikit-learn/archive/master.zip

import importlib
import sklearn.manifold
importlib.reload(sklearn.manifold)
from sklearn.manifold import TSNE