Configuring the Python3 Sample Project
Scenario
To run the Python3 interface example codes of the Hive component of FusionInsight MRS, perform the following operations.
Procedure
- Python3 of 3.6 or a higher version has been installed on a client. The Python3 version cannot be higher than 3.8.
The Python version can be viewed by running the python3 command on the command-line interface (CLI) of the client. The following information indicates that the Python version is 3.8.2.
Python 3.8.2 (default, Jun 23 2020, 10:26:03) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux Type "help", "copyright", "credits" or "license" for more information.
- Setuptools of 47.3.1 version has been installed on a client.
To obtain the software, visit the official website.
https://pypi.org/project/setuptools/#files
Copy the downloaded setuptools package to the client, decompress the package, go to the decompressed directory, and run the python3 setup.py install command in the CLI of the client.
The following information indicates that setuptools 47.3.1 is installed successfully.
Finished processing dependencies for setuptools==47.3.1
If the system displays a message indicating that the installation of setuptools of 47.3.1 fails, check whether the environment is faulty or whether the problem is caused by Python.
- Install Python on the client.
- Obtain the sample project folder python3-examples in the src\hive-examples directory where the sample code is decompressed. For details, see Obtaining the MRS Application Development Sample Project.
- Go to the python3-examples folder.
- Go to the dependency_python3.6, dependency_python3.7, or dependency_python3.8 folder based on the Python3 version.
- Run the whereis easy_install command to find the path of the easy_install program. If there are multiple paths, run the easy_install --version command to select the easy_install path corresponding to the setuptools version, for example, /usr/local/bin/easy_install.
- Versions earlier than MRS 3.2.0, run the easy_install command to install the egg files in the dependency_python3.x folder in sequence. Example:
/usr/local/bin/easy_install future-0.18.2-py3.8.egg
The following information indicates that egg is installed successfully.
Finished processing dependencies for future==0.18.2
If egg files of both aarch64 and x86_64 versions exist in the dependency_python3.x folder, you need to select one of the versions based on the operating system and run the uname -p command to check the current operating system architecture.
- In MRS 3.2.0 and later versions, run the easy_install command to install the egg files in the dependency_python3.x folder. If the egg file has dependencies, you can use wildcards to install the egg file. For example:
- dependency_python3.6 directory:
/usr/local/bin/easy_install future*egg six*egg python*egg sasl-*linux-$(uname -p).egg thrift-*egg thrift_sasl*egg
- dependency_python3.7 directory:
/usr/local/bin/easy_install future*egg six*egg sasl-*linux-$(uname -p).egg thrift-*egg thrift_sasl*egg
- dependency_python3.8 directory:
/usr/local/bin/easy_install future*egg six*egg python*egg sasl-*linux-$(uname -p).egg thrift-*linux-$(uname -p).egg thrift_sasl*egg
If the following information is displayed for each egg file, the installation is successful:
Finished processing dependencies for ***
- dependency_python3.6 directory:
- After the installation is successful, the following files are generated. python3-examples/pyCLI_sec.py is the Python client example codes. python3-examples/pyhive/hive.py is the Python client API.
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