1gRPC Python 2=========== 3 4|compat_check_pypi| 5 6Package for gRPC Python. 7 8.. |compat_check_pypi| image:: https://python-compatibility-tools.appspot.com/one_badge_image?package=grpcio 9 :target: https://python-compatibility-tools.appspot.com/one_badge_target?package=grpcio 10 11 12Installation 13------------ 14 15gRPC Python is available for Linux, macOS, and Windows. 16 17Installing From PyPI 18~~~~~~~~~~~~~~~~~~~~ 19 20If you are installing locally... 21 22:: 23 24 $ pip install grpcio 25 26Else system wide (on Ubuntu)... 27 28:: 29 30 $ sudo pip install grpcio 31 32If you're on Windows make sure that you installed the :code:`pip.exe` component 33when you installed Python (if not go back and install it!) then invoke: 34 35:: 36 37 $ pip.exe install grpcio 38 39Windows users may need to invoke :code:`pip.exe` from a command line ran as 40administrator. 41 42n.b. On Windows and on Mac OS X one *must* have a recent release of :code:`pip` 43to retrieve the proper wheel from PyPI. Be sure to upgrade to the latest 44version! 45 46Installing From Source 47~~~~~~~~~~~~~~~~~~~~~~ 48 49Building from source requires that you have the Python headers (usually a 50package named :code:`python-dev`). 51 52:: 53 54 $ export REPO_ROOT=grpc # REPO_ROOT can be any directory of your choice 55 $ git clone -b RELEASE_TAG_HERE https://github.com/grpc/grpc $REPO_ROOT 56 $ cd $REPO_ROOT 57 $ git submodule update --init 58 59 # To include systemd socket-activation feature in the build, 60 # first install the `libsystemd-dev` package, then : 61 $ export GRPC_PYTHON_BUILD_WITH_SYSTEMD=1 62 63 # For the next two commands do `sudo pip install` if you get permission-denied errors 64 $ pip install -r requirements.txt 65 $ GRPC_PYTHON_BUILD_WITH_CYTHON=1 pip install . 66 67You cannot currently install Python from source on Windows. Things might work 68out for you in MSYS2 (follow the Linux instructions), but it isn't officially 69supported at the moment. 70 71Troubleshooting 72~~~~~~~~~~~~~~~ 73 74Help, I ... 75 76* **... see the following error on some platforms** 77 78 :: 79 80 /tmp/pip-build-U8pSsr/cython/Cython/Plex/Scanners.c:4:20: fatal error: Python.h: No such file or directory 81 #include "Python.h" 82 ^ 83 compilation terminated. 84 85 You can fix it by installing `python-dev` package. i.e 86 87 :: 88 89 sudo apt-get install python-dev 90 91 92Versioning 93~~~~~~~~~~ 94 95gRPC Python is developed in a monorepo shared with implementations of gRPC in 96other programming languages. While the minor versions are released in 97lock-step with other languages in the repo (e.g. 1.63.0 is guaranteed to exist 98for all languages), patch versions may be specific to only a single 99language. For example, if 1.63.1 is a C++-specific patch, 1.63.1 may not be 100uploaded to PyPi. As a result, it is __not__ a good assumption that the latest 101patch for a given minor version on Github is also the latest patch for that 102same minor version on PyPi. 103 104