Installation Procedure (CentOS)
Checking Sources
The installation requires the download of related dependencies. Ensure that the server can be connected to the network.
yum repolist
If an error is reported during command execution or dependency installation, check whether the network connection is normal, or replace the source in the /etc/yum.repos.d/xxxx.repo file with an available source or use an image source.
Checking the umask Value of the root User
Check the umask value of the root user.
umask
If the umask value is not 0022, append umask 0022 to the file and save the file.
- Run the following command in any directory to open the .bashrc file:
vi ~/.bashrc
Append umask 0022 to the end of the file.
- Run the :wq! command to save the file and exit.
- Run the source ~/.bashrc command for the modification to take effect immediately.
- Run the following command in any directory to open the .bashrc file:
After the dependencies are installed, restore the umask value to the original one by deleting the umask 0022 line from the .bashrc file. For security purposes, you are advised to change the umask value to 0027.
Configuring Permissions for the Installation User
If you install MindStudio as a non-root user, download related dependent software first. In this case, you may need to use the privilege escalation commands. In this case, obtain the required sudo permissions. After the installation is complete, cancel the permissions related to high-risk commands. Otherwise, sudo privilege escalation risks exist.
Installing Dependencies
- Check that the Python dependencies and GCC software are installed.Run the following commands to check whether software including GCC and Make, and Python dependencies are installed:
gcc --version g++ --version make --version cmake --version rpm -qa |grep unzip rpm -qa |grep zlib-devel rpm -qa |grep bzip2-devel rpm -qa |grep sqlite-devel rpm -qa |grep libffi-devel rpm -qa |grep openssl-devel rpm -qa |grep xz-devel rpm -qa |grep pciutils rpm -qa |grep net-tools rpm -qa |grep sqlite-devel rpm -qa |grep lapack-devel rpm -qa |grep gcc-gfortran rpm -qa |grep xterm rpm -qa |grep firefox rpm -qa |grep openssh rpm -qa | grep xdg-utils rpm -qa | grep dbus-glib-devel rpm -qa | grep gdb
You should see output similar to the following if the software has been installed.
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 bzip2-devel-1.0.6-13.el7.aarch64 sqlite-devel-3.7.17-8.el7_7.1.aarch64 libffi-devel-3.0.13-18.el7.aarch64 openssl-devel-1.0.2k-19.el7.aarch64 xz-devel-5.2.5-1.oe1.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 gcc-gfortran-4.8.5-39.el7.aarch64 xterm-295-3.el7.aarch64 firefox-60.2.2-1.el7.centos.aarch64 openssh-server-7.4p1-16.el7.aarch64 openssh-clients-7.4p1-16.el7.aarch64 openssh-7.4p1-16.el7.aarch64 xdg-utils-1.1.0-0.17.20120809git.el7.noarch dbus-glib-devel-0.100-7.el7.aarch64 gdb-7.6.1-114.el7.aarch64
Run the following command to install the software if the command output is not as above. You can change the command to install only needed software.
- If you install dependencies as the root user, delete sudo from the commands in steps 1 and 2.
- If Python and its dependency are installed as a non-root user, run the su - username command to switch to the non-root user, and then perform step 1 to step 3.
- sqlite-devel must be installed before Python installation. If the Python environment that meets version requirements has been installed in the user's OS and sqlite-devel is installed after the Python environment is installed, you need to rebuild the Python environment.
sudo yum install -y gcc gcc-c++ make cmake unzip zlib-devel bzip2-devel sqlite-devel libffi-devel openssl-devel pciutils net-tools lapack-devel gcc-gfortran xterm firefox openssh xdg-utils dbus-glib-devel gdb
- Check whether the Python development environment that meets the version requirements is installed. For details, see Dependencies. This step uses Python 3.7.x as an example. To run MindX SDK, the version must be 3.9.x.
Run the python3 --version command. If the returned information meets the Python version requirements (3.7.0 to 3.7.11), go to the next step. If the Python that meets the requirements has been installed in the environment, go to 2.e.
Otherwise, use the following procedure to install Python 3.7.5:
- 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 decompress 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
Replace the --prefix argument with the actual Python installation path. --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, build, and installation commands are executed, the installation package is output to the /usr/local/python3.7.5 directory, and the libpython3.7m.so.1.0 dynamic library is output to 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, you are advised not to write the preceding commands to the ~/.bashrc file.
- After the installation is complete, run the following commands to check the installed 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 the installation, 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. The following dependencies are mandatory. You can install other dependencies as required.
- 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 numpy --user. The installation command can be run in any path.
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 grpcio pip3 install pylint pip3 install absl-py
If the message "Could not find <Python.h>" or "fatal error:Python.h:No such file or directory" is displayed when you run the preceding commands, rectify the fault by referring to Python.h Is Not Installed or Cannot Be Found During Dependency Installation.
After the dependencies are installed, restore the umask value to the original one by deleting the umask 0022 line from the .bashrc file. For details, see Checking the umask Value of the root User. For security purposes, you are advised to change the umask value to 0027.