Preparing a Local Development Environment
If the built-in operators cannot meet your data processing requirements, you can develop custom operators. Before developing an operator, you must prepare a local development environment. This section describes how to install the development tool and operator development SDK.
Installing the Development Tool and Operator Development SDK
- Download and install PyCharm IDEA (Community Edition) or your preferred Python IDE.
- Install Python 3.10.
- Download the Python 3.10.x installation package from the Python official website and select Add Python to PATH during the installation.
- After the installation is complete, verify the installation on the terminal:
python --version
Expected output:
Python 3.10.x
- Install the general Python package management tool pip. If not, install pip by following the instructions provided at the pip official website after you install Python.
Take the Windows environment as an example. Run the pip --version command in the local environment. If the following information is displayed, pip has been installed:
C:\Users\xxxx>pip --version pip xx.x.x from D:\Python\py310\lib\site-packages\pip (python 3.10)
- 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
- 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:
- Install the operator development SDK.
- Download the ModelArts data refinement SDK software package for developing custom operators.
- Install the SDK using pip. To do so, run this command:
pip install modelarts_data_refiner-1.0.0-py3-none-any.whl
- After the installation is complete, check whether the installation is successful.
python -c "from modelarts.data.refiner.op.base_op import Mapper, Filter, BatchMapper, BatchFilter, Generator; print('SDK installed successfully')"Expected output:
SDK installed successfully
What is your overall rating for this page?
Thank 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