(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:
- Step 1: Download the ModelArts SDK Package
- Step 2: Configure the Runtime Environment
- Step 3: Install the ModelArts SDK
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
- Download the ModelArts SDK software package of the latest version.
- (Optional) Verify the software package signature.
- Download the signature verification file of the software package.
- 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
- 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 *.*.*
- 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.
- Press Win+R, enter sysdm.cpl in the Run dialog box, and click OK.
- In the System Properties dialog box, click the Advanced tab and click Environment Variables.
- 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.
- Configure the pip source. The following uses Windows as an example to describe how to configure the pip source:
- 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.
- 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
- 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:
- 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
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot