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.
import snowflake.connector
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>
import OpenSSL.SSL
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.
asn1crypto==1.4.0
azure-common==1.1.26
azure-core==1.9.0
azure-storage-blob==12.6.0
boto3==1.16.33
botocore==1.19.33
certifi==2020.12.5
cffi==1.14.4
chardet==3.0.4
cryptography==3.3
idna==2.10
isodate==0.6.0
jmespath==0.10.0
msrest==0.6.19
oauthlib==3.1.0
oscrypto==1.2.1
pycparser==2.20
pycryptodomex==3.9.9
PyJWT==1.7.1
pyOpenSSL==19.1.0
python-dateutil==2.8.1
pytz==2020.4
requests==2.23.0
requests-oauthlib==1.3.0
s3transfer==0.3.3
six==1.15.0
snowflake-connector-python==2.3.7
urllib3==1.25.11
Right now my best guess is that some DLL files used by OpenSSL are not being referenced correctly in the venv but I'm not sure why this works in the Python tool but not in the SDK.
Any help would be appreciated 😎