Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNOW-1831724: AttributeError: module 'lib' has no attribute 'X509_V_FLAG_NOTIFY_POLICY' error on import with PyOpenSSL<22.1.0 installed #2109

Closed
gibsondan opened this issue Nov 27, 2024 · 5 comments · Fixed by #2110
Assignees
Labels
bug status-fixed_awaiting_release The issue has been fixed, its PR merged, and now awaiting the next release cycle of the connector. status-triage_done Initial triage done, will be further handled by the driver team

Comments

@gibsondan
Copy link

Python version

3.11.7

Operating system and processor architecture

macOS-14.3.1-arm64-arm-64bit

Installed packages

+ agate==1.9.1
 + aiofile==3.9.0
 + alembic==1.14.0
 + annotated-types==0.7.0
 + antlr4-python3-runtime==4.13.2
 + anyio==4.6.2.post1
 + asn1crypto==1.5.1
 + assets-smoke-test==0.0.0 (from file:///Users/dgibson/dagster/examples/assets_smoke_test)
 + attrs==24.2.0
 + babel==2.16.0
 + backoff==2.2.1
 + backports-tarfile==1.2.0
 + buildkite-test-collector==0.1.9
 + cachetools==5.5.0
 + caio==0.9.17
 + certifi==2024.8.30
 + cffi==1.17.1
 + chardet==5.2.0
 + charset-normalizer==3.4.0
 + click==8.1.7
 + colorama==0.4.6
 + coloredlogs==14.0
 + coverage==7.6.8
 + croniter==3.0.4
 + cryptography==44.0.0
 + daff==1.3.46
 + dagster==1!0+dev (from file:///Users/dgibson/dagster/python_modules/dagster)
 + dagster-dbt==1!0+dev (from file:///Users/dgibson/dagster/python_modules/libraries/dagster-dbt)
 + dagster-graphql==1!0+dev (from file:///Users/dgibson/dagster/python_modules/dagster-graphql)
 + dagster-pandas==1!0+dev (from file:///Users/dgibson/dagster/python_modules/libraries/dagster-pandas)
 + dagster-pipes==1!0+dev (from file:///Users/dgibson/dagster/python_modules/dagster-pipes)
 + dagster-snowflake==1!0+dev (from file:///Users/dgibson/dagster/python_modules/libraries/dagster-snowflake)
 + dagster-snowflake-pandas==1!0+dev (from file:///Users/dgibson/dagster/python_modules/libraries/dagster-snowflake-pandas)
 + dagster-webserver==1!0+dev (from file:///Users/dgibson/dagster/python_modules/dagster-webserver)
 + dbt-adapters==1.7.0
 + dbt-common==1.10.0
 + dbt-core==1.8.8
 + dbt-extractor==0.5.1
 + dbt-semantic-interfaces==0.5.1
 + dbt-snowflake==1.8.4
 + deepdiff==7.0.1
 + distlib==0.3.9
 + docker==7.1.0
 + docstring-parser==0.16
 + execnet==2.1.1
 + filelock==3.16.1
 + flaky==3.8.1
 + fsspec==2024.3.0
 + gql==3.5.0
 + graphene==3.4.3
 + graphql-core==3.2.5
 + graphql-relay==3.2.0
 + grpcio==1.68.0
 + grpcio-health-checking==1.62.3
 + grpcio-tools==1.62.3
 + h11==0.14.0
 + httptools==0.6.4
 + humanfriendly==10.0
 + idna==3.10
 + importlib-metadata==6.11.0
 + iniconfig==2.0.0
 + isodate==0.6.1
 + jaraco-classes==3.4.0
 + jaraco-context==6.0.1
 + jaraco-functools==4.1.0
 + jinja2==3.1.4
 + jsonschema==4.23.0
 + jsonschema-specifications==2024.10.1
 + keyring==25.5.0
 + leather==0.4.0
 + logbook==1.5.3
 + mako==1.3.6
 + markdown-it-py==3.0.0
 + markupsafe==3.0.2
 + mashumaro==3.15
 + mdurl==0.1.2
 + minimal-snowplow-tracker==0.0.2
 + more-itertools==10.5.0
 + morefs==0.2.2
 + msgpack==1.1.0
 + multidict==6.1.0
 + mypy-protobuf==3.6.0
 + networkx==3.4.2
 + numpy==2.1.3
 + objgraph==3.6.2
 + ordered-set==4.1.0
 + orjson==3.10.12
 + packaging==24.2
 + pandas==2.2.3
 + parsedatetime==2.6
 + pathspec==0.12.1
 + platformdirs==4.3.6
 + pluggy==1.5.0
 + propcache==0.2.0
 + protobuf==4.25.5
 + pyarrow==18.1.0
 + pycparser==2.22
 + pydantic==2.9.2
 + pydantic-core==2.23.4
 + pygments==2.18.0
 + pyjwt==2.10.0
 + pyopenssl==22.0.0
 + pyproject-api==1.8.0
 + pytest==8.3.3
 + pytest-asyncio==0.24.0
 + pytest-cov==5.0.0
 + pytest-mock==3.14.0
 + pytest-xdist==3.6.1
 + python-dateutil==2.9.0.post0
 + python-dotenv==1.0.1
 + python-slugify==8.0.4
 + pytimeparse==1.1.8
 + pytz==2024.2
 + pyyaml==6.0.2
 + rapidfuzz==3.10.1
 + referencing==0.35.1
 + requests==2.32.3
 + requests-toolbelt==1.0.0
 + responses==0.23.1
 + rich==13.9.4
 + rpds-py==0.21.0
 + shellingham==1.5.4
 + six==1.16.0
 + sniffio==1.3.1
 + snowflake-connector-python==3.12.3
 + snowflake-sqlalchemy==1.7.0
 + sortedcontainers==2.4.0
 + sqlalchemy==2.0.36
 + sqlglot==25.32.1
 + sqlglotrs==0.3.0
 + sqlparse==0.5.2
 + starlette==0.41.3
 + structlog==24.4.0
 + syrupy==4.8.0
 + tabulate==0.9.0
 + text-unidecode==1.3
 + tomli==2.1.0
 + tomlkit==0.13.2
 + toposort==1.10
 + tox==4.23.2
 + tqdm==4.67.1
 + typer==0.13.1
 + types-protobuf==5.28.3.20241030
 + types-pyyaml==6.0.12.20240917
 + typing-extensions==4.12.2
 + tzdata==2024.2
 + universal-pathlib==0.2.5
 + urllib3==2.2.3
 + uvicorn==0.32.1
 + uvloop==0.21.0
 + virtualenv==20.28.0
 + watchdog==5.0.3
 + watchfiles==1.0.0
 + websockets==14.1
 + yarl==1.18.0
 + zipp==3.21.0

What did you do?

the pyopenssl pin in this package is pyOpenSSL>=16.2.0,<25.0.0

but if you install a version of pyOpenSSL<23 you get the following error on import

[2024-11-27T18:38:44Z]     import snowflake.connector
[2024-11-27T18:38:44Z] .tox/py311/lib/python3.11/site-packages/snowflake/connector/__init__.py:19: in <module>
[2024-11-27T18:38:44Z]     from .connection import SnowflakeConnection
[2024-11-27T18:38:44Z] .tox/py311/lib/python3.11/site-packages/snowflake/connector/connection.py:37: in <module>
[2024-11-27T18:38:44Z]     from .auth import (
[2024-11-27T18:38:44Z] .tox/py311/lib/python3.11/site-packages/snowflake/connector/auth/__init__.py:7: in <module>
[2024-11-27T18:38:44Z]     from ._auth import Auth, get_public_key_fingerprint, get_token_from_private_key
[2024-11-27T18:38:44Z] .tox/py311/lib/python3.11/site-packages/snowflake/connector/auth/_auth.py:55: in <module>
[2024-11-27T18:38:44Z]     from ..network import (
[2024-11-27T18:38:44Z] .tox/py311/lib/python3.11/site-packages/snowflake/connector/network.py:21: in <module>
[2024-11-27T18:38:44Z]     import OpenSSL.SSL
[2024-11-27T18:38:44Z] .tox/py311/lib/python3.11/site-packages/OpenSSL/__init__.py:8: in <module>
[2024-11-27T18:38:44Z]     from OpenSSL import crypto, SSL
[2024-11-27T18:38:44Z] .tox/py311/lib/python3.11/site-packages/OpenSSL/crypto.py:1570: in <module>
[2024-11-27T18:38:44Z]     class X509StoreFlags(object):
[2024-11-27T18:38:44Z] .tox/py311/lib/python3.11/site-packages/OpenSSL/crypto.py:1589: in X509StoreFlags
[2024-11-27T18:38:44Z]     NOTIFY_POLICY = _lib.X509_V_FLAG_NOTIFY_POLICY
[2024-11-27T18:38:44Z] E   AttributeError: module 'lib' has no attribute 'X509_V_FLAG_NOTIFY_POLICY'

What did you expect to see?

no errors on all pinned versions of pyopenssl

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)
@github-actions github-actions bot changed the title increase lower bound on pyopenssl pin SNOW-1831724: increase lower bound on pyopenssl pin Nov 27, 2024
@gibsondan
Copy link
Author

pyOpenSSL>=22.1.0 appears to be the minimum version that imports

I suspect the release of cryptography 44 today may have suddenly caused a lot of people to run into this

@gibsondan gibsondan changed the title SNOW-1831724: increase lower bound on pyopenssl pin SNOW-1831724: AttributeError: module 'lib' has no attribute 'X509_V_FLAG_NOTIFY_POLICY' error on import with PyOpenSSL<22.1.0 installed Nov 27, 2024
@teej
Copy link

teej commented Nov 27, 2024

Thanks @gibsondan using pyOpenSSL>=22.1.0 fixed this issue for me.

@sfc-gh-dszmolka sfc-gh-dszmolka added status-pr_pending_merge A PR is made and is under review status-triage_done Initial triage done, will be further handled by the driver team and removed needs triage labels Dec 2, 2024
@sfc-gh-dszmolka
Copy link
Contributor

hey folks - thanks for reporting. Fix in progress on #2110

@sfc-gh-mkeller sfc-gh-mkeller linked a pull request Dec 2, 2024 that will close this issue
7 tasks
@sfc-gh-dszmolka
Copy link
Contributor

fix is merged and will be part of the next upcoming release

@sfc-gh-dszmolka sfc-gh-dszmolka added status-fixed_awaiting_release The issue has been fixed, its PR merged, and now awaiting the next release cycle of the connector. and removed status-pr_pending_merge A PR is made and is under review labels Dec 3, 2024
@sfc-gh-dszmolka
Copy link
Contributor

released in PythonConnector v3.12.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug status-fixed_awaiting_release The issue has been fixed, its PR merged, and now awaiting the next release cycle of the connector. status-triage_done Initial triage done, will be further handled by the driver team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants