Closed
Description
I'm trying to test this with flask, but running into package compatibility issues. Using Python 3.9.6, my requirements.txt is:
Flask
graphene
graphql-server[flask]
which ends up giving me:
$pip freeze
aniso8601==9.0.1
click==8.1.3
Flask==1.1.2
graphene==3.1.1
graphql-core==3.2.3
graphql-relay==3.2.0
graphql-server==3.0.0b5
itsdangerous==2.1.2
Jinja2==3.1.2
MarkupSafe==2.1.1
typing_extensions==4.4.0
Werkzeug==2.2.2
Trying to run my flask app results in
ImportError: cannot import name 'escape' from 'jinja2'
Trying to resolve that issue leads me to https://stackoverflow.com/questions/71718167/importerror-cannot-import-name-escape-from-jinja2:
Jinja is a dependency of Flask and Flask V1.X.X uses the escape module from Jinja, however recently support for the escape module was [dropped in newer versions of Jinja](https://jinja.palletsprojects.com/en/3.1.x/changes/#version-3-1-0).
To fix this issue, simply update to the newer version of Flask V2.X.X in your requirements.txt where Flask no longer uses the escape module from Jinja.
Flask==2.1.0
Also, do note that Flask V1.X.X is no longer supported by the team. If you want to continue to use this older version, [this Github issue may help.](https://github.com/pallets/flask/issues/4494)
Setting my requirements to:
Flask>=2.1.0
graphene
graphql-server[flask]
results in
pip freeze
aniso8601==9.0.1
click==8.1.3
Flask==2.2.2
graphene==3.1.1
graphql-core==3.2.3
graphql-relay==3.2.0
graphql-server==3.0.0b4
importlib-metadata==5.1.0
itsdangerous==2.1.2
Jinja2==3.1.2
MarkupSafe==2.1.1
typing-extensions==3.10.0.2
Werkzeug==2.2.2
zipp==3.11.0
then running my app results in
Traceback (most recent call last):
File "main.py", line 3, in <module>
from graphql_server.flask import GraphQLView
File "env/lib/python3.9/site-packages/graphql_server/__init__.py", line 15, in <module>
from graphql.error import format_error as format_error_default
ImportError: cannot import name 'format_error' from 'graphql.error'
Trying to resolve this brings me to #85, which says to upgrade to graphql-server 3.0.0b5, so I pin my requirements.txt and when I try to install, I get:
pip install -r requirements.txt
Requirement already satisfied: Flask>=2.1.0 in ./env/lib/python3.9/site-packages (from -r requirements.txt (line 1)) (2.2.2)
Requirement already satisfied: graphene in ./env/lib/python3.9/site-packages (from -r requirements.txt (line 2)) (3.1.1)
Collecting graphql-server[flask]==3.0.0b5
Using cached graphql-server-3.0.0b5.tar.gz (45 kB)
Requirement already satisfied: graphql-core<3.3,>=3.2 in ./env/lib/python3.9/site-packages (from graphql-server[flask]==3.0.0b5->-r requirements.txt (line 3)) (3.2.3)
Collecting typing-extensions<5,>=4
Using cached typing_extensions-4.4.0-py3-none-any.whl (26 kB)
ERROR: Cannot install Flask>=2.1.0 and graphql-server[flask]==3.0.0b5 because these package versions have conflicting dependencies.
The conflict is caused by:
The user requested Flask>=2.1.0
graphql-server[flask] 3.0.0b5 depends on flask<2 and >=1
What do I do? graphql-server should be updated to support flask v2 as flask v1 is no longer maintained.
Metadata
Metadata
Assignees
Labels
No labels