import graphene gives me the following error
Traceback (most recent call last):
File ".../app.py", line 1, in <module>
import graphene
File ".../anaconda/lib/python3.6/site-packages/graphene/__init__.py", line 3, in <module>
from .types import (
File ".../anaconda/lib/python3.6/site-packages/graphene/types/__init__.py", line 2, in <module>
from graphql import ResolveInfo
ImportError: cannot import name 'ResolveInfo'
Hi,
It seems you are using Graphene 2.0.dev, so you will need the latest package of graphql-core that have ResolveInfo.
You can solve the issue by doing pip install "graphql-core>=2.0.dev"
EDIT: I had a folder called graphql in my path. Changing its name fixed this.
I have the same issue:
(venv) PS D:\backend\backend> python .\manage.py runserver
...
File "D:\backend\venv\lib\site-packages\graphene\types\__init__.py", line 2, in <module>
from graphql import ResolveInfo
ImportError: cannot import name 'ResolveInfo'
(venv) PS D:\backend\backend> pip freeze
colorama==0.3.9
decorator==4.1.2
Django==1.11.5
graphene==2.0.dev20170802065539
graphene-django==2.0.dev2017083101
graphql-core==2.0.dev20170801051721
graphql-relay==0.4.5
ipdb==0.10.3
ipython==6.2.0
ipython-genutils==0.2.0
iso8601==0.1.12
jedi==0.10.2
pickleshare==0.7.4
promise==2.1.dev0
prompt-toolkit==1.0.15
Pygments==2.2.0
pytz==2017.2
simplegeneric==0.8.1
singledispatch==3.4.0.3
six==1.11.0
traitlets==4.3.2
typing==3.6.2
wcwidth==0.1.7
(venv) PS D:\backend\backend> python --version
Python 3.6.2
(venv) PS D:\backend\backend>
Out of interest, is this generally a problem with _any_ Python lib, or just some particular way Graphene is importing the graphql lib?
@leebenson it's a result of how Python find modules: https://docs.python.org/3/tutorial/modules.html#the-module-search-path
I had this issue as well.
My only dependency in requirements.txt was: graphene-django==2.1.0
According to pip freeze, it seems, this has installed graphql-core==3.0.0a0. I downgraded that to pip install "graphql-core<3.0.0a0" and thus got rid of the issue.
Is this a bug with the latest graphene-django package? Is it referring to a 3.0 version of graphql-core prematurely?
@mbrochh if you install the latest version of graphene-django (2.4.0) it should resolve graphql-core correctly.
Most helpful comment
EDIT: I had a folder called graphql in my path. Changing its name fixed this.
I have the same issue: