Installation Procedure (Ubuntu)
Checking Sources
The installation requires the download of related dependencies. Ensure that the installation environment can be connected to the network.
Run the following command as the root user to check whether the source is available:
apt-get update
If an error is reported during command execution or dependency installation, check whether the network connection is normal, or replace the sources in the /etc/apt/sources.list file with available sources or use mirrored sources.
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 IDE 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 dpkg -l zlib1g-dev| grep zlib1g-dev| grep ii dpkg -l libbz2-dev| grep libbz2-dev| grep ii dpkg -l libsqlite3-dev| grep libsqlite3-dev| grep ii dpkg -l libssl-dev| grep libssl-dev| grep ii dpkg -l libffi-dev| grep libffi-dev| grep ii dpkg -l liblzma-dev| grep liblzma-dev| grep ii dpkg -l unzip| grep unzip| grep ii dpkg -l pciutils| grep pciutils| grep ii dpkg -l net-tools| grep net-tools| grep ii dpkg -l libblas-dev| grep libblas-dev| grep ii dpkg -l gfortran| grep gfortran| grep ii dpkg -l libblas3| grep libblas3| grep ii dpkg -l liblapack-dev| grep liblapack-dev| grep ii dpkg -l openssh-server| grep openssh-server| grep ii dpkg -l xterm| grep xterm| grep ii dpkg -l firefox| grep firefox| grep ii dpkg -l xdg-utils| grep xdg-utils| grep ii dpkg -l libdbus-glib-1-dev | grep libdbus-glib-1-dev | grep ii dpkg -l gdb | grep gdb | grep ii
You should see output similar to the following if the software has been installed.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
gcc (Ubuntu 7.3.0-3ubuntu1~18.04) 7.3.0 g++ (Ubuntu 7.3.0-3ubuntu1~18.04) 7.3.0 GNU Make 4.1 cmake version 3.10.2 ii zlib1g-dev:arm64 1:1.2.11.dfsg-0ubuntu2 arm64 compression library - development ii libbz2-dev:arm64 1.0.6-8.1ubuntu0.2 arm64 high-quality block-sorting file compressor library - development ii libsqlite3-dev:arm64 3.22.0-1ubuntu0.3 arm64 SQLite 3 development files ii libssl-dev:arm64 1.1.1-1ubuntu2.1~18.04.6 arm64 Secure Sockets Layer toolkit - development files ii libffi-dev:arm64 3.2.1-8 arm64 Foreign Function Interface library (development files) ii liblzma-dev:amd64 5.2.2-1.3 amd64 XZ-format compression library - development files ii unzip 6.0-21ubuntu1 arm64 De-archiver for .zip files ii pciutils 1:3.5.2-1ubuntu1 arm64 Linux PCI Utilities ii net-tools 1.60+git20161116.90da8a0-1ubuntu1 arm64 NET-3 networking toolkit ii libblas-dev:arm64 3.7.1-4ubuntu1 arm64 Basic Linear Algebra Subroutines 3, static library ii gfortran 4:7.4.0-1ubuntu2.3 arm64 GNU Fortran 95 compiler ii libblas3:arm64 3.7.1-4ubuntu1 arm64 Basic Linear Algebra Reference implementations, shared library ii liblapack-dev:arm64 3.7.1-4ubuntu1 arm64 Library of linear algebra routines 3 - static version ii openssh-server 1:7.6p1-4ubuntu0.5 arm64 secure shell (SSH) server, for secure access from remote machines ii xterm 330-1ubuntu2 arm64 X terminal emulator ii firefox 83.0+build2-0ubuntu0.18.04.2 arm64 Safe and easy web browser from Mozilla ii xdg-utils 1.1.2-1ubuntu2.5 all desktop integration utilities from freedesktop.org ii libdbus-glib-1-dev 0.110-2 arm64 deprecated library for D-Bus IPC (development files) ii gdb 8.1.1-0ubuntu1 arm64 GNU Debugger
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.sudo apt-get install -y gcc g++ make cmake zlib1g-dev libbz2-dev libsqlite3-dev libssl-dev libffi-dev unzip pciutils net-tools libblas-dev gfortran libblas3 liblapack-dev openssh-server xterm firefox xdg-utils libdbus-glib-1-dev gdb
- 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.
- libsqlite3-dev must be installed before Python installation. If the Python environment that meets version requirements has been installed in the user's OS and libsqlite3-dev is installed after the Python environment is installed, you need to rebuild the Python environment.
- Check whether the Python development environment that meets the version requirements is installed. For details, see Table 1. This step uses Python 3.7.x as an example. To run MindSDK, 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.
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 and run the following 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
The --prefix option specifies the Python installation path. You can change it as required. The --enable-shared option is used to build the libpython3.7m.so.1.0 dynamic library. The --enable-loadable-sqlite-extensions parameter is used to load libsqlite3-dev.
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.
1 2
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 to the end of each command, for example, pip3 install numpy --user.
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 error message "subprocess.CalledProcessError: Command '('lsb_release', '-a')' return non-zero exit status 1" is displayed, rectify the fault by referring to What Do I Do If "subprocess.CalledProcessError: Command '('lsb_release', '-a')' return non-zero exit status 1" Is Displayed During pip3 Installation?.
- 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.