Script Development / Installing Third-Party Packages
After DataFlux Func is installed, since DataFlux Func itself requires third-party packages, these packages can be directly used in scripts without additional installation.
The specific list of pre-installed third-party packages can be viewed in "Manage / PIP Tool", where the "Built-in" column marked as Yes
indicates 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 from the Internet
If DataFlux Func can directly access the internet for additional third-party packages, the system's built-in "PIP Tool" can be used for installation.
1.1 Enabling "PIP Tool"
Enable the "PIP Tool" in "Manage / Experimental Features".
1.2 Installing Third-Party Packages
In the "PIP Tool", you can select a Pypi mirror, enter the package name, and proceed with the installation.
If a specific version is required, you can use the format package==1.2.3
to install.
Selecting a Mirror
If your server cannot directly access PYPI for some reason, you can choose a different PIP mirror.
2. Installing Python Packages Without Internet Access
If the server where DataFlux Func is located cannot access the internet 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 internet access is needed to install third-party packages. After installation, the entire extra-python-packages
directory should be copied to the DataFlux Func without internet access.
In the following text, the DataFlux Func with internet access is referred to as "Online Func"; the DataFlux Func without internet access is referred to as "Offline Func".
2.1 Installing Third-Party Packages on Online Func
Please refer to the above section "Installing Packages from Pypi When Internet Access is Available".
2.2 Enabling "File Service"
Enable the "File Service" in "Manage / Experimental Features".
2.3 Downloading the Third-Party Packages Directory from Online Func
Locate the extra-python-packages
directory (all additional Python packages will be stored here), select "More / Compress", and download the zip file.
2.4 Uploading the Third-Party Packages Directory to Offline Func
Go to "Offline Func", delete the original third-party packages directory, and upload the zip file downloaded in the previous step, then extract it.
2.5 Restarting Offline Func
Please refer to Deployment and Maintenance Guide / Upgrading and Restarting
Notes
DataFlux Func runs in Docker, and the Python runtime environment also depends on the container environment.
Therefore, do not copy Python installations from your local machine or other non-DataFlux Func containers into DataFlux Func. Otherwise, strange issues may arise.
Additionally: "Online Func" and "Offline Func" must have the same hardware architecture, such as both being x86_64
or aarch64
.
3. Why is it Not Recommended to Install Python Packages Directly by Uploading Wheel Packages?
Uploading Wheel packages to the server and installing them directly via PIP is theoretically feasible, but in most cases, it does not succeed.
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 dependencies it generally has, and the deeper the dependency hierarchy. This can 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 use the method of uploading Wheel packages to install third-party Python packages.