Import Python packages to use in notebooks¶
Snowflake Notebooks manages the Python packages used in your notebook environment. You can import third-party packages listed in the Snowflake Anaconda channel.
Considerations for importing packages¶
Packages that you add to a notebook are available only to that notebook. If you want to use the same package in a different notebook, you must add the same packages again to that notebook.
Notebook will restart when you add a new package. Snowflake recommends that you add your package at the top of your notebook at the start of your analysis.
Pre-installed Packages¶
By default, Snowflake Notebooks use Python 3.9. Notebook environments come pre-packaged with common libraries for data science and machine learning, such as altair, pandas, numpy, snowflake-snowpark-python, and Streamlit.
Import package from Anaconda¶
After your organization administrator accepts the terms, you can import libraries to use in Snowflake Notebooks.
Sign in to Snowsight.
Select Projects » Notebooks.
Select a specific notebook for which you want to install Python packages.
Select Packages menu at the top of your notebook.
Search for packages listed in the Snowflake Anaconda channel.
Select a package to install it for use in your notebook, and optionally change the default package version in the list of Installed Packages.
Packages installed by you appear under Installed Packages.
After the package is added, you can now import and use the libraries in a Python cell.
Import packages from a Snowflake stage¶
You can import packages from a stage if the package you need is not part of the pre-installed packages and is not available in the Anaconda channel.
The following limitations apply:
Package importer only works for Python modules and folders.
Wheel and tar.gz files are not supported.
Does not support any code which may be architecture dependent.
Follow these steps to add additional packages:
Sign in to Snowsight.
Select Projects » Notebooks.
Select a specific notebook for which you want to install Python packages.
Select Packages menu at the top of your notebook.
Select the Stage Packages tab.
Enter the path to the file on your stage.
After the package is added, you can now import and use the libraries in a Python cell. See this in action in the import packages from stage tutorial notebook.
Next steps¶
Now that you have all your packages installed, start coding in your notebook.