Obtain, Build and Install the OpenVINO Toolkit and Runtime

About This Task

With a working Python3 venv environment, you must clone the OpenVINO Toolkit repository to build and install OpenVINO to use for AI development as described in this procedure.

Before You Begin

You must have a sourced ov_venv development environment, with the necessary packages and repositories. For details, see Set Up the OpenVINO Development Environment. As part of the procedure, you will need to install additional build and Python dependencies.

The terminal prompt should reflect that you are in the environment, for example:

(ov_venv) :~/workspace$

For clarity, the code examples in this procedure do not include this extra detail.

Procedure

  1. Navigate to the $WORKSPACE (/home/workspace) directory and create the $OPENVINO_REPO variable to represent the /home/openvino source folder.

    $ cd $WORKSPACE
    $ export OPENVINO_REPO=$WORKSPACE/openvino
    
  2. Clone the openvino Git repository and navigate to it.

    $ git clone https://github.com/openvinotoolkit/openvino.git
    $ cd openvino
    
  3. Clone and initialize the repository submodules.

    $ git submodule update --init --recursive
    

    For users in China, you can also clone submodules using gitee:

    $ chmod +x scripts/submodule_update_with_gitee.sh
    $ ./scripts/submodule_update_with_gitee.sh
    
  4. Install the build dependencies in the OpenVINO source folder.

    $ chmod +x install_build_dependencies.sh
    $ sudo ./install_build_dependencies.sh
    
  5. Install the Python3 dependencies necessary to build Python wheels in the OpenVINO source folder.

    $ python3 -m pip install -U pip setuptools wheel
    $ python3 -m pip install -r ./src/bindings/python/wheel/requirements-dev.txt
    
  6. Create the build and openvino_dist directories and navigate to the $OPENVINO_REPO/build working directory.

    $ mkdir build && mkdir openvino_dist && cd build
    
  7. Configure the OpenVINO build with cmake.

    1. Set the build configuration to identify the OpenVINO cmake build requirements.

      $ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../openvino_dist \
       -DTREAT_WARNING_AS_ERROR=OFF -DENABLE_PYTHON=ON -DENABLE_WHEEL=ON \
       -DPYTHON_EXECUTABLE=`which python3.11` \
       -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.11.so \
       -DPYTHON_INCLUDE_DIR=/usr/include/python3.11  ..
      
    2. Fetch project dependencies and create Unix/Linux Makefiles.

      In the following command, you must specify the number of parallel jobs to use. If you have a build system with limited resources, the eLxr team recommends using a lower number to avoid overloading the system and maintain system responsiveness throughout the build process. If you are not sure, use the nproc command to determine the available processes. The following command specifies the system to use 8 parallel jobs.

      $ cmake --build . -- -j8
      

      Note

      This command produces a lot of output and may take some time to run depending on your system resources.

  8. Run the make install command to build and install the OpenVINO runtime to the $OPENVINO_REPO/openvino_dist directory.

    $ make install
    

    Note

    This command produces a lot of output and may take some time to run depending on your system resources. You may see warnings for deprecated declarations, which you can safely ignore.

Results

Now that you have completed the OpenVINO installation, you can verify it is working as intended. For details, see Verify the OpenVINO Toolkit and Runtime Installation.