Skip to content

Flask example gives ImportError #380

Closed
@MattKleinsmith

Description

@MattKleinsmith

Might be the only answer for now?

Approach: Downgrade.

How: Replace the entire contents of graphene-sqlalchemy/examples/flask_sqlalchemy/requirements.txt with:

flask-graphql==2.0.1
graphene==2.1.9
graphene-sqlalchemy==2.3.0

Original post

Hello,

I followed the README instructions for Example Flask+SQLAlchemy Project and I'm getting the following error:

ImportError: cannot import name 'get_default_backend' from 'graphql' (/home/mwk/code/graphene-sqlalchemy/.venv/lib/python3.9/site-packages/graphql/__init__.py)

My intention with this issue is to figure it out, documenting it for others, including a future me. Help is welcomed.

Upon pip install -r requirements.txt, I see this list of packages and versions (removed some probably-irrelevant ones:

"Successfully installed":

  • Flask-GraphQL-2.0.0
  • SQLAlchemy-1.4.46
  • flask-2.2.2
  • graphene-3.2.1
  • graphene-sqlalchemy-3.0.0b3
  • graphql-core-3.2.3
  • graphql-relay-3.2.0
  • graphql-server-core-1.1.1

Perhaps one of these versions is not the one I should be using.

I'm using Python 3.9.4, on WSL 2, Ubuntu 22.04.1 LTS, VS Code, pipenv shell.

Relevant discussions:

graphql-python/graphene#1086
https://stackoverflow.com/questions/70204957/flask-graphql-import-fails
#348
graphql-python/graphql-server#29
graphql-python/flask-graphql#66

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions