{"id":298,"library":"grpcio","title":"gRPC for Python","description":"gRPC is a high-performance, open-source RPC framework that uses HTTP/2 for transport. The 'grpcio' package provides the core gRPC functionality for Python, enabling developers to build efficient and scalable services. The current version is 1.78.0, with regular updates to enhance performance and address issues.","status":"active","version":"1.78.0","language":"python","source_language":"en","source_url":"https://github.com/grpc/grpc","tags":["RPC","HTTP/2","gRPC","Python"],"install":[{"cmd":"pip install grpcio","lang":"bash","label":"Install gRPC core package"},{"cmd":"pip install grpcio-tools","lang":"bash","label":"Install gRPC tools for code generation"}],"dependencies":[{"reason":"Required for generating Python code from .proto files","package":"grpcio-tools","optional":true}],"imports":[{"note":"Core gRPC module for Python","symbol":"grpc","correct":"import grpc"},{"note":"Module for gRPC tools, including the protocol buffer compiler","symbol":"grpc_tools","correct":"import grpc_tools"}],"quickstart":{"code":"import grpc\nfrom concurrent import futures\n\n# Define the server\nserver = grpc.server(futures.ThreadPoolExecutor(max_workers=10))\n\n# Add your service implementations here\n\n# Start the server\nserver.add_insecure_port('[::]:50051')\nserver.start()\nserver.wait_for_termination()","lang":"python","description":"Basic setup for a gRPC server in Python"},"warnings":[{"fix":"Upgrade to Python 3.9 or higher.","message":"Python 2.7 support was removed on January 1, 2020.","severity":"breaking","affected_versions":"grpcio versions after 1.30.0"},{"fix":"Ensure .proto files are organized to match the desired Python package structure, or adjust import statements accordingly.","message":"Generated Python code from .proto files may have absolute imports, causing import errors in certain project structures.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Downgrade setuptools to version 49.6.0 if installation fails.","message":"Installation issues may arise due to setuptools version conflicts.","severity":"gotcha","affected_versions":"grpcio versions around 1.30.0"},{"fix":"Investigate test logs for hanging processes, deadlocks, or infinite loops that prevent tests from completing within the allotted time.","message":"Test execution timed out.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Review test duration, optimize test cases, check for infinite loops, and ensure sufficient resources are allocated for test execution.","message":"Test execution timed out. This could be due to long-running tests, resource constraints, or an infinite loop in the code.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-05-12T12:56:03.345Z","next_check":"2026-06-26T00:00:00.000Z","problems":[{"fix":"Install the necessary gRPC packages using pip: `pip install grpcio grpcio-tools`","cause":"This error occurs when the `grpcio` package (or its associated tools like `grpcio-tools`) is not installed or not accessible in the Python environment where the code is being run.","error":"ModuleNotFoundError: No module named 'grpc'"},{"fix":"Verify that the gRPC server is running and listening on the expected address and port. Check firewall rules (e.g., `ufw`, `iptables`) to ensure the port is open. Ensure the client is connecting to the correct IP address and port, possibly binding the server to `0.0.0.0` or `[::]` instead of `localhost` for external access.","cause":"This typically indicates that the gRPC client cannot establish a TCP connection to the gRPC server. Common reasons include the server not running, an incorrect server address/port, firewall issues, or network connectivity problems. The client might also report `grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with: status = StatusCode.UNAVAILABLE` in this scenario.","error":"Connection refused"},{"fix":"Upgrade `grpcio` to a version that supports `asyncio` (e.g., `grpcio>=1.32.0`) by running `pip install --upgrade grpcio grpcio-tools`. If issues persist, try reinstalling with `--no-cache-dir` to ensure a fresh build.","cause":"This error arises when trying to use the asynchronous gRPC API (`grpc.aio`) with an older version of `grpcio` that does not support it, or if there's an issue with the installation of the `grpcio` package's C extensions.","error":"AttributeError: module 'grpc' has no attribute 'aio'"},{"fix":"Ensure the server is presenting a valid, trusted SSL certificate. If using self-signed certificates for development, configure the client to trust them explicitly. Update `certifi` (if applicable) using `pip install --upgrade certifi`. For environments where proxy issues might interfere with certificate validation, setting `grpc.enable_http_proxy=0` in channel options might help.","cause":"This error occurs during a secure (TLS/SSL) gRPC connection when the client cannot verify the server's SSL certificate. This can be due to an invalid certificate, a self-signed certificate not trusted by the client, or an outdated `certifi` package.","error":"SSL: CERTIFICATE_VERIFY_FAILED"},{"fix":"Install the 'Build Tools for Visual Studio' from Microsoft's website, ensuring the 'Desktop development with C++' workload is selected.","cause":"Installing grpcio from source on Windows requires the Microsoft Visual C++ build tools to compile its C extensions.","error":"error: Microsoft Visual C++ 14.0 or greater is required."}],"ecosystem":"pypi","meta_description":null,"install_score":100,"install_tag":"verified","quickstart_score":0,"quickstart_tag":"stale","pypi_latest":null,"install_checks":{"last_tested":"2026-05-12","tag":"verified","tag_description":"installs cleanly on critical runtimes, fast import, recently tested","results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.14,"mem_mb":5.5,"disk_size":"38.2M"},{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.13,"mem_mb":5.5,"disk_size":"49.8M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.1,"mem_mb":5.5,"disk_size":"36M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.09,"mem_mb":5.5,"disk_size":"45M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.24,"mem_mb":6.8,"disk_size":"40.3M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.23,"mem_mb":6.8,"disk_size":"52.3M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.18,"mem_mb":6.8,"disk_size":"38M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.2,"mem_mb":6.8,"disk_size":"48M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.46,"mem_mb":8.7,"disk_size":"32.1M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.46,"mem_mb":8.7,"disk_size":"53.0M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.41,"mem_mb":8.7,"disk_size":"30M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.43,"mem_mb":8.7,"disk_size":"49M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.47,"mem_mb":9.2,"disk_size":"31.7M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.49,"mem_mb":9.2,"disk_size":"52.7M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.4,"mem_mb":9.2,"disk_size":"29M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.41,"mem_mb":9.2,"disk_size":"48M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.17,"mem_mb":5.6,"disk_size":"37.7M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.13,"mem_mb":5.6,"disk_size":"49.3M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.12,"mem_mb":5.6,"disk_size":"35M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.13,"mem_mb":5.6,"disk_size":"45M"}]},"quickstart_checks":{"last_tested":"2026-04-23","tag":"stale","tag_description":"widespread failures or data too old to trust","results":[{"runtime":"python:3.10-alpine","exit_code":-1},{"runtime":"python:3.10-slim","exit_code":-1},{"runtime":"python:3.11-alpine","exit_code":-1},{"runtime":"python:3.11-slim","exit_code":-1},{"runtime":"python:3.12-alpine","exit_code":-1},{"runtime":"python:3.12-slim","exit_code":-1},{"runtime":"python:3.13-alpine","exit_code":-1},{"runtime":"python:3.13-slim","exit_code":-1},{"runtime":"python:3.9-alpine","exit_code":-1},{"runtime":"python:3.9-slim","exit_code":-1}]}}