question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Import error when using graphene

See original GitHub issue

I get an error when I’m trying to import graphene into a simple project:

Error: While importing "stronk.app", an ImportError was raised:

Traceback (most recent call last):
  File "/home/markw/.local/lib/python3.6/site-packages/flask/cli.py", line 240, in locate_app
    __import__(module_name)
  File "/home/markw/Desktop/REPO/stronk-backend/stronk/__init__.py", line 7, in <module>
    from graphene import ObjectType, String, Schema
  File "/home/markw/.local/lib/python3.6/site-packages/graphene/__init__.py", line 3, in <module>
    from .types import (
  File "/home/markw/.local/lib/python3.6/site-packages/graphene/types/__init__.py", line 2, in <module>
    from graphql import ResolveInfo
ImportError: cannot import name 'ResolveInfo'

I checked other similar issues in the graphene-django repo (https://github.com/graphql-python/graphene-django/issues/737), but I don’t have a graphql folder in the root of my project. Any advice would be helpful 😃

here’s my requirements.txt

Flask==1.1.1
Flask-SQLAlchemy==2.4.1
SQLAlchemy==1.3.12
Flask-Migrate==2.5.2
psycopg2-binary==2.8.4
python-dotenv==0.11.0
firebase-admin==4.1.0
graphene==2.0.0

I’ve tried other versions of graphene, but the issue persists

here’s the output of my pip3 freeze

alembic==1.4.2
aniso8601==7.0.0
appdirs==1.4.3
apturl==0.5.2
asn1crypto==0.24.0
astroid==2.3.3
attrs==19.3.0
autopep8==1.5
bcrypt==3.1.7
blinker==1.4
Brlapi==0.6.6
CacheControl==0.12.6
cached-property==1.5.1
cachetools==4.1.0
certifi==2020.4.5.1
cffi==1.13.2
chardet==3.0.4
click==7.1.2
colorama==0.3.7
command-not-found==0.3
cryptography==2.8
cupshelpers==1.0
defer==1.0.6
distlib==0.3.0
distro==1.0.1
distro-info===0.18ubuntu0.18.04.1
docker==4.1.0
docker-compose==1.25.2
dockerpty==0.4.1
docopt==0.6.2
evdev==0.7.0
filelock==3.0.12
firebase-admin==4.1.0
Flask==1.1.1
Flask-GraphQL==2.0.1
Flask-Migrate==2.5.2
Flask-SQLAlchemy==2.4.1
google-api-core==1.17.0
google-api-python-client==1.8.2
google-auth==1.14.1
google-auth-httplib2==0.0.3
google-cloud-core==1.3.0
google-cloud-firestore==1.6.2
google-cloud-storage==1.28.0
google-resumable-media==0.5.0
googleapis-common-protos==1.51.0
graphene==2.1.8
graphql-core==3.1.0
graphql-relay==3.0.0
graphql-server-core==1.2.0
grpcio==1.28.1
Guake==3.0.5
httplib2==0.17.3
idna==2.9
importlib-metadata==1.4.0
importlib-resources==1.0.2
isort==4.3.21
itsdangerous==1.1.0
Jinja2==2.11.2
jsonschema==3.2.0
keyring==10.6.0
keyrings.alt==3.0
language-selector==0.1
launchpadlib==1.10.6
lazr.restfulclient==0.13.5
lazr.uri==1.0.3
lazy-object-proxy==1.4.3
louis==3.5.0
lutris==0.5.5
macaroonbakery==1.1.3
Mako==1.1.2
MarkupSafe==1.1.1
mccabe==0.6.1
more-itertools==8.1.0
msgpack==1.0.0
netifaces==0.10.4
oauth==1.0.1
olefile==0.45.1
paramiko==2.7.1
pbr==3.1.1
pexpect==4.2.1
Pillow==5.1.0
promise==2.3
protobuf==3.11.3
psutil==5.4.2
psycopg2-binary==2.8.4
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycairo==1.16.2
PyChromecast==0.8.1
pycodestyle==2.5.0
pycparser==2.19
pycrypto==2.6.1
pycups==1.9.73
pygobject==3.26.1
pyinotify==0.9.6
pylint==2.4.4
pymacaroons==0.13.0
PyNaCl==1.3.0
pyOpenSSL==17.5.0
pyRFC3339==1.0
pyrsistent==0.15.7
python-apt==1.6.5+ubuntu0.2
python-dateutil==2.8.1
python-debian==0.1.32
python-distutils-extra==2.39
python-dotenv==0.11.0
python-editor==1.0.4
python-Levenshtein==0.12.0
pytz==2020.1
pyxattr==0.6.0
pyxdg==0.25
PyYAML==5.3
reportlab==3.4.0
requests==2.23.0
requests-unixsocket==0.1.5
rsa==4.0
Rx==1.6.1
SecretStorage==2.3.1
setproctitle==1.1.10
simplejson==3.13.2
six==1.14.0
SQLAlchemy==1.3.12
system-service==0.3
systemd-python==234
texttable==1.6.2
typed-ast==1.4.1
ubuntu-drivers-common==0.0.0
ufw==0.36
ulauncher==5.4.0
unattended-upgrades==0.1
uritemplate==3.0.1
urllib3==1.25.9
usb-creator==0.3.3
virtualenv==20.0.2
wadllib==1.3.2
websocket-client==0.57.0
Werkzeug==1.0.1
wrapt==1.11.2
xkit==0.0.0
youtube-dl==2018.3.14
zeroconf==0.19.1
zipp==2.0.0
zope.interface==4.3.2

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jkimbocommented, May 1, 2020

graphql-relay needs to be v2.0.1. These restrictions are all setup correctly in the various graphql packages it’s just that pip doesn’t enforce them once they have been installed (potentially incorrectly). Using a clean venv is a good way of making sure that you are only installing the packages that you need.

1reaction
jkimbocommented, Apr 30, 2020

Yes I would recommend just installing everything from scratch to make sure you get the right versions. Or use something like pip-tools to pin all your dependencies.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Import (cannot import name 'ResolveInfo' from 'graphql') error ...
Import (cannot import name 'ResolveInfo' from 'graphql') error when using newest graphene and graphene-django version.
Read more >
Python Django Graphene ImportError
First import your base classes (e.g. BaseQuery, BaseMutation). Then import the derived classes (the ones that use your base classes as the super ......
Read more >
Error Handling - graphql-python
All applications fail, and GraphQL is no different. Some clients may ask for information that's not available or execute a forbidden action.
Read more >
graphene-django-extras - PyPI
This is a basic example of graphene-django-extras package use. ... to avoid an import error produced by some changes in new version of...
Read more >
Source code for graphene.types.objecttype - Graphene-Python
... field except ImportError: from ..pyutils.dataclasses import make_dataclass, field # type: ignore # For static type checking with Mypy MYPY = False if ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found