Installing Dependencies
Prerequisites
- Before installing dependencies on the OS, ensure that the server is connected to the network.
- Before installing the CANN software (Toolkit and NNAE), you need to install the dependencies. Run the corresponding commands to install the dependencies based on the OS type.
Debian OSs: Ubuntu, Debian, UOS20, and UOS20 SP1.
openEuler series: openEuler, CentOS, Kylin, BCLinux, BC-Linux-for-Euler, UOS20 1050e, UOS20 1020e, UOSV20, AntOS, CTyunOS, CULinux, and Tlinux, Euler.
- You can install the dependencies as the root user or a non-root user (the non-root user must be the same as the installation user of the CANN software package). If a non-root user is used for installation, privilege escalation commands are required. Obtain the required sudo permissions and cancel the permissions related to high-risk commands after the installation. Otherwise, sudo privilege escalation risks exist.
Checking the Source Validity
Run the following command as the installation user to check whether the source is available. If the dependency is installed as the root user, delete sudo from the command.
1 | sudo apt-get update |
If an error is reported during command execution or the waiting time is too long, check whether the network is connected or modify the /etc/apt/sources.list file to an available source. Take Huawei mirrored source as an example, for details, see Huawei Open-Source Mirror Site.
1 | sudo yum makecache |
If an error is reported during command execution or the waiting time is too long, check whether the network is connected or modify the /etc/yum.repos.d/xxxx.repo file to an available source. Take Huawei mirrored source as an example, for details, see Huawei Open-Source Mirror Site.
Configuring the Maximum Number of Threads
In training scenarios, the maximum number of threads of OS may not meet the training requirements. In this case, perform the following operations to cancel the limitation on this number:
- Log in to the installation environment as the installation user.
- Configure environment variables, change the number of threads to unlimited, and open the /etc/profile file.
1sudo vi /etc/profile
- Add the following content to the file, save the file, and exit.
1ulimit -u unlimited
- Run the following command to make the environment variable take effect:
1source /etc/profile
Installing Dependencies
In the following steps, the dependency of the latest version or the specified version is installed. For details about the version requirements, see Dependencies.
- Log in to the server as the installation user based on the OS type and run the following commands to install the dependencies. (If you install the dependencies as the root user, delete sudo from the commands.)Debian OSs:
1sudo apt-get install -y gcc make net-tools python3 python3-dev python3-pip
openEuler series:1sudo yum install -y gcc make net-tools python3 python3-devel python3-pip
- Check whether the Python development environment that meets the version requirements has been installed.
1 2
python3 --version pip3 --version
CANN supports Python 3.7.x to 3.11.4. If the software is not installed or the version does not meet the requirements, perform the operations described in Installing Python 3.7.5 in Compilation Mode.
- Run the following command to install the required third-party Python library. (If you install the library as the root user, delete --user from the command.)
1pip3 install attrs cython numpy==1.24.0 decorator sympy cffi pyyaml pathlib2 psutil protobuf==3.20 scipy requests absl-py --user
If the source is unavailable, see configure the pip source. After the configuration, run the installation command. Note that NumPy 1.21.6 is recommended for Python 3.7. x.