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

Import error on Python version 3.10.X #1022

Open
aakash-sahai opened this issue Dec 24, 2023 · 1 comment
Open

Import error on Python version 3.10.X #1022

aakash-sahai opened this issue Dec 24, 2023 · 1 comment

Comments

@aakash-sahai
Copy link

aakash-sahai commented Dec 24, 2023

I am running Python 3.10.12 (on MacOS M1). Upon importing graphql_compiler, I get the following error:

Stacktrace

>>> from graphql_compiler import graphql_to_sql
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/asahai/repos/cat/.venv/lib/python3.10/site-packages/graphql_compiler/__init__.py", line 3, in <module>
    from .compiler import (  # noqa
  File "/Users/asahai/repos/cat/.venv/lib/python3.10/site-packages/graphql_compiler/compiler/__init__.py", line 2, in <module>
    from .common import (  # noqa
  File "/Users/asahai/repos/cat/.venv/lib/python3.10/site-packages/graphql_compiler/compiler/common.py", line 4, in <module>
    from . import (
  File "/Users/asahai/repos/cat/.venv/lib/python3.10/site-packages/graphql_compiler/compiler/emit_cypher.py", line 3, in <module>
    from .blocks import Fold, QueryRoot, Recurse, Traverse
  File "/Users/asahai/repos/cat/.venv/lib/python3.10/site-packages/graphql_compiler/compiler/blocks.py", line 7, in <module>
    from .helpers import (
  File "/Users/asahai/repos/cat/.venv/lib/python3.10/site-packages/graphql_compiler/compiler/helpers.py", line 4, in <module>
    from collections import Hashable, namedtuple
ImportError: cannot import name 'Hashable' from 'collections' (/opt/homebrew/Cellar/python@3.10/3.10.12_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/collections/__init__.py)

Steps to reproduce

from graphql_compiler import graphql_to_sql

How to fix

The Hashtable has been moved to collections.abc from Python 3.3 onwards, so the fix is to break up the above import into two imports as follows:

from collections import namedtuple
from collections.abc import Hashable

Version error is found

graphql-compiler 1.11.0

@ElementalWarrior
Copy link

ElementalWarrior commented Mar 6, 2024

Specify version 2.0.0b3 2.0.0.dev36 will probably solve your problem. They haven't updated the default version at pypi since 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants