MindSpore Serving Installation
Installation
MindSpore Serving supports the Ascend 310, Ascend 910 and Nvidia GPU environments.
MindSpore Serving depends on the MindSpore training and inference framework. Therefore, install MindSpore and then MindSpore Serving. You can install MindInsight either by pip or by source code.
Installation by pip
Perform the following steps to install Serving:
If use the pip command, download the .whl package from the MindSpore Serving page and install it.
pip install https://ms-release.obs.cn-north-4.myhuaweicloud.com/{version}/Serving/{arch}/mindspore_serving-{version}-{python_version}-linux_{arch}.whl --trusted-host ms-release.obs.cn-north-4.myhuaweicloud.com -i https://pypi.tuna.tsinghua.edu.cn/simple
{version}
denotes the version of MindSpore Serving. For example, when you are downloading MindSpore Serving 1.1.0,{version}
should be 1.1.0.
{arch}
denotes the system architecture. For example, the Linux system you are using is x86 architecture 64-bit,{arch}
should bex86_64
. If the system is ARM architecture 64-bit, then it should beaarch64
.
{python_version}
spcecifies the python version for which MindSpore is built. If you wish to use Python3.7.5,{python_version}
should becp37-cp37m
. If Python3.9.0 is used, it should becp39-cp39
. Please use the same Python environment whereby MindSpore is installed.
Installation by Source Code
Download the source code and go to the serving
directory.
Method 1: Specify the path of the installed or built MindSpore package on which Serving depends and install Serving.
sh build.sh -p $MINDSPORE_LIB_PATH
In the preceding information, build.sh
is the build script file in the serving
directory, and $MINDSPORE_LIB_PATH
is the lib
directory in the installation path of the MindSpore software package, for example, softwarepath/mindspore/lib
. This path contains the library files on which MindSpore depends.
Method 2: Directly build Serving. The MindSpore package is built together with Serving. You need to configure the environment variables for MindSpore building.
# GPU
sh build.sh -e gpu
# Ascend 310 and Ascend 910
sh build.sh -e ascend
In the preceding information, build.sh
is the build script file in the serving
directory. After the build is complete, find the .whl installation package of MindSpore in the serving/third_party/mindspore/build/package/
directory and install it.
pip install mindspore_ascend-{version}-{python_version}-linux_{arch}.whl
Find the .whl installation package of Serving in the serving/build/package/
directory and install it.
pip install mindspore_serving-{version}-{python_version}-linux_{arch}.whl
Installation Verification
Run the following commands to verify the installation. Import the Python module. If no error is reported, the installation is successful.
from mindspore_serving import server
Configuring Environment Variables
To run MindSpore Serving, configure the following environment variables:
MindSpore Serving depends on MindSpore. You need to configure environment variables to run MindSpore.