Troubleshooting Python UDFs¶
This topic provides troubleshooting information about Python UDFs (user-defined functions).
Problem: A required Python library is not available through Anaconda¶
Third-party Python libraries, which do not have C/C++ extensions, can be imported by UDFs directly via Snowflake stages. For more information, see Creating a Python UDF With Code Uploaded from a Stage.
To learn how to submit a request to support additional Anaconda packages, see Using Third-Party Packages.
Problem: A UDF fails with the error “Function available memory exhausted”¶
Reduce the amount of memory used by the UDF.
Check the UDF code for bugs or memory leaks.
For more information, see Memory.
Problem: I want to extract ZIP or other archives inside a UDF¶
To see an example of how to upload a ZIP file to a Snowflake stage and then unzip it into the
inside the UDF, see Unzipping a Staged File.
Problem: UDF performance is slow¶
For information about how to improve the performance of UDFs, see Optimizing for Scale and Performance.
Problem: The ORGADMIN role is not enabled so Anaconda packages cannot be used¶
When going through the steps to get started using third-party packages from Anaconda, the organization administrator (ORGADMIN) role is required.
To resolve this problem, follow the instructions in Enabling the ORGADMIN Role for an Account.
Training machine learning (ML) models can sometimes be very resource intensive. Snowpark-optimized warehouses are a type of Snowflake virtual warehouse that can be used for workloads that require a large amount of memory and compute resources. For information on machine learning models and Snowpark Python, see Training Machine Learning Models with Snowpark Python.
If using a Python UDF in a masking policy, ensure the data type of the column, UDF, and masking policy match.
For troubleshooting information about third-party packages, see Known Issues with Third-Party Packages.