graphql-python / graphql-server

This is the core package for using GraphQL in a custom server easily
MIT License
120 stars 72 forks source link

ModuleNotFoundError: No module named 'jinja2' when importing `graphql_server.aiohttp` #86

Closed lycantropos closed 1 year ago

lycantropos commented 2 years ago

After installation

pip install graphql-server[aiohttp]

with output

...
Successfully installed graphql-core-3.2.0 graphql-server-3.0.0b5 typing-extensions-4.0.1

then attempt to import

from graphql_server.aiohttp import GraphQLView

gives

Traceback (most recent call last):
  File ".../main.py", line 9, in <module>
    from graphql_server.aiohttp import GraphQLView
  File ".../venv/lib/python3.9/site-packages/graphql_server/aiohttp/__init__.py", line 1, in <module>
    from .graphqlview import GraphQLView
  File ".../venv/lib/python3.9/site-packages/graphql_server/aiohttp/graphqlview.py", line 19, in <module>
    from graphql_server.render_graphiql import (
  File ".../venv/lib/python3.9/site-packages/graphql_server/render_graphiql.py", line 7, in <module>
    from jinja2 import Environment
ModuleNotFoundError: No module named 'jinja2'

so it looks like it needs to be included in install_aiohttp_requires?

theodesp commented 2 years ago

@lycantropos I think this does not happen only to aiohttp but all of the packages that use GraphQLView:

❯ pip install graphql-server[sanic]
>>> from graphql_server.sanic import GraphQLView
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/theo.despoudis/Workspace/graphene/.venv/lib/python3.9/site-packages/graphql_server/sanic/__init__.py", line 1, in <module>
    from .graphqlview import GraphQLView
  File "/Users/theo.despoudis/Workspace/graphene/.venv/lib/python3.9/site-packages/graphql_server/sanic/graphqlview.py", line 21, in <module>
    from graphql_server.render_graphiql import (
  File "/Users/theo.despoudis/Workspace/graphene/.venv/lib/python3.9/site-packages/graphql_server/render_graphiql.py", line 7, in <module>
    from jinja2 import Environment
ModuleNotFoundError: No module named 'jinja2'