Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add new python package for Snowpark

I am using Snowpark for Python. I want to import imblearn package but when I check pre-installed packages at https://repo.anaconda.com/pkgs/snowflake/ this package is not installed in the Snowpark anaconda environment. How can use this package on snowpark?

like image 581
Emre Becit Avatar asked Oct 20 '25 07:10

Emre Becit


2 Answers

A number of open source third-party Python packages that are built and provided by Anaconda are made available to use out of the box inside Snowflake.

Snowflake is constantly adding new packages. But if you don't find a specific package then

  • First check if the package has only native python code(pure python package), if so, then install the package to your local, zip it and put it to the snowflake stage and add this stage path in the imports parameter or add_import() method. This should work.

  • If not, all one can do is wait for it to be available.

Also in snowflake you can use this query to get the details about the packages:
select * from information_schema.packages where language = 'python';

like image 75
Poorna Avatar answered Oct 21 '25 23:10

Poorna


If the package you want to use only have native Python code then you might be able to use it.

Simplest way is to install the package into your local environment and then zip the installation directory and and add that zip using the IMPORTS parameter when using CREATE FUNCTION or the add_import() method if using Snowpark API.

like image 20
Mats Stellwall Avatar answered Oct 21 '25 21:10

Mats Stellwall



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!