PyODPS is MaxCompute SDK for Python. PyODPS provides the DataFrame framework and basic operations on MaxCompute objects to help you analyze data in MaxCompute by using Python. You can use PyODPS in DataWorks or an on-premises environment. This topic describes how to install PyODPS when you use PyODPS in an on-premises environment.

Prerequisites

The version of Python meets requirements. We recommend that you use Python 3.6 or later. Python 2.7 or earlier is not recommended.

Procedure

  1. Run the following command to install PyODPS:
    pip install pyodps
  2. Run the following command to check whether the installation is successful:
    python -c "from odps import ODPS"
  3. If the Python version is not the default, you can run the following command to switch to the default version after you have installed pip:
    /home/tops/bin/python3.7 -m pip install setuptools>=3.0
    # /home/tops/bin/python3.7 is the directory in which Python is installed.

What to do next

  1. We recommend that you install greenlet 0.4.10 or later to accelerate Tunnel-based data upload.
  2. Initialize the MaxCompute entry point.
    from odps import ODPS
    
    o = ODPS('your-access-id', 'your-secret-access-key', 'your-default-project',endpoint='your-end-point')
    Parameters:
    • your-access-id and your-secret-access-key: Replace them with the AccessKey ID and AccessKey secret of your Alibaba Cloud account.
    • your-default-project and your-end-point: Replace them with the default project name and endpoint. For more information about the endpoints of each region, see Endpoints.
After you complete the preceding configurations, you can use PyODPS in your on-premises environment. For example, you can perform basic operations on MaxCompute objects, such as list, get, exist, create, and delete. For more information about how to use PyODPS, see Overview and Overview.
Note Unless otherwise specified, the o object in this topic is a MaxCompute object.