You need to install it first!īefore being able to import the grpc module, you need to install it using Python’s package manager pip. The most likely reason is that Python doesn’t provide grpc in its standard library. ModuleNotFoundError: No module named 'grpc'īy the way, this graphic shows the purpose of gRPC and what it is: However, it only throws the following ImportError: No module named grpc: > import grpc This is supposed to import the gRPC library into your (virtual) environment. You’ve just learned about the awesome capabilities of the grpc library and you want to try it out, so you start your code with the following statement: import grpc Here are some examples that may work depending on your environment: python -m pip install grpcioĪlso, make sure to install grpcio-tools: pip install grpcio-tools Problem Formulation If you really want to install grpcio, replace all occurrences of pip install grpc (and variants) with pip install grpcio. In most cases, you actually want to pip install grpcio and not grpc. Alternatively, you may have different Python versions on your computer, and grpc is not installed for the particular version you’re using. The most frequent source of this error is that you haven’t installed grpc explicitly with pip install grpcio. Quick Fix: Python raises the ImportError: No module named 'grpc' when it cannot find the library grpc.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |