Configuring JetBrains PyCharm for your Snowpark Python Development

Photo by Alberto Restifo on Unsplash

Snowpark Python (in Public Preview as of June 2022) is getting popular amongst many Python developers as a great alternative to PySpark eliminating many hassles like configuring numerous Spark config options and keeping up with new Spark versions and providing a brand-new experience with scalability and ease of use in mind.

Snowpark leverages Snowflake Data Cloud’s compute power with unlimited scalability. Snowpark Python syntax is very similar to Pyspark syntax so there is no learning curve if you are already familiar with the PySpark syntax.

If you love PyCharm as your Python IDE, you can certainly use PyCharm as an IDE for your Snowpark Python development.

Below are the simple steps to configure PyCharm for Snowpark Python (PrPr) development (assuming that you already have PyCharm installed in your local machine):

1) Please download and install Anaconda on your local machine (if you don’t have it already)

https://www.anaconda.com/products/individual

Make sure you are installing for Python 3.8 or higher.

2) Then create a Python 3.8 conda environment (I am using ‘snowpark’ for this example) and download and install snowpark python library (Private Preview installation only):

conda create — name snowpark python=3.8

conda activate snowpark

pip install ‘snowflake_snowpark_python-0.x.0-py3-none-any.whl[pandas]’

(Please note that the snowpark package is provided as a .whl file during Private Preview only.)

3) Also install all other Python packages you might need using pip or conda

e.g. pip install matplotlib

4) Go to your PyCharm IDE and create a new Project like the one below and click on the Create button.

Once the project is created, click on PyCharm > Preferences

and click on the Python Interpreter link below:

In the drop-down, select Show All and click on the + (Add).

In the Add Python Interpreter screen, choose Conda Environment and select the Existing environment option and select the location of the conda environment (‘snowpark’) we created in Step 2. Click OK.

In the next screen, select the new interpreter we just created and click on OK again.

Again, click on the OK button below:

Reference: https://www.jetbrains.com/help/pycharm/2020.3/conda-support-creating-conda-virtual-environment.html

That’s it. Now you can create a .py file and start developing after importing the snowpark packages in your code as below:

Happy Snowpark developing with your PyCharm IDE!

--

--

Eda Johnson
Snowflake Builders Blog: Data Engineers, App Developers, AI/ML, & Data Science

AWS Machine Learning Specialty | Azure | Databricks | GCP | Snowflake Advanced Architect | Terraform certified Principal Data Cloud Architect