Closed jasonlcy2020 closed 3 years ago
Hi I am having a same issue as well. My build was working fine yesterday. @sfc-gh-stakeda can you help
We saw this issue yesterday with the new release of requests
, but you don't have that.
Let me look into this!
Hi, we had this issue as well. Fixing requests to 2.23.0 or lower seems to fix the issue for us.
Seems like the most recent release of requests broke this module: https://github.com/psf/requests/blob/master/HISTORY.md#2240-2020-06-17
Hope this helps.
Note that we pin our version against new releases, in this case:
I am from the issue #325. In my case, requests==2.22.0 but got the same error.
I'm still unable to reproduce this issue without upgrading my requests version to 2.24.0
Is it possible @jasonlcy2020 @asadkarim7 that dbutils.library.installPyPI('snowflake-connector-python', version='2.2.7')
installs the newest version of requests
?
@sfc-gh-mkeller I changed my requirement.txt file to include requests==2.23.0, just like @bradfordlittooysonos suggested and my build didn't break this time. It ran successfully
@seoyeonberry @jasonlcy2020 Could you guys insert the following right before creating the connection and post it's output, please?
import pkg_resources
print(pkg_resources.working_set.by_key['requests'])
print(pkg_resources.working_set.by_key['urllib3'])
@sfc-gh-mkeller I am working an another virtual environment and ran the requirements.txt again. The version is slightly different but got the same error message. Here it is.
requests 2.24.0 urllib3 1.24.3
@seoyeonberry We don't support requests 2.24.0 yet. You need to downgrade it to 2.23.0
@sfc-gh-mkeller I downgraded requests to 2.23.0 and it worked. This is kind of strange because requests was even not on the requirements.txt file. Did Snowflake make changes recently? with 2.24.0 it worked well until last week.
We made no changes, requests=2.24.0
came out yesterday https://pypi.org/project/requests/#history
Then my assumption is that one of the packages in the requirements.txt file(snowflake connector or sth) installs requests=2.24.0 default since yesterday. FYI, I checked the log and it says that the program got broken yesterday.
It's great that we found the source of the issue. I'll learn my lesson and next time when we see an internal error like this then I'll proactively announce it here too.
Would better if you stop monkey patching requests.
That'd require requests
to add a hook for our custom verification. This is not a bad idea! Have we ever tried reaching out @sfc-gh-hchaturvedi ?
You could also vendor requests in your package.
On Fri, Jun 19, 2020 at 19:12 Mark Keller notifications@github.com wrote:
That'd require requests to add a hook for our custom verification. This is not a bad idea! Have we ever tried reaching out @sfc-gh-hchaturvedi https://github.com/sfc-gh-hchaturvedi ?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/snowflakedb/snowflake-connector-python/issues/324#issuecomment-646892555, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKEOQL3UZR6TMYGJKBIPQ3RXPWHRANCNFSM4OBMNSDQ .
Please look at swetashre's linked problem. Literally just importing the python snowflake-connector breaks the use of the Boto3 queries.
Any updates on this? Still experiencing it with requests being pinned to 2.23.0
and snowflake-connector-python=2.2.4
I dont experience error anymore
Which versions are you using?
hey guys i maintain an alternate lite version of snowconn python connector here my hope is we can add changes to the package that eventually will be added to the official one.
Here is the repo in case someone wants to help. I would like to add:
When will newer versions of requests
be supported? With the updates to dependency resolution in pip
, it's going to become very hard to keep requests
pinned to older versions.
When will newer versions of
requests
be supported? With the updates to dependency resolution inpip
, it's going to become very hard to keeprequests
pinned to older versions.
I don't know 👀 https://github.com/snowflakedb/snowflake-connector-python/pull/557
It is a pretty big problem for us to be pinned to PyArrow at 0.17 and Requests at 2.23. The number of environmental issues I have run into, solely because of the Snowflake-connector has been rough. Would love to see these resolved.
Agreed, it's a really huge problem now. If there was any way to connect to Snowflake using more standard tools then we'd just use that, but as it is, we have to use this connector to connect.
We're at the point where we're considering writing a proxy service that just forwards requests to Snowflake using a different language's client library or using the JDBC driver which... is obviously not what customers want to be doing.
another weird thing, this package boto3 requirements are
snowflake-connector-python 2.1.3 requires boto3<1.11.0,>=1.4.4, but you'll have boto3 1.16.35 which is incompatible.
But the latest boto3 release is 1.16.35, how does that even work?
It is a serious problem for Airflow 2.0 (which is due to be released this week). We introduced separation between different providers (we have 60+ airflow-providers-* packages including snowflake). Installing snowflake provider breaks almost all other providers instantly (because we introduced automated discovery of providers and we import some of the classes from every provider to check out what are the capabilities of those).
We just decided to release snowflake provider but immediately yank it until the problem is solved.
We are tracking it in https://github.com/apache/airflow/issues/12881
So in my case I am adding a Twilio and SendGrid layer for failure alerts to staff, all I needed to do was change the ordering layer to have Twilio and SendGrids layer merge before our Snowflake Connector layer. Hope this helps somebody.
This should have been resolved in v2.3.8 which vendored requests and urllib3. Please reopen if the issues with requests are still occurring.
I still see the issue while installing pip package snowflake-connector-python 2.7.4. As a dependency the pip is installing 2.27.1, which is buggy.
Collecting requests<3.0.0 Downloading requests-2.27.1-py2.py3-none-any.whl (63 kB) |████████████████████████████████| 63 kB 1.7 MB/s
Only a work around, downgrading requests package to 2.23.0 is solving the problem
Please answer these questions before submitting your issue. Thanks!
python --version
)?Python 3.7.3
python -c 'import platform; print(platform.platform())'
)?Linux-4.15.0-1050-azure-x86_64-with-debian-stretch-sid
pip list
)?dbutils.library.installPyPI('snowflake-connector-python', version='2.2.7') import snowflake.connector conn = snowflake.connector.connect(....
Installed snowflake-connector-python=2.2.7 Installed azure-cli-core Installed azure-common 2020-06-18 09:16:58,249 - MainThread ssl_wrap_socket.py:91 - inject_into_urllib3() - DEBUG - Injecting ssl_wrap_socket_with_ocsp 2020-06-18 09:16:58,250 - MainThread auth.py:52 -() - DEBUG - Failed to import keyring module. err=[No module named 'keyring']
2020-06-18 09:16:58,250 - MainThread auth.py:72 - () - DEBUG - cache directory: /root/.cache/snowflake
/local_disk0/pythonVirtualEnvDirs/virtualEnv-791d3104-b985-4b9f-b2b0-7e4ceb1830a0/lib/python3.7/site-packages/snowflake/connector/options.py:39: UserWarning: You have an incompatible version of 'pyarrow' installed, please install a version that adheres to: 'pyarrow<0.18.0,>=0.17.0; extra == "pandas"'
warn_incompatible_dep('pyarrow', _installed_pyarrow.version, _expected_version)
2020-06-18 09:17:01,247 - MainThread connection.py:180 - init() - INFO - Snowflake Connector for Python Version: 2.2.7, Python Version: 3.7.3, Platform: Linux-4.15.0-1050-azure-x86_64-with-debian-stretch-sid
2020-06-18 09:17:01,247 - MainThread connection.py:487 - connect() - DEBUG - connect
2020-06-18 09:17:01,247 - MainThread connection.py:725 - config() - DEBUG - config
2020-06-18 09:17:01,247 - MainThread connection.py:820 - config() - INFO - This connection is in OCSP Fail Open Mode. TLS Certificates would be checked for validity and revocation status. Any other Certificate Revocation related exceptions or OCSP Responder failures would be disregarded in favor of connectivity.
2020-06-18 09:17:01,247 - MainThread connection.py:836 - config() - INFO - Setting use_openssl_only mode to False
2020-06-18 09:17:01,248 - MainThread converter.py:138 - init() - DEBUG - use_numpy: False
2020-06-18 09:17:01,248 - MainThread connection.py:649 - __open_connection() - DEBUG - REST API object was created: grab.southeast-asia.azure.snowflakecomputing.com:443
2020-06-18 09:17:01,248 - MainThread auth.py:137 - authenticate() - DEBUG - authenticate
2020-06-18 09:17:01,248 - MainThread auth.py:172 - authenticate() - DEBUG - assertion content: *****
2020-06-18 09:17:01,248 - MainThread auth.py:184 - authenticate() - DEBUG - account=grab, user=[REDACTED], database=STGFDW, schema=ANALYTICS, warehouse=FDWANALYTICSWH, role=ANALYST, request_id=f54c8219-fbac-4d0f-a284-9570aa874eb0
2020-06-18 09:17:01,248 - MainThread auth.py:210 - authenticate() - DEBUG - body['data']: {'CLIENT_APP_ID': 'PythonConnector', 'CLIENT_APP_VERSION': '2.2.7', 'SVN_REVISION': None, 'ACCOUNT_NAME': 'grab', 'LOGIN_NAME': '[REDACTED]', 'CLIENT_ENVIRONMENT': {'APPLICATION': 'PythonConnector', 'OS': 'Linux', 'OS_VERSION': 'Linux-4.15.0-1050-azure-x86_64-with-debian-stretch-sid', 'PYTHON_VERSION': '3.7.3', 'PYTHON_RUNTIME': 'CPython', 'PYTHON_COMPILER': 'GCC 5.4.0 20160609', 'OCSP_MODE': 'FAIL_OPEN', 'TRACING': 10, 'LOGIN_TIMEOUT': 120, 'NETWORK_TIMEOUT': None, 'CLIENT_STORE_TEMPORARY_CREDENTIAL': None}, 'SESSION_PARAMETERS': {'CLIENT_SESSION_KEEP_ALIVE_HEARTBEAT_FREQUENCY': 900, 'CLIENT_PREFETCH_THREADS': 4}}
2020-06-18 09:17:01,248 - MainThread network.py:940 - _use_requests_session() - DEBUG - Active requests sessions: 1, idle: 0
2020-06-18 09:17:01,248 - MainThread network.py:636 - _request_exec_wrapper() - DEBUG - remaining request timeout: 120, retry cnt: 1
2020-06-18 09:17:01,249 - MainThread network.py:784 - _request_exec() - DEBUG - socket timeout: 60
2020-06-18 09:17:01,342 - MainThread ocsp_snowflake.py:382 - reset_cache_dir() - DEBUG - cache directory: /root/.cache/snowflake
2020-06-18 09:17:01,392 - MainThread ssl_wrap_socket.py:406 - ssl_wrap_socket_with_ocsp() - DEBUG - OCSP Mode: FAIL_OPEN, OCSP response cache file name: None
2020-06-18 09:17:01,392 - MainThread ocsp_snowflake.py:421 - reset_ocsp_response_cache_uri() - DEBUG - ocsp_response_cache_uri: file:///root/.cache/snowflake/ocsp_response_cache.json
2020-06-18 09:17:01,392 - MainThread ocsp_snowflake.py:423 - reset_ocsp_response_cache_uri() - DEBUG - OCSP_VALIDATION_CACHE size: 0
2020-06-18 09:17:01,392 - MainThread ocsp_snowflake.py:217 - reset_ocsp_dynamic_cache_server_url() - DEBUG - OCSP response cache server is enabled: http://ocsp.snowflakecomputing.com/ocsp_response_cache.json
2020-06-18 09:17:01,392 - MainThread ocsp_snowflake.py:251 - reset_ocsp_dynamic_cache_server_url() - DEBUG - OCSP dynamic cache server RETRY URL: None
2020-06-18 09:17:01,396 - MainThread ocsp_asn1crypto.py:205 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2021-04-02 17:03:51+00:00
2020-06-18 09:17:01,397 - MainThread ocsp_asn1crypto.py:205 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2021-04-02 17:08:26+00:00
2020-06-18 09:17:01,401 - MainThread ocsp_asn1crypto.py:205 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2021-04-02 16:58:09+00:00
2020-06-18 09:17:01,407 - MainThread ocsp_asn1crypto.py:205 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2023-06-11 20:44:21+00:00
2020-06-18 09:17:01,409 - MainThread ocsp_asn1crypto.py:205 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2021-04-02 17:08:26+00:00
2020-06-18 09:17:01,412 - MainThread ocsp_asn1crypto.py:205 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2021-12-14 07:00:00+00:00
2020-06-18 09:17:01,415 - MainThread ocsp_asn1crypto.py:205 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2021-04-02 16:58:09+00:00
2020-06-18 09:17:01,417 - MainThread ocsp_asn1crypto.py:205 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2021-04-02 17:13:33+00:00
2020-06-18 09:17:01,420 - MainThread ocsp_asn1crypto.py:205 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2021-04-02 16:58:09+00:00
2020-06-18 09:17:01,422 - MainThread ocsp_asn1crypto.py:205 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2025-05-12 23:58:59+00:00
2020-06-18 09:17:01,423 - MainThread ocsp_asn1crypto.py:205 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2023-06-11 20:40:26+00:00
2020-06-18 09:17:01,427 - MainThread ocsp_asn1crypto.py:205 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2021-04-02 17:13:33+00:00
2020-06-18 09:17:01,429 - MainThread ocsp_asn1crypto.py:205 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2021-04-02 17:13:33+00:00
2020-06-18 09:17:01,432 - MainThread ocsp_asn1crypto.py:205 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2025-05-12 23:58:59+00:00
2020-06-18 09:17:01,435 - MainThread ocsp_asn1crypto.py:205 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2025-05-12 23:58:59+00:00
2020-06-18 09:17:01,438 - MainThread ocsp_asn1crypto.py:205 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2025-05-12 23:58:59+00:00
2020-06-18 09:17:01,441 - MainThread ocsp_asn1crypto.py:205 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2021-04-02 17:03:51+00:00
2020-06-18 09:17:01,443 - MainThread ocsp_asn1crypto.py:205 - is_valid_time() - DEBUG - Verifying the attached certificate is signed by the issuer. Valid Not After: 2025-05-12 23:58:59+00:00
2020-06-18 09:17:01,443 - MainThread ocsp_snowflake.py:459 - read_ocsp_response_cache_file() - DEBUG - Read OCSP response cache file: /root/.cache/snowflake/ocsp_response_cache.json, count=97
2020-06-18 09:17:01,444 - MainThread network.py:900 - _request_exec() - DEBUG - Hit retryable client error. Retrying... Ignore the following error stack: 'SSLSocket' object has no attribute 'connection'
Traceback (most recent call last):
File "/local_disk0/pythonVirtualEnvDirs/virtualEnv-791d3104-b985-4b9f-b2b0-7e4ceb1830a0/lib/python3.7/site-packages/snowflake/connector/network.py", line 808, in _request_exec
auth=SnowflakeAuth(token),
File "/local_disk0/pythonVirtualEnvDirs/virtualEnv-791d3104-b985-4b9f-b2b0-7e4ceb1830a0/lib/python3.7/site-packages/requests/sessions.py", line 530, in request
resp = self.send(prep, send_kwargs)
File "/local_disk0/pythonVirtualEnvDirs/virtualEnv-791d3104-b985-4b9f-b2b0-7e4ceb1830a0/lib/python3.7/site-packages/requests/sessions.py", line 643, in send
r = adapter.send(request, kwargs)
File "/local_disk0/pythonVirtualEnvDirs/virtualEnv-791d3104-b985-4b9f-b2b0-7e4ceb1830a0/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/databricks/python/lib/python3.7/site-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/databricks/python/lib/python3.7/site-packages/urllib3/connectionpool.py", line 343, in _make_request
self._validate_conn(conn)
File "/databricks/python/lib/python3.7/site-packages/urllib3/connectionpool.py", line 839, in _validate_conn
conn.connect()
File "/databricks/python/lib/python3.7/site-packages/urllib3/connection.py", line 344, in connect
ssl_context=context)
File "/local_disk0/pythonVirtualEnvDirs/virtualEnv-791d3104-b985-4b9f-b2b0-7e4ceb1830a0/lib/python3.7/site-packages/snowflake/connector/ssl_wrap_socket.py", line 411, in ssl_wrap_socket_with_ocsp
).validate(server_hostname, ret.connection)
AttributeError: 'SSLSocket' object has no attribute 'connection'