How to Build a Crcmod on MaxCompute

By Ji Sheng

For binary packages, MaxCompute requires wheel packages with cp27-cp27m contained in their package names. However, for packages that have not been updated for a long time, for example, the crcmod package on which oss2 depends, PyPI does not provide wheel packages. Therefore, you have to create wheel packages yourself. This article describes how to use the image to build a wheel package that can be used on MaxCompute.

This article uses as a reference. The image is also the standard tool that the majority of Python projects currently use for packaging on Travis CI. If you have any further questions, you can study this project.

Prepare Dependencies

Many packages have dependencies, such as the devel rpm package or other Python packages. You need to know the dependencies of a specific package before packaging. Information about installation and packaging can usually be found on GitHub. The crcmod package has no other dependencies except gcc. Therefore, you can skip this step.

Modify and Verify (Recommended on Mac OS or Linux)

Older Python packages generally do not support building wheel packages. Specifically, an error is reported when ‘python bdist_wheel’ is used for packaging. To build wheel packages, you need to modify For some packages, you can simply replace the setup function in distutils with the setup function in setuptools. For packages that require many custom operations in, you need to analyze the packaging process in detail. This is complicated and thus not discussed in this article.

For example, for crcmod, change


After making the preceding change, run the following in the root directory of the project:

If no errors are reported and the generated wheel package can be used locally, it indicates that is available.

Prepare the Packaging Script

Create a bin directory in the project and under that directory:

Enter the following content:

Enter the dependency installation script that you obtained in Step 1 into this script. Make sure to use the version in /opt/python/cp27-cp27m/bin when using Python or pip.

Finally, set the execute permission.


Use Docker to download the required image and package the root directory of the project (Docker is required in this step. Please install it in advance):

The generated wheel package is in the wheelhouse directory under the root directory of the project.


Follow me to keep abreast with the latest technology news, industry insights, and developer trends.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store