Errors during install sklearn.

When I pip2 install sklearn, it shows "Command “/usr/bin/python -u -c “import setuptools, tokenize;file=’/tmp/pip-build-TxAjBz/scipy/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-xSjDxM-record/install-record.txt --single-version-externally-managed --compile --user --prefix=” failed with error code 1 in /tmp/pip-build-TxAjBz/scipy/
".
Follow instructions in this forum, I have installed scipy using sudo pip install python-scipy.
https://devtalk.nvidia.com/default/topic/1049426/jetson-nano/using-pip3-pip-to-install-scipy-will-be-stuck/

Hi,

Suppose you are meeting a missing library error like this:
[i]----------------------------------------------------------------

building ‘dfftpack’ library
error: library dfftpack has Fortran sources but no Fortran compiler found

[/i]
Please install the gfortran compiler first before installing scipy:

sudo apt-get install gfortran

Thanks.

I failed to install gfortran.
update-alternatives: /usr/share/man/man1/f77.1.gz /usr/share/man/man1/gfortran.1.gz ( f77)does not exist.
I think this error relates to scipy. Because I use the command sudo apt-get install python-scipy to install it. But after I remove this package, it still doesnot work.

This my error:

Failed to build scipy
Installing collected packages: scipy, numpy, scikit-learn, sklearn
Running setup.py install for scipy … error
Complete output from command /usr/bin/python -u -c “import setuptools, tokenize;file=’/tmp/pip-build-mbfoaQ/scipy/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-MNl5x2-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:

Note: if you need reliable uninstall behavior, then install
with pip instead of using `setup.py install`:

  - `pip install .`       (from a git repo or downloaded source
                           release)
  - `pip install scipy`   (last SciPy release on PyPI)


Running from scipy source directory.
lapack_opt_info:
lapack_mkl_info:
customize UnixCCompiler
  libraries mkl_rt not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/aarch64-linux-gnu']
  NOT AVAILABLE

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

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

atlas_3_10_threads_info:
Setting PTATLAS=ATLAS
customize UnixCCompiler
  libraries lapack_atlas not found in /usr/local/lib
customize UnixCCompiler
  libraries tatlas,tatlas not found in /usr/local/lib
customize UnixCCompiler
  libraries lapack_atlas not found in /usr/lib
customize UnixCCompiler
  libraries tatlas,tatlas not found in /usr/lib
customize UnixCCompiler
  libraries lapack_atlas not found in /usr/lib/aarch64-linux-gnu
customize UnixCCompiler
  libraries tatlas,tatlas not found in /usr/lib/aarch64-linux-gnu
<class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
  NOT AVAILABLE

atlas_3_10_info:
customize UnixCCompiler
  libraries lapack_atlas not found in /usr/local/lib
customize UnixCCompiler
  libraries satlas,satlas not found in /usr/local/lib
customize UnixCCompiler
  libraries lapack_atlas not found in /usr/lib
customize UnixCCompiler
  libraries satlas,satlas not found in /usr/lib
customize UnixCCompiler
  libraries lapack_atlas not found in /usr/lib/aarch64-linux-gnu
customize UnixCCompiler
  libraries satlas,satlas not found in /usr/lib/aarch64-linux-gnu
<class 'numpy.distutils.system_info.atlas_3_10_info'>
  NOT AVAILABLE

atlas_threads_info:
Setting PTATLAS=ATLAS
customize UnixCCompiler
  libraries lapack_atlas not found in /usr/local/lib
customize UnixCCompiler
  libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib
customize UnixCCompiler
  libraries lapack_atlas not found in /usr/lib
customize UnixCCompiler
  libraries ptf77blas,ptcblas,atlas not found in /usr/lib
customize UnixCCompiler
  libraries lapack_atlas not found in /usr/lib/aarch64-linux-gnu
customize UnixCCompiler
  libraries ptf77blas,ptcblas,atlas not found in /usr/lib/aarch64-linux-gnu
<class 'numpy.distutils.system_info.atlas_threads_info'>
  NOT AVAILABLE

atlas_info:
customize UnixCCompiler
  libraries lapack_atlas not found in /usr/local/lib
customize UnixCCompiler
  libraries f77blas,cblas,atlas not found in /usr/local/lib
customize UnixCCompiler
  libraries lapack_atlas not found in /usr/lib
customize UnixCCompiler
  libraries f77blas,cblas,atlas not found in /usr/lib
customize UnixCCompiler
  libraries lapack_atlas not found in /usr/lib/aarch64-linux-gnu
customize UnixCCompiler
  libraries f77blas,cblas,atlas not found in /usr/lib/aarch64-linux-gnu
<class 'numpy.distutils.system_info.atlas_info'>
  NOT AVAILABLE

accelerate_info:
  NOT AVAILABLE

/home/lly2014/.local/lib/python2.7/site-packages/numpy/distutils/system_info.py:638: UserWarning:
    Atlas (http://math-atlas.sourceforge.net/) libraries not found.
    Directories to search for the libraries can be specified in the
    numpy/distutils/site.cfg file (section [atlas]) or by setting
    the ATLAS environment variable.
  self.calc_info()
lapack_info:
customize UnixCCompiler
  libraries lapack not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/aarch64-linux-gnu']
  NOT AVAILABLE

/home/lly2014/.local/lib/python2.7/site-packages/numpy/distutils/system_info.py:638: UserWarning:
    Lapack (http://www.netlib.org/lapack/) libraries not found.
    Directories to search for the libraries can be specified in the
    numpy/distutils/site.cfg file (section [lapack]) or by setting
    the LAPACK environment variable.
  self.calc_info()
lapack_src_info:
  NOT AVAILABLE

/home/lly2014/.local/lib/python2.7/site-packages/numpy/distutils/system_info.py:638: UserWarning:
    Lapack (http://www.netlib.org/lapack/) sources not found.
    Directories to search for the sources can be specified in the
    numpy/distutils/site.cfg file (section [lapack_src]) or by setting
    the LAPACK_SRC environment variable.
  self.calc_info()
  NOT AVAILABLE

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-build-mbfoaQ/scipy/setup.py", line 492, in <module>
    setup_package()
  File "/tmp/pip-build-mbfoaQ/scipy/setup.py", line 488, in setup_package
    setup(**metadata)
  File "/home/lly2014/.local/lib/python2.7/site-packages/numpy/distutils/core.py", line 137, in setup
    config = configuration()
  File "/tmp/pip-build-mbfoaQ/scipy/setup.py", line 395, in configuration
    raise NotFoundError(msg)
numpy.distutils.system_info.NotFoundError: No lapack/blas resources found.

Hi,

Sorry that I already get lots of libraries installed in my environment so is unable to foresee the possible missing libraries for you.

To install lapack/blas module, please try following commands:

sudo apt-get update
sudo apt-get install -y build-essential libatlas-base-dev

Thanks.

Thank you ! I solved my problem!

When I try to install libatlas-base-dev, I get the following error from apt-get:

E: Unable to locate package libatlas-base-dev

Is there a repo that I’m supposed to enable? I’m running the default JetPack 4.2 on my Nano.

Hi,

Please execute this command first:

sudo apt-get update

Thanks.

I am facing the same error of lapback/blas, but it is already installed:

$ locate lapack_atlas
/usr/lib/aarch64-linux-gnu/liblapack_atlas.a
/usr/lib/aarch64-linux-gnu/liblapack_atlas.so
/usr/lib/aarch64-linux-gnu/liblapack_atlas.so.3
/usr/lib/aarch64-linux-gnu/liblapack_atlas.so.3.10.3
$ sudo apt-get install libatlas-base-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libatlas-base-dev is already the newest version (3.10.3-5).
0 upgraded, 0 newly installed, 0 to remove and 179 not upgraded.

Help is appreciated.

I followed (https://devtalk.nvidia.com/default/topic/1042976/jetson-tx2/pip-install-something-but-error-with-could-not-find-a-satisfies-version/post/5292173/#5292173) as well but now I am getting:

Collecting scipy
  Downloading https://files.pythonhosted.org/packages/04/ab/e2eb3e3f90b9363040a3d885ccc5c79fe20c5b8a3caa8fe3bf47ff653260/scipy-1.4.1.tar.gz (24.6MB)
     |████████████████████████████████| 24.6MB 67kB/s 
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Building wheels for collected packages: scipy
  Building wheel for scipy (PEP 517) ... done
  Running setup.py clean for scipy
  ERROR: Command errored out with exit status 1:
   command: /home/pyimagesearch/.virtualenvs/py3cv4/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-q_dtqq76/scipy/setup.py'"'"'; __file__='"'"'/tmp/pip-install-q_dtqq76/scipy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' clean --all
       cwd: /tmp/pip-install-q_dtqq76/scipy
  Complete output (9 lines):
  
  `setup.py clean` is not supported, use one of the following instead:
  
    - `git clean -xdf` (cleans all files)
    - `git clean -Xdf` (cleans all versioned files, doesn't touch
                        files that aren't checked into the git repo)
  
  Add `--force` to your command to use it anyway if you must (unsupported).
  
  ----------------------------------------
  ERROR: Failed cleaning build dir for scipy
Failed to build scipy
ERROR: Could not build wheels for scipy which use PEP 517 and cannot be installed directly

When i use pip3 install scipy
also get the error same as spsayakpaul

Failed to build scipy
ERROR: Could not build wheels for scipy which use PEP 517 and cannot be installed directly[/code]

[/quote]

You might want to follow this thread: https://devtalk.nvidia.com/default/topic/1069427/jetson-nano/scipy-not-getting-installed-on-jetson-nano-inspite-of-all-dependencies/post/5417320/#5417320

Running from scipy source directory.
/tmp/pip-build-env-08eur534/overlay/lib/python3.6/site-packages/numpy/distutils/system_info.py:664: UserWarning: Specified path /usr/local/include/python3.6m is invalid.
return self.get_paths(self.section, key)
error: library mach has Fortran sources but no Fortran compiler found

ERROR: Failed building wheel for scipy
Running setup.py clean for scipy
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/tmp/pip-install-npa0q9le/scipy/setup.py’"’"’; file=’"’"’/tmp/pip-install-npa0q9le/scipy/setup.py’"’"’;f=getattr(tokenize, ‘"’"‘open’"’"’, open)(file);code=f.read().replace(’"’"’\r\n’"’"’, ‘"’"’\n’"’"’);f.close();exec(compile(code, file, ‘"’"‘exec’"’"’))’ clean --all
cwd: /tmp/pip-install-npa0q9le/scipy
Complete output (9 lines):

setup.py clean is not supported, use one of the following instead:

- `git clean -xdf` (cleans all files)
- `git clean -Xdf` (cleans all versioned files, doesn't touch
                    files that aren't checked into the git repo)

Add --force to your command to use it anyway if you must (unsupported).


ERROR: Failed cleaning build dir for scipy
Failed to build scipy
ERROR: Could not build wheels for scipy which use PEP 517 and cannot be installed directly

Which JetPack are you using? Is it 4.3?

i have the same issue as @sunjing_t with jetpack 4.3 for both scikit-learn and scikit-image

@ibondokji this should help you . https://devtalk.nvidia.com/default/topic/1066391/jetson-nano/keras-and-scipy-throwing-weird-errors-while-installing-on-jetson-nano-no-links-could-help-me-/post/5415052/#5415052

it works. thank u.

it works

For Sklearn installation in Jetson Nano (pip installation doesn’t work)
Follow steps:
sudo apt-get install python3-scipy
sudo apt-get install python3-sklearn

successfully installed :)

2 Likes