Installation Procedure (CentOS 7.6)
Configuring the Maximum Number of Threads
- Log in to the installation environment as the root user.
- Configure environment variables to change the maximum number of threads. In the /etc/profile file, add the following content to the end of the file, save the file, and exit:
ulimit -u unlimited
- Run the following command to make the environment variable take effect:
source /etc/profile
Installing Dependencies
- Log in to the server as the root user and check whether dependencies, such as Python and GCC, are installed.Run the following commands to check whether the dependencies such as GCC, Make, and Python are installed:
gcc --version g++ --version make --version cmake --version rpm -qa |grep unzip rpm -qa |grep zlib-devel rpm -qa |grep libffi-devel rpm -qa |grep openssl-devel rpm -qa |grep pciutils rpm -qa |grep net-tools rpm -qa |grep sqlite-devel rpm -qa |grep lapack-devel rpm -qa |grep openblas-devel rpm -qa |grep gcc-gfortran
If the following information is displayed, the dependencies have been installed. Go to the next step. (The following information shows an example.)
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39) g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39) GNU Make 3.82 cmake version 2.8.12.2 unzip-6.0-21.el7.aarch64 zlib-devel-1.2.7-18.el7.aarch64 libffi-devel-3.0.13-18.el7.aarch64 openssl-devel-1.0.2k-19.el7.aarch64 pciutils-3.5.1-3.el7.aarch64 net-tools-2.0-0.25.20131004git.el7.aarch64 sqlite-devel-3.7.17-8.el7_7.1.aarch64 lapack-devel-3.4.2-8.el7.aarch64 openblas-devel-0.3.3-2.el7.aarch64 gcc-gfortran-4.8.5-39.el7.aarch64
Otherwise, run the following command to install the software. You can change the following command to install only some of them as required.yum install -y gcc gcc-c++ make cmake unzip zlib-devel libffi-devel openssl-devel pciutils net-tools sqlite-devel lapack-devel openblas-devel gcc-gfortran
In the preceding steps, the message "No package libopenblas available" is displayed during the installation of openblas-devel. Run the following command to install the Linux extension package of the enterprise edition:yum install epel-release
If the CMake version installed using the preceding method is earlier than 3.5.1, see Installing CMake 3.5.2.
- Check whether the Python development environment that meets the version requirements is installed. For details, see Dependency List. This step uses Python 3.7.x as an example.
Run the python3 --version command. If the returned Python version meets the requirements (3.7.0 to 3.7.11), go to 3.
Otherwise, run the following commands to install Python (Python 3.7.5 is used as an example):
- Run the following command to download the source package of Python 3.7.5 to any directory of the installation environment:
wget https://www.python.org/ftp/python/3.7.5/Python-3.7.5.tgz
- Go to the download directory and run the following command to extract the source package:
tar -zxvf Python-3.7.5.tgz
- Go to the decompressed folder, create an installation directory, and run the configuration, build, and installation commands.
cd Python-3.7.5 ./configure --prefix=/usr/local/python3.7.5 --enable-loadable-sqlite-extensions --enable-shared make sudo make install
--prefix specifies the Python installation path. You can modify it as required. --enable-shared is used to build the libpython3.7m.so.1.0 dynamic library. --enable-loadable-sqlite-extensions is used to load the sqlite-devel dependency.
This document uses --prefix=/usr/local/python3.7.5 as an example. After the configuration, compilation, and installation commands are executed, the installation package is stored in the /usr/local/python3.7.5 directory, and the libpython3.7m.so.1.0 dynamic library is stored in the /usr/local/python3.7.5/lib/libpython3.7m.so.1.0 directory.
- Set the Python 3.7.5 environment variables.
# Set the Python 3.7.5 library path. export LD_LIBRARY_PATH=/usr/local/python3.7.5/lib:$LD_LIBRARY_PATH # If multiple Python 3 versions exist in the user environment, use Python 3.7.5. export PATH=/usr/local/python3.7.5/bin:$PATH
Set environment variables in the preceding export mode. In this mode, the environment variables 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 or the default Python version is 3.7.x before Python 3.7.5 is installed, do not write the preceding commands to the ~/.bashrc file.
- After the installation is complete, run the following commands to check the installation version. If the required version information is displayed, the installation is successful.
python3 --version pip3 --version
- Run the following command to download the source package of Python 3.7.5 to any directory of the installation environment:
- Before installating the CANN, run the pip3 list command to check whether the dependencies have been installed. If yes, skip this step. If not, run the following command to install the dependencies. If only some of the software is not installed, modify the following command to install selected software only.
- Configure the pip source before the installation. For details, see Configuring the PIP Source.
- Before the installation, you are advised to run the pip3 install --upgrade pip command to perform the upgrade to prevent the installation failure caused by an earlier pip version.
- If you run the following commands as a non-root user, add --user at the end of each installation command, for example, pip3 install attrs --user. The installation command can be run in any path.
pip3 install attrs pip3 install cython pip3 install numpy pip3 install decorator pip3 install sympy pip3 install cffi pip3 install pyyaml pip3 install pathlib2 pip3 install psutil pip3 install protobuf pip3 install scipy pip3 install requests pip3 install absl-py
- If an error is reported during the NumPy installation, rectify the fault by referring to pip3 install numpy Error.
- If an error is reported during the SciPy installation, rectify the fault by referring to pip3 install scipy Error.
- CentOS 7.6 uses GCC 4.8.5 by default. For details about how to install GCC 7.3.0, see Installing GCC 7.3.0.