You need to enable JavaScript to run this app.
Volcano Engine Function as a Service

Volcano Engine Function as a Service

Copy page
Download PDF
Python runtime
Installing dependencies
Copy page
Download PDF
Installing dependencies
For the Python runtime, veFaaS supports two methods for installing dependencies: online installation and packaging the dependencies together with your code for upload. This article introduces these two dependency installation methods.​
Online installation (Recommended)​
veFaaS checks for a requirements.txt file in the root directory of the code package and attempts to install the dependencies listed in the file via the command pip install.​
  1. To create a Python runtime function, see the section Creating event functions for detailed instructions.​
  1. Navigate to the Code tab of your target function and configure the dependencies in the requirements.txt file. Note that you need to follow the official syntax specification.​
  1. Click Install dependencies, and the system will start installing the dependencies online.​
  • All dependencies are installed into the site-packages directory.​
Packaging dependencies with code for upload​
Use a dependency manager such as pip to install dependencies locally, and then package them together with your function code for upload.​
warning​
  • When packaging, the function entry file index.py must be in the root directory of the .zip package. If you package the entire folder and upload the .zip package, the function creation will fail because the entry file cannot be found in the root directory after extraction.​
  • The size of the ZIP package must not exceed 256 MiB.​
  • There are differences between runtime environments. You need to ensure that the Python version you are using and the versions of the installed dependencies are compatible with your function runtime version. Run python -v in your local environment to check the Python version.​
  • The function runs on Debian, so you need to perform the installation in the same environment. If the environments are inconsistent, you may encounter errors indicating that dependencies cannot be found when the function runs after upload.​
  1. Configure dependencies in the requirements.txt file in the root directory of your local project. Note that you need to follow the official syntax specification.​
  1. In the root directory of your local project, run the following command to install the dependency packages.​
  • ​
    # The `-t` parameter allows you to specify the installation directory for dependency packages. When executed in the project code directory, use `-t .` to install packages into the current directory.​
    python -m pip install -r requirements.txt -t .​
    ​
  1. Run the following command to package all files in the root directory into a .zip archive named deployment.zip.​
  • ​
    # This example uses deployment.zip only for illustration; there are no restrictions on the actual file name​
    zip -r ./deployment.zip .​
    ​
  1. Upload the deployment.zip archive to the veFaaS console for deployment. For details, see Creating event functions.​
Last updated: 2026.08.19 14:06:05