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 graphene not working #546

Closed
creativesands opened this issue Sep 14, 2017 · 7 comments
Closed

import graphene not working #546

creativesands opened this issue Sep 14, 2017 · 7 comments

Comments

@creativesands
Copy link

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'
@syrusakbary
Copy link
Member

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"

@dongyuzheng
Copy link

dongyuzheng commented Sep 26, 2017

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>

@leebenson
Copy link

Out of interest, is this generally a problem with any Python lib, or just some particular way Graphene is importing the graphql lib?

@jkimbo
Copy link
Member

jkimbo commented Sep 7, 2018

@leebenson it's a result of how Python find modules: https://docs.python.org/3/tutorial/modules.html#the-module-search-path

@mbrochh
Copy link

mbrochh commented Jul 24, 2019

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?

@jkimbo
Copy link
Member

jkimbo commented Jul 24, 2019

@mbrochh if you install the latest version of graphene-django (2.4.0) it should resolve graphql-core correctly.

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

7 participants