Skip to content

cannot import name 'DocumentNode' from 'graphql' (unknown location) #181

@cyril-moreau

Description

@cyril-moreau

Hi,

I have solve my own issue but i am reporting it here just in case someone needs it.

The graphql-core==3.1.2 is not compatible with gql==3.0.0a5 (pip install --pre gql[all]) because i want to use the upload file feature.

Using pytest to test my upload file graphql backend, I get the following error when I import the GQL lib

_____________________________________________________ ERROR collecting tests_me.py _____________________________________________________
ImportError while importing test module '/Users/Cyril_Moreau/Perso/Developers/v2/evntz/image-graphql/src/app/image/tests/tests_me.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests_me.py:1: in <module>
    from gql import Client, gql
/usr/local/lib/python3.8/site-packages/gql/__init__.py:11: in <module>
    from .client import Client
/usr/local/lib/python3.8/site-packages/gql/client.py:5: in <module>
    from graphql import (
**E   ImportError: cannot import name 'DocumentNode' from 'graphql' (unknown location)**

According to the gql setup.py file, the requirements are :
install_requires = [
"graphql-core>=3.1,<3.2",
"yarl>=1.6,<2.0",
]

To fix the issue i had to downgrade to graphql-core==3.1.0 (pip3 install graphql-core==3.1.0)
Now it works.

Cyril

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: invalidDoes not provide useful info or has gone stale

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions