-
Notifications
You must be signed in to change notification settings - Fork 478
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-634755: ImportError: cannot import name 'NamedTuple' from 'typing_extensions' #1206
Comments
We had to go back to 2.7.9 |
|
As per @mrcarlosrendon, typing extensions from version 4 uses semantic versioning, so probably the most elegant solution is pip install 'typing-extensions>=4.3.0' |
FYI, We have encountered the same error today as well. |
We are also getting the same error all over the place. You probably need to update the requirements. Adding |
Same problem here, and !pip install 'typing-extensions>=4.3.0' did not solve it (using google colab) :( |
Same problem here all of a sudden. |
@viktorossmark - this just saved me a hell of a lot of time. Thank you very much!!! |
Hi viktorossmark |
Same here the solution did not work for colab |
@agshiv92 take a look on my solution for snowflake-sqlalchemy in Superset's repository. In different repositories this can be caused by different things. There there was a problem with python dependencies defined with |
Same problem here all of a sudden. %pip install 'typing-extensions>=4.3.0' solved it on EC2 Airflow cluster |
This is the right solution, I forgot to add a lower pin to the new dependency. We'll go ahead and release a new version with this fixed and yank |
Happening in AWS Glue 2.0 as well, fix was adding typing-extensions to the extra python modules, a la:
|
pip install 'typing-extensions>=4.3.0' worked for me in python 3.9+ |
Re-opening for a few extra days. Just so that it's easier for others to find this issue |
Edit: Just noticed 2.7.10 was yanked from PyPI and our requirements.txt also wasn't pinning snowflake-connector-python to 2.7.9. I pinned 2.7.9. Problem solved. :) |
Weird, yesterday it worked, but today I get the same error again - any idea why this is happeneing? |
Also experiencing the same error on google colab. |
2.7.10 was yanked for not having the right dependency constraints: snowflakedb/snowflake-connector-python#1206 (comment)
2.7.10 was yanked for not having the right dependency constraints: snowflakedb/snowflake-connector-python#1206 (comment)
One must follow exactly the instructions in https://docs.snowflake.com/en/developer-guide/snowpark/python/setup.html and not mix conda and pip. |
In case anyone else arrives and in need, I restricted my version of snowflake-connector-python to temporarily fix. I added
to my pyproject.toml |
How do I update it running locally with docker? Having the same probnlem. |
@alexblund Update the requirements.txt file and rebuild the docker image! |
|
March 2023 and I get the exact same error and doing |
Any update on this? |
Having the same issue as @salmanea and @GRSARVESH, in this case on Azure Databricks. @sfc-gh-mkeller is there an update? In the meantime, pinning to version 3.0.0 instead of current 3.0.4 'fixed' the error, didn't try pinning other versions because the comments above made me suspect this issue was (re)introduced in the March release of 3.0.1. |
Please answer these questions before submitting your issue. Thanks!
Issue happened on vm, but reproduces on my mac
Python 3.9.7 (default, Oct 13 2021, 06:45:31) [Clang 13.0.0 (clang-1300.0.29.3)]
macOS-12.4-x86_64-i386-64bit
pip freeze
)?from mac laptop - hard to pull from vm where issue happened
aniso8601==9.0.1 appnope==0.1.2 Authlib==0.15.4 backcall==0.2.0 boto3==1.16.10 botocore==1.19.10 certifi==2021.10.8 cffi==1.14.6 charset-normalizer==2.0.7 cryptography==35.0.0 cypari==2.4.1 decorator==4.4.2 future==0.18.2 FXrays==1.3.5 graphene==3.0 graphql-core==3.1.7 graphql-relay==3.1.5 idna==3.2 ipython==7.21.0 ipython-genutils==0.2.0 jedi==0.18.0 jmespath==0.10.0 networkx==2.5 oauthlib==3.1.1 parso==0.8.1 pexpect==4.8.0 pickleshare==0.7.5 plink==2.3.1 prompt-toolkit==3.0.17 ptyprocess==0.7.0 pycparser==2.20 Pygments==2.8.1 PyJWT==2.2.0 pypng==0.0.20 python-dateutil==2.8.1 python-snappy==0.6.0 requests==2.26.0 s3transfer==0.3.3 six==1.15.0 snappy-manifolds==1.1.2 spherogram==1.8.3 traitlets==5.0.5 typing_extensions==4.2.0 urllib3==1.25.11 wcwidth==0.2.5
fails with
ImportError: cannot import name 'NamedTuple' from 'typing_extensions' (/root/.pyenv/versions/3.9.12/lib/python3.9/site-packages/typing_extensions.py)
Some root cause analysis from my side --
Latest version of Snowflake-connector ('2.7.10') includes cache.py, which imports NamedTuple
from typing_extensions import NamedTuple, Self
https://github.com/snowflakedb/snowflake-connector-python/blob/main/src/snowflake/connector/cache.py#L12
This fails if using typing_extensions < 4.3.0, as NamedTuple was added in this commit python/typing_extensions@7c28357
I believe you need to change the requirements to be >= 4.3.0 for typing_extentions https://github.com/snowflakedb/snowflake-connector-python/blob/main/setup.cfg#L59
No error message when connecting to snowflake.
What should have happened and what happened instead?
Able to connect to snowflake.
No - above root cause analysis in part 4 explains issue and how to fix it on Snowflake side.
--- full failure traceback from vm starting with Snowflake code
The text was updated successfully, but these errors were encountered: