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