graphene federation causing dependency issue

63 views Asked by At

Trying to use Flask-GraphQL, graphene, starlette-graphene3 and graphene-federation to integrate python code with an existing graphql server. The code worked before trying to install graphene-federation. Other trys have meant pip unable to resolve dependencies. Packages before installing federation and graphql IDE runs locally.

    Flask==1.0.2
    Flask-GraphQL==2.0.0
    graphene==2.1.3
    graphql-core==2.1
    graphql-relay==0.4.5
    graphql-server-core==1.1.1`

If I install graphene-federation then there are dependency issues which are resolved by these packages

    Flask                 1.0.2
    Flask-GraphQL         2.0.0
    graphene              3.1
    graphene-federation   3.1.4
    graphene-sqlalchemy   2.1.0
    graphql-core          3.2.0
    graphql-relay         3.1.0
    graphql-server-core   1.1.1
    graphql-utilities     0.4.0
    starlette             0.25.0
    starlette-graphene3   0.6.0

But then this gives the error

ImportError: cannot import name 'get_default_backend' from 'graphql'
1

There are 1 answers

0
abh95 On

I assume the exception rises when you try to import the flask-graphql library. Turns out it is now maintained in the graphql-server repository, so you're better off removing your dependency for the library and adding a new one for graphql-server instead. You will be able to import flask-graphql from it.

Here are the versions I'm using:

graphql-server==3.0.0b7
graphql-server-core==1.1.1
graphql-core==3.2.3
graphql-relay==3.2.0
Flask==3.0.2
Flask-GraphQL==2.0.0
graphene==3.3

I haven't inspected further into potentially negative interactions between other versions of these libraries.

Here's the link to an example of use from the graphql-server repo.