1

I followed these topics:

  1. https://devtalk.nvidia.com/default/topic/1044958/jetson-agx-xavier/scikit-learn-for-python-3-on-jetson-xavier/
  2. https://devtalk.nvidia.com/default/topic/1049684/jetson-nano/errors-during-install-sklearn-/
  3. https://github.com/scikit-learn/scikit-learn/issues/12707

python version: 3.6.9

Here are all commands I run:

sudo apt-get update
sudo apt-get install libhdf5-serial-dev hdf5-tools libhdf5-dev zlib1g-dev zip libjpeg8-dev

sudo apt-get install python3-pip
sudo pip3 install -U pip testresources setuptools

sudo pip3 install -U numpy==1.16.1 future==0.17.1 mock==3.0.5 h5py==2.9.0 keras_preprocessing==1.0.5 keras_applications==1.0.8 gast==0.2.2 enum34 futures protobuf

sudo pip3 install --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v43 tensorflow-gpu==1.15.0+nv19.12

sudo apt-get install python3-opencv
sudo apt-get install python3-pandas
sudo apt-get install python3-keras
sudo apt-get install gfortran
sudo apt-get install python3-scipy
sudo apt-get install python3-matplotlib
sudo apt-get install python3-imageio

pip3 install dlib
sudo apt-get install -y build-essential libatlas-base-dev

pip3 install --upgrade setuptools
sudo pip3 install -U setuptools
sudo apt-get install libpcap-dev libpq-dev
sudo pip3 install cython
sudo pip3 install git+https://github.com/scikit-learn/scikit-learn.git

and I got the long error below

    compile options: '-I/usr/local/lib/python3.6/dist-packages/numpy/core/include -I/usr/local/lib/python3.6/dist-packages/numpy/core/include -I/usr/include/python3.6m -c'
    aarch64-linux-gnu-gcc: scipy/cluster/_hierarchy.c
    In file included from /usr/local/lib/python3.6/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1822:0,
                     from /usr/local/lib/python3.6/dist-packages/numpy/core/include/numpy/ndarrayobject.h:12,
                     from /usr/local/lib/python3.6/dist-packages/numpy/core/include/numpy/arrayobject.h:4,
                     from scipy/cluster/_hierarchy.c:598:
    /usr/local/lib/python3.6/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
     #warning "Using deprecated NumPy API, disable it with " \
      ^~~~~~~
    scipy/cluster/_hierarchy.c:19289:18: warning: ‘__Pyx_CFunc_double____double____double____double____int____int____int___to_py’ defined but not used [-Wunused-function]
     static PyObject *__Pyx_CFunc_double____double____double____double____int____int____int___to_py(double (*__pyx_v_f)(double, double, double, int, int, int)) {
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    scipy/cluster/_hierarchy.c: In function ‘__pyx_pw_5scipy_7cluster_10_hierarchy_27nn_chain’:
    scipy/cluster/_hierarchy.c:13560:10: warning: ‘__pyx_v_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]
           if (__pyx_t_12) {
              ^
    scipy/cluster/_hierarchy.c:13074:7: note: ‘__pyx_v_y’ was declared here
       int __pyx_v_y;
           ^~~~~~~~~
    scipy/cluster/_hierarchy.c: In function ‘__pyx_pw_5scipy_7cluster_10_hierarchy_23linkage’:
    scipy/cluster/_hierarchy.c:11431:16: warning: ‘__pyx_v_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]
         __pyx_t_23 = __pyx_v_y;
         ~~~~~~~~~~~^~~~~~~~~~~
    scipy/cluster/_hierarchy.c:11060:7: note: ‘__pyx_v_y’ was declared here
       int __pyx_v_y;
           ^~~~~~~~~
    scipy/cluster/_hierarchy.c:11421:16: warning: ‘__pyx_v_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]
         __pyx_t_22 = __pyx_v_x;
         ~~~~~~~~~~~^~~~~~~~~~~
    scipy/cluster/_hierarchy.c:11059:7: note: ‘__pyx_v_x’ was declared here
       int __pyx_v_x;
           ^~~~~~~~~
    scipy/cluster/_hierarchy.c: In function ‘__pyx_pw_5scipy_7cluster_10_hierarchy_25fast_linkage’:
    scipy/cluster/_hierarchy.c:12682:92: warning: ‘__pyx_v_dist’ may be used uninitialized in this function [-Wmaybe-uninitialized]
           *((double *) ( /* dim=0 */ (__pyx_v_D.data + __pyx_t_44 * __pyx_v_D.strides[0]) )) = __pyx_v_new_dist((*((double *) ( /* dim=0 */ (__pyx_v_D.data + __pyx_t_42 * __pyx_v_D.strides[0]) ))), (*((double *) ( /* dim=0 */ (__pyx_v_D.data + __pyx_t_43 * __pyx_v_D.strides[0]) ))), __pyx_v_dist, __pyx_v_nx, __pyx_v_ny, __pyx_v_nz);
                                                                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    scipy/cluster/_hierarchy.c:11978:10: note: ‘__pyx_v_dist’ was declared here
       double __pyx_v_dist;
              ^~~~~~~~~~~~
    scipy/cluster/_hierarchy.c:11971:7: warning: ‘__pyx_v_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       int __pyx_v_y;
           ^~~~~~~~~
    scipy/cluster/_hierarchy.c: In function ‘__pyx_pw_5scipy_7cluster_10_hierarchy_29mst_single_linkage’:
    scipy/cluster/_hierarchy.c:14363:142: warning: ‘__pyx_v_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]
         *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_Z.data + __pyx_t_25 * __pyx_v_Z.strides[0]) ) + __pyx_t_26 * __pyx_v_Z.strides[1]) )) = __pyx_v_y;
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
    scipy/cluster/_hierarchy.c:13995:7: note: ‘__pyx_v_y’ was declared here
       int __pyx_v_y;
           ^~~~~~~~~
    aarch64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-aarch64-3.6/scipy/cluster/_hierarchy.o -Lbuild/temp.linux-aarch64-3.6 -o build/lib.linux-aarch64-3.6/scipy/cluster/_hierarchy.cpython-36m-aarch64-linux-gnu.so -Wl,--version-script=build/temp.linux-aarch64-3.6/link-version-scipy.cluster._hierarchy.map
    building 'scipy.cluster._optimal_leaf_ordering' extension
    compiling C sources
    C compiler: aarch64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC

    compile options: '-I/usr/local/lib/python3.6/dist-packages/numpy/core/include -I/usr/local/lib/python3.6/dist-packages/numpy/core/include -I/usr/include/python3.6m -c'
    aarch64-linux-gnu-gcc: scipy/cluster/_optimal_leaf_ordering.c
    In file included from /usr/local/lib/python3.6/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1822:0,
                     from /usr/local/lib/python3.6/dist-packages/numpy/core/include/numpy/ndarrayobject.h:12,
                     from /usr/local/lib/python3.6/dist-packages/numpy/core/include/numpy/arrayobject.h:4,
                     from scipy/cluster/_optimal_leaf_ordering.c:598:
    /usr/local/lib/python3.6/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
     #warning "Using deprecated NumPy API, disable it with " \
      ^~~~~~~
    scipy/cluster/_optimal_leaf_ordering.c: In function ‘__pyx_pf_5scipy_7cluster_22_optimal_leaf_ordering_optimal_leaf_ordering.isra.58’:
    scipy/cluster/_optimal_leaf_ordering.c:4747:19: warning: ‘__pyx_v_best_w’ may be used uninitialized in this function [-Wmaybe-uninitialized]
           __pyx_t_117 = __pyx_v_best_w;
           ~~~~~~~~~~~~^~~~~~~~~~~~~~~~
    scipy/cluster/_optimal_leaf_ordering.c:3414:7: note: ‘__pyx_v_best_w’ was declared here
       int __pyx_v_best_w;
           ^~~~~~~~~~~~~~
    scipy/cluster/_optimal_leaf_ordering.c:4746:19: warning: ‘__pyx_v_best_u’ may be used uninitialized in this function [-Wmaybe-uninitialized]
           __pyx_t_116 = __pyx_v_best_u;
           ~~~~~~~~~~~~^~~~~~~~~~~~~~~~
    scipy/cluster/_optimal_leaf_ordering.c:3413:7: note: ‘__pyx_v_best_u’ was declared here
       int __pyx_v_best_u;
           ^~~~~~~~~~~~~~
    aarch64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-aarch64-3.6/scipy/cluster/_optimal_leaf_ordering.o -Lbuild/temp.linux-aarch64-3.6 -o build/lib.linux-aarch64-3.6/scipy/cluster/_optimal_leaf_ordering.cpython-36m-aarch64-linux-gnu.so -Wl,--version-script=build/temp.linux-aarch64-3.6/link-version-scipy.cluster._optimal_leaf_ordering.map
    C compiler: aarch64-linux-gnu-g++ -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC

    creating /tmp/tmpvz7d4hd0/tmp
    creating /tmp/tmpvz7d4hd0/tmp/tmpvz7d4hd0
    compile options: '-I/usr/include/python3.6m -c'
    extra options: '-std=c++14'
    aarch64-linux-gnu-g++: /tmp/tmpvz7d4hd0/main.c
    C compiler: aarch64-linux-gnu-g++ -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC

    creating /tmp/tmp3j3pimiu/tmp
    creating /tmp/tmp3j3pimiu/tmp/tmp3j3pimiu
    compile options: '-I/usr/include/python3.6m -c'
    extra options: '-std=c++14 -fvisibility=hidden'
    aarch64-linux-gnu-g++: /tmp/tmp3j3pimiu/main.c
    C compiler: aarch64-linux-gnu-g++ -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC

    creating /tmp/tmpmxeh9kyu/tmp
    creating /tmp/tmpmxeh9kyu/tmp/tmpmxeh9kyu
    compile options: '-I/usr/include/python3.6m -c'
    aarch64-linux-gnu-g++: /tmp/tmpmxeh9kyu/main.c
    building 'scipy.fft._pocketfft.pypocketfft' extension
    compiling C++ sources
    C compiler: aarch64-linux-gnu-g++ -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC

    creating build/temp.linux-aarch64-3.6/scipy/fft
    creating build/temp.linux-aarch64-3.6/scipy/fft/_pocketfft
    compile options: '-DPOCKETFFT_PTHREADS -I/home/dlinano/.local/include/python3.6m -I/usr/local/include/python3.6 -I/usr/local/lib/python3.6/dist-packages/numpy/core/include -I/usr/include/python3.6m -c'
    extra options: '-std=c++14 -fvisibility=hidden'
    aarch64-linux-gnu-g++: scipy/fft/_pocketfft/pypocketfft.cxx
    scipy/fft/_pocketfft/pypocketfft.cxx:15:10: fatal error: pybind11/pybind11.h: No such file or directory
     #include <pybind11/pybind11.h>
              ^~~~~~~~~~~~~~~~~~~~~
    compilation terminated.
    Running from scipy source directory.
    /usr/local/lib/python3.6/dist-packages/numpy/distutils/system_info.py:728: UserWarning: Specified path /usr/local/include/python3.6m is invalid.
      return self.get_paths(self.section, key)
    error: Command "aarch64-linux-gnu-g++ -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPOCKETFFT_PTHREADS -I/home/dlinano/.local/include/python3.6m -I/usr/local/include/python3.6 -I/usr/local/lib/python3.6/dist-packages/numpy/core/include -I/usr/include/python3.6m -c scipy/fft/_pocketfft/pypocketfft.cxx -o build/temp.linux-aarch64-3.6/scipy/fft/_pocketfft/pypocketfft.o -MMD -MF build/temp.linux-aarch64-3.6/scipy/fft/_pocketfft/pypocketfft.o.d -std=c++14 -fvisibility=hidden" failed with exit status 1
    ----------------------------------------
    ERROR: Failed building wheel for scipy
  Failed to build scipy
  ERROR: Could not build wheels for scipy which use PEP 517 and cannot be installed directly
  ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 /usr/local/lib/python3.6/dist-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-dfzx1730/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel 'Cython>=0.28.5' 'numpy>=1.13.3' 'scipy>=0.19.1' Check the logs for full command output.

Please check this full logs: https://drive.google.com/file/d/1gLcSq86Aic5uFoPr8k6Cp366eRB2tlfw/view?usp=sharing

2 Answers 2

7

This is what worked for me.

sudo -H pip3 install scikit-learn

Here is my full installation script for the order in which the dependencies are installed.

#tensorflow - zoo
sudo apt-get install libhdf5-serial-dev hdf5-tools libhdf5-dev zlib1g-dev zip libjpeg8-dev
sudo apt-get install python3-pip
sudo -H pip3 install -U pip

sudo -H pip3 install -U numpy grpcio absl-py py-cpuinfo psutil portpicker six mock requests gast h5py astor==0.8.0 termcolor protobuf keras-applications keras-preprocessing wrapt google-pasta
sudo -H pip3 install --pre --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v42 tensorflow-gpu==1.14.0
#Cython
sudo -H pip3 install cython

#keras-zoo
sudo apt-get install -y build-essential libatlas-base-dev gfortran
sudo -H pip3 install keras

#Pandas
sudo -H pip3 install pandas

#Scipy
sudo -H python3 -m pip install scipy==1.1.0

#Sklearn
sudo -H pip3 install scikit-learn
3
  • can you please explain why scipy is different / specific? It's failing for me rn. Oct 16, 2020 at 5:47
  • I am sorry I am not sure why it is different. Can you show your error logs? Also did you uninstall everything before installing this?
    – Sharan
    Oct 16, 2020 at 10:02
  • I ran all the above installs in order (many of which I already had) and it installed fine @Sharan pretty sure Keras installs fixed it gist.github.com/gumdropsteve/2be3ce22407fe6651b5df3484b4f4bb4 thank you Oct 19, 2020 at 6:40
1

I had problems with Jupyter (Jetson TX2) I checked which numpy version is used by Jupyter.

import  numpy as np
np.version.version

In My case it was 1.13 despite the fact that

$ pip3 list 

showed me version 1.16 for numpy I found solution here https://fooobar.com/questions/15251639/jupyter-notebook-picks-older-version-of-numpy

  1. to see the numpy path

    print (np.__path__)
    

in my case it was /usr/lib/python3/dist-packages

  1. went to the directory and removed old version numpy

    $ cd /usr/lib/python3/dist-packages  
    $ sudo rm -r numpy
    
  2. installed the relevant numpy version

    $ sudo pip install numpy==1.16.1
    

that's all.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.