README.rst 2.9 KB

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