Issue with installing SciPy on Jetson AGX Xavier

Hey everyone,

I faced a problem with installing SciPy on Jetson AGX Xavier. Since I could not find a solution online, maybe someone here has an idea what I am doing wrong.
The command I use for installing SciPy is

$ sudo -H pip3 install scipy

I recieve an error (see attached file), which starts with:

$ sudo -H pip3 install scipy
Collecting scipy
  Downloading https://files.pythonhosted.org/packages/04/ab/e2eb3e3f90b9363040a3d885ccc5c79fe20c5b8a3caa8fe3bf47ff653260/scipy-1.4.1.tar.gz (24.6MB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 24.6MB 10.8MB/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) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 /usr/local/lib/python3.6/dist-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmpnon3db0r
       cwd: /tmp/pip-install-awfrr_cr/scipy
  Complete output (4941 lines):
  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
  
  flame_info:
  customize UnixCCompiler
    libraries flame not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/aarch64-linux-gnu']
    NOT AVAILABLE

I assume that it can not find libraries like openblas and lapack.
After searching online for a solution I tried

$ sudo apt-get install libblas-dev liblapack-dev libatlas-base-dev gfortran

which worked, but made no difference in the resulting error code.

Therefore I checked the library location (for example for libblas) with dpkg:

~$ dpkg -L libblas-dev  
(s.hier: https://askubuntu.com/questions/115500/how-to-find-location-of-installed-library)
/.
/usr
/usr/include
/usr/include/aarch64-linux-gnu
/usr/include/aarch64-linux-gnu/cblas-netlib.h
/usr/include/aarch64-linux-gnu/cblas_f77.h
/usr/include/aarch64-linux-gnu/cblas_mangling.h
/usr/lib
/usr/lib/aarch64-linux-gnu
/usr/lib/aarch64-linux-gnu/blas
/usr/lib/aarch64-linux-gnu/blas/libblas.a
/usr/lib/aarch64-linux-gnu/pkgconfig
/usr/lib/aarch64-linux-gnu/pkgconfig/blas-netlib.pc
/usr/share
/usr/share/doc
/usr/share/doc/libblas-dev
/usr/share/doc/libblas-dev/copyright
/usr/lib/aarch64-linux-gnu/blas/libblas.so
/usr/share/doc/libblas-dev/changelog.Debian.gz

Apparently none of the locations (β€˜/usr/local/lib’, β€˜/usr/lib’, β€˜/usr/lib/aarch64-linux-gnu’) called in the upper error is listed here. Could it be a problem that the script is searching on the wrong place to find the libraries?

Additionally I tried

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

and also

pip3 install --upgrade setuptools
sudo pip3 install -U setuptools
(requirement already satisfied)
sudo apt-get install libpcap-dev libpq-dev
sudo pip3 install cython
(already satisfied)

and also

pip install --upgrade pip
python3 -m pip install --upgrade pip

Is there anyone who has an idea what could be wrong or what I could change?
SameScipyError.txt (272 KB)

Hi,

You will need to build it from source.
Could you try this comment first?
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

Thanks.

1 Like

Hi AastaLLL,

thanks for your suggestion. I tried it and unfortunately it could not be installed due to the same error (please see attached file).

I changed the code from your link a little to the following lines: 
$ sudo apt-get update
$ sudo apt-get install -y build-essential libatlas-base-dev gfortran libfreetype6-dev python3-setuptools
$ sudo apt-get install -y protobuf-compiler libprotobuf-dev openssl libssl-dev libcurl4-openssl-dev

$ wget https://github.com/scipy/scipy/releases/download/v1.3.3/scipy-1.3.3.tar.gz

$ echo 'export PATH=/opt/cmake-3.13.4/bin/:$PATH' >> ~/.bashrc
$ source ~/.bashrc

$ mkdir SciPy
$ cd SciPy
$ tar -xzvf scipy-1.4.1.tar.gz scipy-1.4.1download 
$ cd scipy-1.4.1/
$ sudo python3 setup.py install --user

I changed the scipy version, because the installation of version 3.13.3 failed at the tar-command. Version 1.4.1 workeed. did not upgrade CMake because it is already version 3.13.4.

Do you have an alternative idea, how SciPy can be installed?

Thanks for your answer.
2020_01_03_ScipyError_InstallWithWGet.txt (399 KB)

Hi,

The error indicates a missing lapack library.
You can install via this command:

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

Thanks.

Hi AastaLLL,

thanks for your response. This library was already installed:

$ sudo apt-get install -y build-essential libatlas-base-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
build-essential is already the newest version (12.4ubuntu1).
libatlas-base-dev is already the newest version (3.10.3-5).
0 to upgrade, 0 to newly install, 0 to remove and 1 not to upgrade.

Error still exists. I’m thankful about every new suggestions what I could try.

Hi,

Could you execute the following command and rebuilt the scipy again?

$ sudo apt-get install libblas-dev liblapack-dev gfortran

Thanks.

I solved it in the following way.

apt install python3-scipy

Thank you

Same problem here.
The following packages were already installed:

Just like these:

This alternative

will not work for me because it installs scipy 0.19.1, and I need scipy>=1.0.
Still in need of a solution…

The reason NVidia does not provide all these commonly used data analytics tools preinstalled on JetPack is absolutely beyond me.

there is some reference on how to build it, though I did not try
http://scipy.github.io/devdocs/building/linux.html#generic-instructions

I got it working using these instructions:

Btw, I didn’t need to update CMake, as far as I’m aware. A simple

$ sudo apt update && sudo apt install cmake

did the trick.