Environment Setup

This document uses the root user to simplify operations.

Setting Up the Hardware Environment

If an inference application needs to run after being developed, the Ascend hardware environment is required. This document uses Ascend hardware devices as examples to describe how to develop and run an application. Ensure that the driver, firmware, and operating system (OS) have been installed on the hardware.

Installing the CANN Development Kit

The low layer of mxVision depends on the CANN development kit (Ascend-CANN-Toolkit). For details about how to install the CANN, see Installing the Development Environment > Installing Software Packages on an Ascend Device > Installing the Development Kit in the CANN Software Installation Guide.

Obtaining the SDK Software Package

Package Name

Package Description

How to Obtain

Ascend-mindxsdk-mxvision_{version}_linux-{arch}.run

{version} indicates the version number and {arch} indicates the OS architecture.

mxVision SDK software package

  • Community edition: Link. (Click the mxVision tab, select MindX 3.0.0, and download the corresponding software package in the table.)
  • Commercial edition: Link. (Select MindX 3.0.0 and download the corresponding software package in the table.)

The software is classified into the commercial edition and community edition. The functions of the two editions are the same except the download permission and use of purpose.

The community edition can be downloaded directly without applying for related permissions, but it cannot be used for commercial purpose. To download the commercial edition, you need to apply for related permissions.

  • {version} indicates the SDK version number and {arch} indicates the OS architecture.
  • Multiple versions of SDK cannot be used in one system. Before using a new version, uninstall the old version or update the SDK
  • On the software download page, select the required version and download it.

Installing Dependencies Required by the SDK

  • Ubuntu: Run the sudo apt-get install -y xz-utils libgfortran-7-dev command to install dependencies.
  • CentOS: Run the sudo yum install -y xz libgfortran4 command to install dependencies.
  • Install Python 3.9.2.
    1. Run the wget command to download the Python 3.9.2 source package to any directory in the installation environment, for example, /usr/local.
      wget https://www.python.org/ftp/python/3.9.2/Python-3.9.2.tgz
    2. Go to the download directory and run the following command to extract the source package:
      tar -zxvf Python-3.9.2.tgz
    3. Go to the decompressed folder and run the following configuration, compilation, and installation commands:
      cd Python-3.9.2
      ./configure --prefix=/usr/local/python3.9.2 --enable-loadable-sqlite-extensions --enable-shared 
      make 
      make install

      The --prefix parameter specifies the Python installation path. You can change it based on your requirements. The --enable-loadable-sqlite-extensions parameter is used to load libsqlite3-dev. The --enable-shared parameter is used to compile the libpython3.9.so.1.0 dynamic library.

      This document uses --prefix=/usr/local/python3.9.2 as an example. After the configuration, compilation, and installation commands are executed, the installation package is stored in the /usr/local/python3.9.2 directory, and the libpython3.9.so.1.0 dynamic library is stored in the /usr/local/python3.9.2/lib/libpython3.9.so.1.0 directory.

    4. Set Python 3.9.2 environment variables.
      # Set the Python 3.9.2 library path.
      export LD_LIBRARY_PATH=/usr/local/python3.9.2/lib:$LD_LIBRARY_PATH 
      # If multiple Python 3 versions exist in the user environment, use Python 3.9.2.
      export PATH=/usr/local/python3.9.2/bin:$PATH

      Environment variables that are set in the preceding mode take effect only in the current window. You can also write the preceding commands to the ~/.bashrc file and run the source ~/.bashrc command for the environment variables to take effect permanently. If you need to use other Python versions in the environment, you are advised not to write the preceding commands to the ~/.bashrc file.

    5. After the installation is complete, run the following command to check the installation version. If the required version information is displayed, the installation is successful.
      python3 --version 

Installing the SDK Software

  1. Log in to the development environment as the root user.
  2. Upload the mxVision development kit package to any path (for example, /home) in the installation environment.
  3. Grant the execute permission on the kit.
    chmod +x Ascend-mindxsdk-mxvision_{version}_linux-{arch}.run
  4. Go to the path where the mxVision development kit package is uploaded and install it.
    ./Ascend-mindxsdk-mxvision_{version}_linux-{arch}.run --install
    If no error information is displayed after the installation, the software is successfully installed.
    The installation is successfully
    After the installation is complete, the directory structure of the mxVision software is shown as follows:
    .
    ├── bin
    ├── config
    ├── filelist.txt
    ├── include
    ├── lib
    ├── opensource
    ├── operators
    ├── python
    ├── samples
    ├── set_env.sh
    ├── toolkit
    └── version.info
  5. Go to the mxVision installation directory and run the following command to make the MindX SDK environment variables take effect:
    . set_env.sh