Installing CANN (Online Installation Using apt-get)

This section describes how to quickly install the CANN software using apt-get.

Installing Dependencies

Before installation, ensure that the Python environment and pip3 are available. CANN currently supports Python versions 3.7.x to 3.14.x. If this requirement is not met, run the following commands to install them:
1
sudo apt-get install -y python3 python3-pip

If the installation fails, the version does not meet the requirements, or the dynamic library libpython3.x.so is not included, perform the operations in Compiling and Installing Python.

Configuring the Ascend Repository

Configure the Ascend repository. Otherwise, the installation will fail.

wget https://ascend.devcloud.huaweicloud.com/cann/debian/cann-keyring_1.0.0_all.deb
sudo dpkg -i cann-keyring_1.0.0_all.deb
sudo apt-get update

Installing the Toolkit

Install the CANN Toolkit for training, inference, and debugging. It supports training and inference services, model conversion, and developing and building operators, applications, and models.

Before installing the Toolkit, make sure the installation directory has more than 10 GB of free space. If not, clear some space or choose another directory.

  1. Run the installation command:
    1
    sudo apt-get install ascend-cann-toolkit=9.1.0
    

    For online installation using apt-get, software can only be installed in the default directory path /usr/local/Ascend.

  2. Configure environment variables.
    1
    source /usr/local/Ascend/cann/set_env.sh
    

    The preceding environment variables take effect only in the current window. You can add the preceding command to the environment variable configuration file (for example, the .bashrc file) as required.

Installing ops

The CANN ops package integrates a comprehensive suite of libraries, including the operator foundational framework, operator libraries (covering math, nn, cv, transformer, and ras), TBE operators, HCCL, HIXL, and the DVPP library. Specifically, it provides dynamic and static library files for single-operator API execution (e.g., aclnn-class APIs), operator source code, and kernel binaries, ultimately optimizing overall execution performance in high-performance computing (HPC) workloads.

Before installing ops, ensure that the Toolkit of a compatible version has been installed in the same path. Select the ops software package corresponding to the running device. Installing ops for multiple chips in the same path is not supported. To work with different chips, install the Toolkit and the related ops in separate paths for multi-chip development and deployment.

Table 1 Installing ops

Product Type

Installation Command

Ascend 950 products

1
sudo apt-get install ascend-cann-950-ops=9.1.0

Atlas A3 products

1
sudo apt-get install ascend-cann-a3-ops=9.1.0

Atlas A2 products

1
sudo apt-get install ascend-cann-910b-ops=9.1.0

Atlas training products

1
sudo apt-get install ascend-cann-910-ops=9.1.0

Atlas inference products

1
sudo apt-get install ascend-cann-310p-ops=9.1.0

Atlas 200I/500 A2 inference products

1
sudo apt-get install ascend-cann-310b-ops=9.1.0

(Optional) Installing the NNAL

The NNAL comprises the Ascend Transformer Boost (ATB) and AscendSiPBoost (SiP) libraries.

Before installing the ATB, install the Toolkit of the matching version and configure environment variables.

  1. Run the installation command:
    1
    sudo apt-get install ascend-cann-nnal=9.1.0
    

    For online installation using apt-get, software can only be installed in the default directory path /usr/local/Ascend.

  2. Configure environment variables.
    • ATB:
      1
      source /usr/local/Ascend/nnal/atb/set_env.sh
      
    • SiP:
      1
      source /usr/local/Ascend/nnal/asdsip/set_env.sh
      

    The preceding environment variables take effect only in the current window. You can add the preceding command to the environment variable configuration file (for example, the .bashrc file) as required.