ModuleNotFoundError: No module named 'graphql'
The Python virtual environment use created with virtualenv ,python version is
#python --version
Python 3.7.3
When I execute the following commands:
#py.test graphene/relay/
The following error occurred:
Hint: make sure your test modules/packages have valid Python names.
Traceback:
graphene/__init__.py:3: in <module>
from .types import (
graphene/types/__init__.py:2: in <module>
from graphql import GraphQLResolveInfo as ResolveInfo
E ModuleNotFoundError: No module named 'graphql'
But when I execute the following commands install graphql extension,have following error:
# pip install graphql
Complete output (10 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.7-x86_64-3.7
creating build/lib.macosx-10.7-x86_64-3.7/graphql
copying graphql/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/graphql
running build_ext
building 'graphql_ext' extension
error: unknown file type '.pyx' (from 'graphql/graphql_ext.pyx')
----------------------------------------
ERROR: Failed building wheel for graphql
I wonder if you have encountered this problem.
Try:
pip install pip --upgrade
pip install setuptools --upgrade
Try:
pip install pip --upgrade
pip install setuptools --upgrade
Thank you for your reply. I tried your operation, but now there are other new error. when I execute the following commands
# py.test graphene/relay
have new following error:
_______________________________________________________ ERROR collecting graphene/relay/tests/test_connection.py ________________________________________________________
ImportError while importing test module '/Users/shiwei/Documents/python_project/study_graphene_new/graphene/graphene/relay/tests/test_connection.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
graphene/__init__.py:33: in <module>
from .relay import (
graphene/relay/__init__.py:1: in <module>
from .node import Node, is_node, GlobalID
graphene/relay/node.py:4: in <module>
from graphql_relay import from_global_id, to_global_id
../lib/python3.7/site-packages/graphql_relay/__init__.py:16: in <module>
from .mutation.mutation import (
../lib/python3.7/site-packages/graphql_relay/mutation/mutation.py:3: in <module>
from graphql.type import (
E ImportError: cannot import name 'GraphQLInputObjectField' from 'graphql.type' (/Users/shiwei/Documents/python_project/study_graphene_new/lib/python3.7/site-packages/graphql/type/__init__.py)
I
@dsw0214 Shell history
14463 git clone https://github.com/graphql-python/graphene.git
14464 cd graphene
14465 python setup.py install
14466 py.test graphene/relay/
@Hanaasagi Thank you very much for your reply. I tried again, but still not work. My Environmental information is as follows:
#virtualenv --version
15.2.0
#python -V
Python 3.7.3
#System:
macOs Mojave(version:10.14)
@manesioz @Hanaasagi Thank you again for your reply and help. I tried different platforms and environments, and now it works:
# System: CentOS Linux release 7.2.1511 (Core)
# virtualenv --version
16.0.0
# python -V
Python 3.6.9

The problem should be caused by the operating environment.
I got the same error: error: unknown file type '.pyx' (from 'graphql/graphql_ext.pyx')
These commands worked for me to get rid from graphql errors. pip install pip --upgrade pip install setuptools --upgrade pip install gql[all]