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. For information on importing packages in Container Runtime, see Notebooks on Container Runtime for ML.
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. 
- After you add a new package, you must restart the notebook session. 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 packages from Anaconda¶
After your organization administrator accepts the terms, you can import libraries to use in Snowflake Notebooks.
- Sign in to Snowsight. 
- In the navigation menu, 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, it may take some time to be installed. After it is installed, you will see a confirmation message and you can then import and use the libraries in a Python cell.
Import packages from a Snowflake stage¶
On both Warehouse and Container Runtime, 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:
- The package importer only works for Python modules and folders. 
- .tar.gzfiles are not supported.
- Wheel files are not supported on Warehouse Runtime. 
Follow these steps to add additional packages:
- Sign in to Snowsight. 
- In the navigation menu, select Projects » Notebooks. 
- Select a specific notebook for which you want to install Python packages. 
- Select the 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.
Now that all your packages are installed, start coding in your notebook.
