snowflake.snowpark.Session.add_packages¶
- Session.add_packages(*packages: str | module | Iterable[str | module]) None[source]¶
Adds third-party packages as dependencies of a user-defined function (UDF). Use this method to add packages for UDFs as installing packages using conda. You can also find examples in
UDFRegistration. See details of third-party Python packages in Snowflake.- Parameters:
packages – A requirement specifier, a
moduleobject or a list of them for installing the packages. An exception will be raised if two conflicting requirement specifiers are provided. The syntax of a requirement specifier is defined in full in PEP 508, but currently only the version matching clause (==) is supported as a version specifier for this argument. If amoduleobject is provided, the package will be installed with the version in the local environment.
Example:
Note
1. This method will add packages for all UDFs created later in the current session. If you only want to add packages for a specific UDF, you can use
packagesargument infunctions.udf()orsession.udf.register().2. We recommend you to setup the local environment with Anaconda, to ensure the consistent experience of a UDF between your local environment and the Snowflake server.