Installing CANN (Online Installation Using Conda)

This section describes how to quickly install the CANN software using Conda. Click here to check the supported CANN software packages and versions.

Prerequisites

Ensure that the Conda virtual environment installation directory and all its parent directories are granted 755 permissions.

Configuring the Ascend Repository

Configure the Ascend repository. Otherwise, the installation will fail.
1
conda config --add channels https://repo.huaweicloud.com/ascend/repos/conda/ 

Installing the Toolkit

The CANN Toolkit is designed for training, inference, and development and debugging scenarios. It is mainly used for training and inference workloads, model conversion, as well as the development and compilation of operators, applications, and models.

Before installing Toolkit, ensure that the available space of the installation directory is greater than 10 GB. Otherwise, clear the space or change the installation directory.

  1. Run the installation command:
    1
    conda install ascend::cann-toolkit==9.0.0
    

    By default, the software package of the latest version is installed. Click here to check and install a software package of another version by running the corresponding command.

    The default installation path of the software package is the Ascend directory in the Conda virtual environment, for example, /home/miniconda3/Ascend.

  2. Configure environment variables. The following uses /home/miniconda3/Ascend as an example. Replace it with the actual path.
    1
    source /home/miniconda3/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.

  3. Verifying the installation. Run the following command to query the CANN version. If the query result is the same as the version of the installation software package, the installation is successful.
    1
    conda list | grep cann
    

Installing the ops

The CANN ops package integrates a comprehensive suite of libraries, including the operator foundational framework, operator libraries (covering math, nn, cv, and transformer), 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) scenarios.

Before installing the ops package, ensure that the Toolkit software package of a compatible version has been installed in the same path. Select the ops software package corresponding to the running device. Currently, installing ops packages for multiple chips under the same path is not supported. You can install the Toolkit and the corresponding ops packages for different chips in separate paths to meet development and deployment requirements in multi-chip environments.

Table 1 Installing the ops

Product Type

Installation Command

Atlas 350 Accelerator Card

1
conda install ascend::cann-950-ops==9.0.0

Atlas A3 series

1
conda install ascend::cann-a3-ops==9.0.0

Atlas A2 series

1
conda install ascend::cann-910b-ops==9.0.0

Atlas training series

1
conda install ascend::cann-910-ops==9.0.0

Atlas inference series

1
conda install ascend::cann-310p-ops==9.0.0

Atlas 200I/500 A2 inference products

1
conda install ascend::cann-310b-ops==9.0.0

By default, the preceding commands install the software packages of the latest version. To install a specified version, add the version number to the end of the software package name. Click here to view the corresponding command.

(Optional) Installing the NNAL

The NNAL comprises the ATB and SiP libraries.

Before installing the ATB, install Toolkit of the matching version and configure environment variables. Use the same user to do these operations.

  1. Run the installation command:
    1
    conda install ascend::cann-nnal==9.0.0
    

    By default, the software package of the latest version is installed. Click here to check and install a software package of another version by running the corresponding command.

    The default installation path of the software package is the Ascend directory in the Conda virtual environment, for example, /home/miniconda3/Ascend.

  2. Configure environment variables. The following uses /home/miniconda3/Ascend as an example. Replace it with the actual path.
    • ATB:
      1
      source /home/miniconda3/Ascend/nnal/atb/set_env.sh
      
    • SiP:
      1
      source /home/miniconda3/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.

  3. Verifying the installation. Run the following command to query the CANN version. If the query result is the same as the version of the installation software package, the installation is successful.
    1
    conda list | grep cann