Skip to content

Script Development / Installing Third-Party Packages

After DataFlux Func is installed, since DataFlux Func itself requires third-party packages, these packages can be used directly in scripts without additional installation.

The specific list of pre-installed third-party packages can be viewed in Manage / PIP Tool, where packages marked as Yes in the Built-in column are the pre-installed third-party packages.

If users need to install additional third-party packages, they can also do so in Manage / PIP Tool.

1. Installing Python Packages via Public Network

If the DataFlux Func requiring additional third-party packages can directly access the public network, then the system's built-in PIP Tool can be used for installation.

1.1 Enable PIP Tool

Enable PIP Tool in Manage / Experimental Features.

enable-pip-tool.png

1.2 Install Third-Party Packages

In the PIP Tool, you can select a PyPI mirror, enter the package name, and then install it.

If you need to specify a version, you can use the format package==1.2.3 to install.

install-package.png

Select Mirror

If your server cannot directly access PyPI for some reason, you can choose a different PIP mirror at this time.

2. Installing Python Packages Without Public Network Access

If the server where DataFlux Func is located cannot access the external network for various reasons, the usual PIP method cannot be used to install third-party packages.

In this case, another DataFlux Func with the same architecture and access to the public network is needed to install the third-party packages. After installation, copy the entire extra-python-packages directory to the DataFlux Func that cannot access the public network.

In the following text, the DataFlux Func with public network access is referred to as Online Func, and the DataFlux Func without public network access is referred to as Offline Func.

2.1 Install Third-Party Packages on Online Func

Please refer to the section above Installing Packages from PyPi When Public Network is Accessible for this step.

2.2 Enable File Manager Module

Enable File Manager Module in Manage / Experimental Features.

enable-file-manager.png

2.3 Download the Third-Party Packages Directory from Online Func

Locate the extra-python-packages directory (all content of additionally installed Python packages will be stored here), select More / Compress, and download the zip file.

zip-pkg.png

download-pkg.png

2.4 Upload the Third-Party Packages Directory to Offline Func

Go to Offline Func, delete the original third-party packages storage directory, upload the zip file downloaded in the previous step, and extract it.

delete-pkg.png

upload-pkg.png

unzip-pkg.png

unzip-pkg-done.png

2.5 Restart Offline Func

Please refer to Deployment and Maintenance / Upgrade and Restart for this step.

Notes

DataFlux Func runs in Docker, and the Python runtime environment also depends on the container environment.

Therefore, please do not copy content from your local machine or other non-DataFlux Func container Python installations into DataFlux Func. Otherwise, strange issues often arise.

Additionally: Online Func and Offline Func must guarantee the same hardware architecture, such as both being x86_64 or aarch64.

Theoretically, it is feasible to upload a Wheel package to the server and install it directly via PIP, but in practice, it is not successful in most cases.

The reason is that the uploaded Wheel package itself may depend on other packages. Simply uploading the Wheel package used directly in the code cannot satisfy the dependency relationships. The more powerful the package, the more other packages it generally depends on, and the deeper the dependency hierarchy. This may eventually trap the operator in dependency hell.

Therefore, unless the package to be installed does not depend on any other packages, it is generally not recommended to install Python third-party packages by uploading Wheel packages.