Installing the Python Connector

This topic provides instructions for installing the Snowflake Connector for Python. The connector can currently be installed in Linux, Mac OSX, and Windows environments.

The developer notes are hosted on GitHub, along with the source code.

In this Topic:


The following software packages are required to install the Snowflake Connector for Python.


The Snowflake Connector for Python requires either Python 2.7.9 (or higher) or 3.4.3 (or higher). To verify your version of Python:

python --version

For more information about installing the required version of Python, see:

Python Package Installer and Setup Tools

The Snowflake Connector for Python is installed by pip, a standard Python package installer and manager.

The latest version of pip is required to install the connector. Execute the following command to ensure the required version is installed:

python -m pip install --upgrade pip


  • On Mac OS X, use either virtualenv or pyvenv to install Python and the connector.
  • If both Python 2.7.x and Python 3.4.x are installed, use pip3 to install the connector with Python 3.4.x.
  • If pip (or pip3) is installed in the system directory or a shared directory, use sudo to run the above command, which ensures you have the privileges required to write/copy files to the directory.

pyOpenSSL on Mac OS X

Mac OS X (Yosemite and higher versions) includes Python 2.7.x, which can be used with the Snowflake Connector for Python. However, if your version of pyOpenSSL is out-of-date, you may encounter the following error if you are not using virtualenv:

File "/Library/Python/2.7/site-packages/snowflake/connector/", line nn, in dump_publickey
  bio = OpenSSL.crypto._new_mem_buf()
AttributeError: 'module' object has no attribute '_new_mem_buf'

To fix this issue, use one of the following two options:

  • Use either virtualenv or pyvenv to isolate the Python runtime environments.

  • Set the PYTHONPATH environment variable so that the newly-installed pyOpenSSL is used instead. For example:

    export PYTHONPATH=/Library/Python/2.7/site-packages

OpenSSL and FFI on Linux

When the Snowflake Connector for Python is installed, pip compiles native codes in the packages on Linux platforms. In order to install it successfully, install the required packages:

  • For CentOS, use yum:

    sudo yum install -y libffi-devel openssl-devel
  • For Ubuntu, use apt-get:

    sudo apt-get install -y libssl-dev libffi-dev

Other platforms do not need the OS packages installed because they are bundled in the Python packages.

Step 1: Install the Connector

The Snowflake Connector for Python is available in PyPI. A change log is available on the site, so you can determine the changes that have been implemented in each release.

To install the connector, execute the following command:

pip install --upgrade snowflake-connector-python

pip automatically installs all required modules.


  • As mentioned earlier, you may need to use sudo to run pip (or pip3), which ensures you have the privileges required to write/copy files.

  • If pip returns compilation errors, you may need to install the C compiler and Python development package to build some of the required modules, such as PyCryptoDome.

    For more information about installing a C compiler, see (Linux) or (Mac OS).

Step 2: Verify Your Installation

Create a file (e.g. containing the following Python sample code, which connects to Snowflake and displays the Snowflake version:

#!/usr/bin/env python
import snowflake.connector

# Gets the version
ctx = snowflake.connector.connect(
cs = ctx.cursor()
    cs.execute("SELECT current_version()")
    one_row = cs.fetchone()

Make sure to replace your_user_name, your_password, and your_account_name with the appropriate values for your Snowflake account.


The account can include not only the account name, but also the region and platform, in one of the formats shown below:

  • <account_name>
  • <account_name>.<region>
  • <account_name>.<region>.<platform>

For example:

  • ab12345

The account name is required.

The default region is us-west-2. You must specify the region if your region is not us-west-2 (or your platform is not aws).

The default platform is aws. You must specify the platform if your platform is not aws.

If you specify the platform, you must also specify the region.

For more information about regions, see Snowflake Regions.

For more information about the Snowflake Python API, see Python Connector API.

For more information about available connector parameters, see the snowflake.connector methods.

Then, execute the sample code. For example, if you created a file named


The Snowflake version (e.g. 2.50.0) should be displayed.

If you see the following error message, your Python installation likely does not have the appropriate security fixes:

ERROR: The ssl package installed with your Python package - version n.n.n -
does not have the required security fixes. Upgrade to 2.7.9/3.4.3 or higher.

Step 3: Specify a Temporary Directory

The Snowflake Connector for Python uses a temporary directory to store data for loading and unloading (PUT, GET), as well as other types of temporary data.

The temporary directory can be explicitly specified by setting the TMPDIR, TEMP or TMP environment variables, otherwise the operating system’s default temporary directory (i.e. /tmp, C:\temp) is used.

If the system’s default temporary directory volume is not large enough for the data being processed, you should specify a different directory using the TMPDIR environment variable. For example:

export TMPDIR=/large_tmp_volume