| 1 |
gRPC Python |
| 2 |
=========== |
| 3 |
|
| 4 |
|compat_check_pypi| |
| 5 |
|
| 6 |
Package 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 |
Supported Python Versions |
| 12 |
------------------------- |
| 13 |
Python >= 3.7 |
| 14 |
|
| 15 |
Installation |
| 16 |
------------ |
| 17 |
|
| 18 |
gRPC Python is available for Linux, macOS, and Windows. |
| 19 |
|
| 20 |
Installing From PyPI |
| 21 |
~~~~~~~~~~~~~~~~~~~~ |
| 22 |
|
| 23 |
If you are installing locally... |
| 24 |
|
| 25 |
:: |
| 26 |
|
| 27 |
$ pip install grpcio |
| 28 |
|
| 29 |
Else system wide (on Ubuntu)... |
| 30 |
|
| 31 |
:: |
| 32 |
|
| 33 |
$ sudo pip install grpcio |
| 34 |
|
| 35 |
If you're on Windows make sure that you installed the :code:`pip.exe` component |
| 36 |
when you installed Python (if not go back and install it!) then invoke: |
| 37 |
|
| 38 |
:: |
| 39 |
|
| 40 |
$ pip.exe install grpcio |
| 41 |
|
| 42 |
Windows users may need to invoke :code:`pip.exe` from a command line ran as |
| 43 |
administrator. |
| 44 |
|
| 45 |
n.b. On Windows and on Mac OS X one *must* have a recent release of :code:`pip` |
| 46 |
to retrieve the proper wheel from PyPI. Be sure to upgrade to the latest |
| 47 |
version! |
| 48 |
|
| 49 |
Installing From Source |
| 50 |
~~~~~~~~~~~~~~~~~~~~~~ |
| 51 |
|
| 52 |
Building from source requires that you have the Python headers (usually a |
| 53 |
package named :code:`python-dev`). |
| 54 |
|
| 55 |
:: |
| 56 |
|
| 57 |
$ export REPO_ROOT=grpc # REPO_ROOT can be any directory of your choice |
| 58 |
$ git clone -b RELEASE_TAG_HERE https://github.com/grpc/grpc $REPO_ROOT |
| 59 |
$ cd $REPO_ROOT |
| 60 |
$ git submodule update --init |
| 61 |
|
| 62 |
# For the next two commands do `sudo pip install` if you get permission-denied errors |
| 63 |
$ pip install -rrequirements.txt |
| 64 |
$ GRPC_PYTHON_BUILD_WITH_CYTHON=1 pip install . |
| 65 |
|
| 66 |
You cannot currently install Python from source on Windows. Things might work |
| 67 |
out for you in MSYS2 (follow the Linux instructions), but it isn't officially |
| 68 |
supported at the moment. |
| 69 |
|
| 70 |
Troubleshooting |
| 71 |
~~~~~~~~~~~~~~~ |
| 72 |
|
| 73 |
Help, I ... |
| 74 |
|
| 75 |
* **... see a** :code:`pkg_resources.VersionConflict` **when I try to install |
| 76 |
grpc** |
| 77 |
|
| 78 |
This is likely because :code:`pip` doesn't own the offending dependency, |
| 79 |
which in turn is likely because your operating system's package manager owns |
| 80 |
it. You'll need to force the installation of the dependency: |
| 81 |
|
| 82 |
:code:`pip install --ignore-installed $OFFENDING_DEPENDENCY` |
| 83 |
|
| 84 |
For example, if you get an error like the following: |
| 85 |
|
| 86 |
:: |
| 87 |
|
| 88 |
Traceback (most recent call last): |
| 89 |
File "<string>", line 17, in <module> |
| 90 |
... |
| 91 |
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 509, in find |
| 92 |
raise VersionConflict(dist, req) |
| 93 |
pkg_resources.VersionConflict: (six 1.8.0 (/usr/lib/python2.7/dist-packages), Requirement.parse('six>=1.10')) |
| 94 |
|
| 95 |
You can fix it by doing: |
| 96 |
|
| 97 |
:: |
| 98 |
|
| 99 |
sudo pip install --ignore-installed six |
| 100 |
|
| 101 |
* **... see the following error on some platforms** |
| 102 |
|
| 103 |
:: |
| 104 |
|
| 105 |
/tmp/pip-build-U8pSsr/cython/Cython/Plex/Scanners.c:4:20: fatal error: Python.h: No such file or directory |
| 106 |
#include "Python.h" |
| 107 |
^ |
| 108 |
compilation terminated. |
| 109 |
|
| 110 |
You can fix it by installing `python-dev` package. i.e |
| 111 |
|
| 112 |
:: |
| 113 |
|
| 114 |
sudo apt-get install python-dev |
| 115 |
|