Rate This Document
Findability
Accuracy
Completeness
Readability

Installation from Source Code

Obtain the source code, apply the patch for the Arm platform, and perform compilation and installation.

  1. Use PuTTY to log in to a server as the root user.
  2. Go to the ScaNN source code compilation directory.
    1
    cd /path/to/scann
    
  3. Go to the ScaNN code directory.
    1
    cd google-research/scann
    
  4. Install the dependencies.
    1
    yum install rsync python python3-devel python3-pip gcc g++
    
  5. Configure the pip repository.
    1
    2
    pip3 config set global.index-url https://mirrors.huaweicloud.com/repository/pypi/simple
    pip3 config set global.trusted-host mirrors.huaweicloud.com
    
  6. Add the Python 3 header file path to environment variables C_INCLUDE_PATH and CPLUS_INCLUDE_PATH. Set the parameters based on the actual installation path. For example:
    1
    2
    export C_INCLUDE_PATH=/usr/include/python3.9:$C_INCLUDE_PATH
    export CPLUS_INCLUDE_PATH=/usr/include/python3.9:$CPLUS_INCLUDE_PATH
    
  7. Configure ScaNN compilation.
    1
    python3 configure.py
    

    If the command output shows that the configuration file .bazelrc is generated, the ScaNN compilation environment is successfully configured.

    If "ModuleNotFoundError: No module named 'tensorflow'" is displayed when configuring the ScaNN compilation environment:

    Run the ScaNN compilation environment configuration command again.

    1
    python3 configure.py
    
  8. Run the compilation command:
    1
    bazel clean; CC=gcc bazel build -c opt --cxxopt="-std=c++17" --copt=-fsized-deallocation --copt=-w --copt=-O3 --cxxopt=-O3 --copt=-march=armv8.2-a+lse+sve+f64mm --cxxopt=-march=armv8.2-a+lse+sve+f64mm --copt=-msve-vector-bits=256 --cxxopt=-msve-vector-bits=256 :build_pip_pkg
    

    If "unable to find valid certification path to requested target" is displayed when compiling ScaNN, rectify the fault by following instructions in The Certificate Path Cannot Be Found During ScaNN Compilation.

    If "Python.h: no such file or directory" is displayed when compiling ScaNN, rectify the fault by following instructions in The Python.h File Is Not Available During ScaNN Compilation.

  9. Generate the .whl file of the ScaNN software package in the current path.
    1
    ./bazel-bin/build_pip_pkg
    

    If the scann-1.2.10-cp39-cp39-linux_aarch64.whl file is generated in the current directory, the ScaNN software package is generated successfully.

  10. Install the ScaNN software package.
    1
    pip3 install scann-1.2.10-cp39-cp39-linux_aarch64.whl
    
  11. Check whether ScaNN is successfully installed.
    1
    python -c "import scann"
    

    If no exception information is displayed, ScaNN is successfully installed.