This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
I'm building a Snowflake connector using the Python SDK but have hit an issue when creating the virtual environment (this is in Alteryx 2020.4.5.12471)
Firstly if I use the standard Python tool, run as an administrator and run
pip install snowflake-connector-python
This installs without any problems and using the import works perfectly. So in Alteryx's own Python tool everything works fine.
Next I create my custom tool using a virtual environment.(Snowflake_venv). Everything packages fine and installs correctly and without errors but when I use the tool in Alteryx I get this stack trace.
Error: Snowflake Output (1): Traceback (most recent call last):
File "SnowflakeEngine.py", line 15, in <module>
File "C:\Users\bob\AppData\Roaming\Alteryx\Engine/../Tools\Snowflake_venv\Lib\site-packages\snowflake\connector\__init__.py", line 17, in <module>
from .connection import SnowflakeConnection
File "C:\Users\bob\AppData\Roaming\Alteryx\Engine/../Tools\Snowflake_venv\Lib\site-packages\snowflake\connector\connection.py", line 22, in <module>
from .auth import Auth
File "C:\Users\bob\AppData\Roaming\Alteryx\Engine/../Tools\Snowflake_venv\Lib\site-packages\snowflake\connector\auth.py", line 19, in <module>
from .auth_keypair import AuthByKeyPair
File "C:\Users\bob\AppData\Roaming\Alteryx\Engine/../Tools\Snowflake_venv\Lib\site-packages\snowflake\connector\auth_keypair.py", line 20, in <module>
from .network import KEY_PAIR_AUTHENTICATOR
File "C:\Users\bob\AppData\Roaming\Alteryx\Engine/../Tools\Snowflake_venv\Lib\site-packages\snowflake\connector\network.py", line 19, in <module>
File "C:\Users\bob\AppData\Roaming\Alteryx\Engine/../Tools\Snowflake_venv\Lib\site-packages\OpenSSL\__init__.py", line 8, in <module>
from OpenSSL import crypto, SSL
File "C:\Users\bob\AppData\Roaming\Alteryx\Engine/../Tools\Snowflake_venv\Lib\site-packages\OpenSSL\crypto.py", line 15, in <module>
from OpenSSL._util import (
File "C:\Users\bob\AppData\Roaming\Alteryx\Engine/../Tools\Snowflake_venv\Lib\site-packages\OpenSSL\_util.py", line 6, in <module>
from cryptography.hazmat.bindings.openssl.binding import Binding
File "C:\Users\bob\AppData\Roaming\Alteryx\Engine/../Tools\Snowflake_venv\Lib\site-packages\cryptography\hazmat\bindings\openssl\binding.py", line 14, in <module>
from cryptography.hazmat.bindings._openssl import ffi, lib
ImportError: DLL load failed while importing _openssl: The specified module could not be found.
I checked the packages installed in the Snowflake_venv I created and they are exactly the same as the ones in the JupyterTool_venv so it doesn't seem to be caused by different package versions.
When I created a virtual environment it does so with an old version of pip (version 18). When I try to install snowflake-connector-python, I get an error building the openssl package. After I upgrade to the latest version of pip (version 20), installation of snowflake-connector-python works just fine and I can import it in my code without a problem.
Can you try running the following command in your virtual environment and then re-install the Snowflake connector?
python -m pip install --upgrade pip
Note: I think this issue only happens when you manually create a virtual environment. If you package your tool as a YXI, Alteryx will upgrade pip as part of the installation process, so your users should not run into this error.
thanks for the input but unfortunately it doesn't fix my issue ☹️
I'm creating a virtual environment and then packaging into a YXI using the requirements.txt file before installing. The package installs fine with no errors and I confirm the version of pip it installs is 20.1.1.
The environment looks fine but I still get this error.
OK, so I managed to fix my own problem 😂 Details are here is anyone else hits this issue.
Basically when you create a virtual environment using the SDK tool it automatically uses the latest versions of all the libraries and it turn out these are not compatible with each other. After checking the Snowflake site I found a requirements file that has been tested against Python 3.8 that Alteryx now uses.