Help Center/ ModelArts/ SDK Reference/ (Optional) Installing the ModelArts SDK Locally
Updated on 2024-03-21 GMT+08:00

(Optional) Installing the ModelArts SDK Locally

To use the ModelArts SDK on a PC or VM, install the ModelArts SDK in the target environment. After the installation, you can call the ModelArts SDK to easily manage datasets, create ModelArts training jobs and AI applications, and deploy the AI applications as real-time services.

Procedure

To install the ModelArts SDK locally, perform the following operations:

ModelArts SDKs can be installed in Windows and Linux.

If an error occurred during the ModelArts SDK installation in Windows, rectify the fault by referring to FAQ: An Error Occurred During ModelArts SDK Installation in Windows.

Step 1: Download the ModelArts SDK Package

  1. Download the ModelArts SDK software package of the latest version.
  2. (Optional) Verify the software package signature.
    1. Download the signature verification file of the software package.
    2. Run the following command to install OpenSSL and verify software consistency:
      openssl cms -verify -binary -in D:\modelarts-latest-py2.py3-none-any.whl.cms -inform DER -content D:\modelarts-latest-py2.py3-none-any.whl  -noverify > ./test

      Replace the software package path in the example to the actual path.

Step 2: Configure the Runtime Environment

  1. Check whether Python has been installed locally. If not, download Python of a proper version at the Python official website and install it. The Python version must be later than 3.7.x and earlier than 3.10.x. Version 3.7.x is recommended.
    Run the python --version command in the local environment. If the following information is displayed, Python has been installed:
    C:\Users\xxx>python --version
    Python *.*.*
  2. Check whether pip, package installer for Python, has been installed. If not, install pip by following the instructions provided at the pip official website after you install Python.
    Run the pip --version command in the local environment. If the following information is displayed, pip has been installed:
    C:\Users\xxx>pip --version
    pip **.*.* from c:\users\xxx\appdata\local\programs\python\python**\lib\site-packages\pip (python *.*)

    In Windows, if a message is displayed indicating that the command is not an internal or external command, add the Python and pip installation paths to Path in the environment variable. The pip installation path is typically the Scripts folder in the directory where Python is located.

    1. Press Win+R, enter sysdm.cpl in the Run dialog box, and click OK.
    2. In the System Properties dialog box, click the Advanced tab and click Environment Variables.
    3. In the User variables for area, double-click Path. In the Edit environment variable dialog box, click New and add the Python and pip installation paths. The installation path must point to the Scripts folder, for example, C:\python\python**\Scripts.
  3. Configure the pip source. The following uses Windows as an example to describe how to configure the pip source:
    1. Create a pip folder. Start cmd and run the set command to view the AppData path. Create a pip folder in the obtained AppData path. An example is provided as follows:
      C:\Users\xxx>set
      ALLUSERSPROFILE=C:\ProgramData
      APPDATA=C:\Users\xxx\AppData\Roaming

      The preceding information indicates that the pip folder needs to be created in C:\Users\xxx\AppData\Roaming.

    2. Create a text file named pip in the pip folder and change the file name extension from .txt to .ini. An example is provided as follows:
      index-url is the IP address of the pip source, which needs to be replaced as required. The following uses a Huawei source as an example.
      [global]
      index-url = https://mirrors.huaweicloud.com/repository/pypi/simple  
      trusted-host = mirrors.huaweicloud.com  
      disable-pip-version-check = true
      timeout = 120
      [install] 
      ignore-installed = true
      no-dependencies = yes
  4. Start cmd and run the following command to download the package of the required pip source:
    C:\Users\xxx>pip install numpy       # Replace numpy with the package you want to download.

Step 3: Install the ModelArts SDK

Start cmd and run the following command to install the ModelArts SDK:

pip install {Path to the SDK software package}\modelarts-latest-py2.py3-none-any.whl

C:\Users\xxx>pip install C:\Users\xxx\Downloads\modelarts-latest-py2.py3-none-any.whl
......
Successfully installed Pillow-*.*.0 ... modelarts-*.*.* ...

When SDK is installed, dependency packages are installed by default. If message "Successfully installed" is displayed, the ModelArts SDK has been installed.

If an error message is displayed during the installation, indicating that a dependency package is missing, run the following command to install the dependency package as prompted:

pip install xxxx

xxxx is the name of the dependency package.

Follow-Up Operations

After installing ModelArts SDKs locally, you need to complete session authentication. After session authentication is complete, you can directly call the ModelArts SDKs.

FAQ: An Error Occurred During ModelArts SDK Installation in Windows

When installing the ModelArts SDK in Windows, ensure the Python version is not later than 3.10.x. Python 3.7.x is recommended.

If the error shown in the following figure is displayed when you install the SDK on the local computer, install the futures dependency package of version 3.1.1 and then reinstall the SDK.

pip install futures==3.1.1
Figure 1 Error message displayed during ModelArts SDK installation