snowflakedb / snowflake-connector-python

Snowflake Connector for Python
https://pypi.python.org/pypi/snowflake-connector-python/
Apache License 2.0
582 stars 468 forks source link

SNOW-847568: Failure during pip install #1614

Closed OutlierTom closed 1 year ago

OutlierTom commented 1 year ago

Python version

3.7

Operating system and processor architecture

Windows 10

Installed packages

C:\Users\g031240>python -m pip freeze
altgraph==0.17.2
asgiref==3.4.1
Babel==2.8.0
Brotli==1.0.9
cachetools==5.0.0
certifi==2020.6.20
charset-normalizer==3.1.0
click==8.0.1
colorama==0.4.4
cycler==0.10.0
dash==1.20.0
dash-core-components==1.16.0
dash-html-components==1.1.3
dash-renderer==1.9.1
dash-table==4.11.3
diptest==0.5.1
dj-plotly-dash==0.17.0
Django==3.1.13
duckdb==0.8.0
et-xmlfile==1.1.0
Flask==2.0.1
Flask-Compress==1.10.1
future==0.18.2
idna==3.4
importlib-metadata==4.6.1
itsdangerous==2.0.1
Jinja2==3.0.1
kiwisolver==1.2.0
MarkupSafe==2.0.1
matplotlib==3.3.2
numpy==1.19.2
openpyxl==3.0.9
pandas==1.1.3
pefile==2021.9.3
Pillow==8.0.0
plotly==5.7.0
prettytable==3.4.1
psutil==5.9.2
py2exe==0.11.1.0
pyarrow==4.0.0
pyinstaller==4.9
pyinstaller-hooks-contrib==2022.2
pyodbc==4.0.32
pyparsing==2.4.7
pyperclip==1.8.2
python-dateutil==2.8.1
pytz==2020.1
pyusb==1.1.1
pywin32==228
pywin32-ctypes==0.2.0
requests==2.30.0
scipy==1.5.3
seaborn==0.11.1
six==1.15.0
sqlparse==0.4.1
tenacity==7.0.0
tk==0.1.0
tkcalendar==1.6.1
typing-extensions==3.10.0.0
urllib3==2.0.2
usb==0.0.83.dev0
wcwidth==0.2.5
Werkzeug==2.0.1
XlsxWriter==3.0.2
zipp==3.5.0

What did you do?

pip install snowflake-connector-python

What did you expect to see?

Should have installed but got the following compile error:

C:\Users\g031240>pip install snowflake-connector-python Collecting snowflake-connector-python Using cached https://files.pythonhosted.org/packages/76/9e/e9c95d008bd693250a8c6bba5034307da1b15e2e73d1c45d7a9374c5eb69/snowflake_connector_python-3.0.4-cp37-cp37m-win_amd64.whl Collecting pyjwt<3.0.0 (from snowflake-connector-python) Using cached https://files.pythonhosted.org/packages/c7/e8/01b2e35d81e618a8212e651e10c91660bdfda49c1d15ce66f4ca1ff43649/PyJWT-2.7.0-py3-none-any.whl Requirement already satisfied: certifi>=2017.4.17 in c:\python37\lib\site-packages (from snowflake-connector-python) (2020.6.20) Collecting sortedcontainers>=2.4.0 (from snowflake-connector-python) Using cached https://files.pythonhosted.org/packages/32/46/9cb0e58b2deb7f82b84065f37f3bffeb12413f947f9388e4cac22c4621ce/sortedcontainers-2.4.0-py2.py3-none-any.whl Collecting asn1crypto<2.0.0,>0.24.0 (from snowflake-connector-python) Using cached https://files.pythonhosted.org/packages/c9/7f/09065fd9e27da0eda08b4d6897f1c13535066174cc023af248fc2a8d5e5a/asn1crypto-1.5.1-py2.py3-none-any.whl Requirement already satisfied: importlib-metadata; python_version < "3.8" in c:\python37\lib\site-packages (from snowflake-connector-python) (4.6.1) Requirement already satisfied: idna<4,>=2.5 in c:\python37\lib\site-packages (from snowflake-connector-python) (3.4) Collecting cryptography<41.0.0,>=3.1.0 (from snowflake-connector-python) Using cached https://files.pythonhosted.org/packages/f7/80/04cc7637238b78f8e7354900817135c5a23cf66dfb3f3a216c6d630d6833/cryptography-40.0.2.tar.gz Installing build dependencies ... done Getting requirements to build wheel ... done Preparing wheel metadata ... done Collecting oscrypto<2.0.0 (from snowflake-connector-python) Using cached https://files.pythonhosted.org/packages/01/7c/fa07d3da2b6253eb8474be16eab2eadf670460e364ccc895ca7ff388ee30/oscrypto-1.3.0-py2.py3-none-any.whl Requirement already satisfied: requests<3.0.0 in c:\python37\lib\site-packages (from snowflake-connector-python) (2.30.0) Collecting urllib3<1.27,>=1.21.1 (from snowflake-connector-python) Using cached https://files.pythonhosted.org/packages/c5/05/c214b32d21c0b465506f95c4f28ccbcba15022e000b043b72b3df7728471/urllib3-1.26.16-py2.py3-none-any.whl Collecting typing-extensions<5,>=4.3 (from snowflake-connector-python) Using cached https://files.pythonhosted.org/packages/5f/86/d9b1518d8e75b346a33eb59fa31bdbbee11459a7e2cc5be502fa779e96c5/typing_extensions-4.6.3-py3-none-any.whl Collecting cffi<2.0.0,>=1.9 (from snowflake-connector-python) Using cached https://files.pythonhosted.org/packages/32/2a/63cb8c07d151de92ff9d897b2eb27ba6a0e78dda8e4c5f70d7b8c16cd6a2/cffi-1.15.1-cp37-cp37m-win_amd64.whl Requirement already satisfied: charset-normalizer<4,>=2 in c:\python37\lib\site-packages (from snowflake-connector-python) (3.1.0) Collecting pyOpenSSL<24.0.0,>=16.2.0 (from snowflake-connector-python) Using cached https://files.pythonhosted.org/packages/f0/e2/f8b4f1c67933a4907e52228241f4bd52169f3196b70af04403b29c63238a/pyOpenSSL-23.2.0-py3-none-any.whl Requirement already satisfied: pytz in c:\python37\lib\site-packages (from snowflake-connector-python) (2020.1) Collecting filelock<4,>=3.5 (from snowflake-connector-python) Using cached https://files.pythonhosted.org/packages/00/45/ec3407adf6f6b5bf867a4462b2b0af27597a26bd3cd6e2534cb6ab029938/filelock-3.12.2-py3-none-any.whl Collecting pycryptodomex!=3.5.0,<4.0.0,>=3.2 (from snowflake-connector-python) Using cached https://files.pythonhosted.org/packages/40/92/efd675dba957315d705f792b28d900bddc36f39252f6713961b4221ee9af/pycryptodomex-3.18.0.tar.gz Complete output from command python setup.py egg_info: Traceback (most recent call last): File "c:\python37\lib\site-packages\setuptools\msvc.py", line 489, in _find_latest_available_vc_ver return self.find_available_vc_vers()[-1] IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\g031240\AppData\Local\Temp\pip-install-yocrqoc2\pycryptodomex\setup.py", line 488, in <module>
    set_compiler_options(package_root, ext_modules)
  File "C:\Users\g031240\AppData\Local\Temp\pip-install-yocrqoc2\pycryptodomex\compiler_opt.py", line 327, in set_compiler_options
    clang = compiler_is_clang()
  File "C:\Users\g031240\AppData\Local\Temp\pip-install-yocrqoc2\pycryptodomex\compiler_opt.py", line 251, in compiler_is_clang
    return test_compilation(source, msg="clang")
  File "C:\Users\g031240\AppData\Local\Temp\pip-install-yocrqoc2\pycryptodomex\compiler_opt.py", line 82, in test_compilation
    objects = compiler.compile([fname], extra_postargs=extra_cc_options)
  File "c:\python37\lib\distutils\_msvccompiler.py", line 346, in compile
    self.initialize()
  File "c:\python37\lib\distutils\_msvccompiler.py", line 239, in initialize
    vc_env = _get_vc_env(plat_spec)
  File "c:\python37\lib\site-packages\setuptools\msvc.py", line 185, in msvc14_get_vc_env
    return EnvironmentInfo(plat_spec, vc_min_ver=14.0).return_env()
  File "c:\python37\lib\site-packages\setuptools\msvc.py", line 843, in __init__
    self.si = SystemInfo(self.ri, vc_ver)
  File "c:\python37\lib\site-packages\setuptools\msvc.py", line 485, in __init__
    self.vc_ver = vc_ver or self._find_latest_available_vc_ver()
  File "c:\python37\lib\site-packages\setuptools\msvc.py", line 492, in _find_latest_available_vc_ver
    raise distutils.errors.DistutilsPlatformError(err)
distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
Testing support for clang

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in C:\Users\g031240\AppData\Local\Temp\pip-install-yocrqoc2\pycryptodomex\

Can you set logging to DEBUG and collect the logs?

import logging
import os

for logger_name in ('snowflake.connector',):
    logger = logging.getLogger(logger_name)
    logger.setLevel(logging.DEBUG)
    ch = logging.StreamHandler()
    ch.setLevel(logging.DEBUG)
    ch.setFormatter(logging.Formatter('%(asctime)s - %(threadName)s %(filename)s:%(lineno)d - %(funcName)s() - %(levelname)s - %(message)s'))
    logger.addHandler(ch)
sfc-gh-spanaite commented 1 year ago

I am able to install Snowflake Python connector on a Windows 10 VM using Python 3.7.9 and a requirements.txt containing all your packages.

What version of setuptools do you have? I have the default one coming with Python 3.7.9 and that is 47.1.0 (not the latest version 68.0.0). Maybe a pip install --upgrade setuptools fixes the issue (error seems to be pointing to Microsoft Visual C++ which I already had installed).

Also, are you able to reproduce this issue in a new venv?

OutlierTom commented 1 year ago

Thanks for getting back to me on this. I was able to try this install on a different computer (one of our servers) and it installed correctly. I hesitate to uninstall python and reload all of my modules from scratch but it may come to that.

From: Sergiu Panaite @.> Sent: Monday, June 26, 2023 5:45 AM To: snowflakedb/snowflake-connector-python @.> Cc: Williams, Thomas(STP)(ENG) (he/him/his) @.>; Author @.> Subject: {External} Re: [snowflakedb/snowflake-connector-python] SNOW-847568: Failure during pip install (Issue #1614)

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe. Be Security Conscious!

I am able to install Snowflake Python connector on a Windows 10 VM using Python 3.7.9 and a requirements.txt containing all your packages.

What version of setuptools do you have? I have the default one coming with Python 3.7.9 and that is 47.1.0 (not the latest version 68.0.0). Maybe a pip install --upgrade setuptools fixes the issue (error seems to be pointing to Microsoft Visual C++ which I already had installed).

Also, are you able to reproduce this issue in a new venv?

— Reply to this email directly, view it on GitHubhttps://github.com/snowflakedb/snowflake-connector-python/issues/1614#issuecomment-1607195342, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BAZO7XKG4MOZA5XFGBJIZILXNFR2ZANCNFSM6AAAAAAZR5L6X4. You are receiving this because you authored the thread.Message ID: @.***>

sfc-gh-spanaite commented 1 year ago

Thanks @OutlierTom , this means it might be something with that particular environment.

I was thinking on the same machine you can create a new venv and try this not necessarily to modify the existing environment (especially if it's used for production purposes).

sfc-gh-spanaite commented 1 year ago

Closing since it seems related to only a particular environment.