mnubo / kubernetes-py

A python module for Kubernetes.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add installation instructions

aaaaalbert opened this issue · comments

In addition to noting the support Python etc. versions (see #110), I think it would be helpful to also describe the supported ways to install kubernetes-py.

I tried running python3 setup.py install on the current ad550fb on a Ubuntu 16.04.1 box with Python 3.5.2. This fails to install the install_requires packages (amongst other errors), printing these messages:

/usr/lib/python3.5/distutils/dist.py:261: UserWarning: Unknown distribution option: 'include_package_data'
  warnings.warn(msg)
/usr/lib/python3.5/distutils/dist.py:261: UserWarning: Unknown distribution option: 'zip_safe'
  warnings.warn(msg)
/usr/lib/python3.5/distutils/dist.py:261: UserWarning: Unknown distribution option: 'test_suite'
  warnings.warn(msg)
/usr/lib/python3.5/distutils/dist.py:261: UserWarning: Unknown distribution option: 'tests_require'
  warnings.warn(msg)
/usr/lib/python3.5/distutils/dist.py:261: UserWarning: Unknown distribution option: 'install_requires'
  warnings.warn(msg)
running install
(...)

I suppose this is an incompatibility with my old Python/pip, and after manually installing the required packages with pip3 I can import the kubernetes module in Python3. Still, it would be great to know whether my install approach was correct to begin with.

Thanks for sharing this useful piece of software with the world!

Here is what I found to work for me:

If you just want the latest published version from PyPI, run pip3 install kubernetes-py to have the project and its dependencies downloaded and installed. Specify --user, sudo, virtualenv etc. as fits for your setup.

If you want to work off a specific Git version (HEAD of the master branch by current defaults),

  • git clone the version of kubernetes-py that you are interested in.
  • Use pip3 in editable mode to install kubernetes-py from your local working copy: pip3 install -e kubernetes-py. Again, use --user, sudo, virtualenv etc. as desired.

Note that both suggestions differ from my previous approach (where I used setup.py directly).

Have you tried this on python 3.6? It works well on my end.

$ python --version
Python 3.6.5
$ pip install kubernetes-py
Looking in indexes: https://pypi.python.org/simple
Collecting kubernetes-py
  Using cached https://files.pythonhosted.org/packages/a6/65/fb64124a3e91ec58aa0782dfa84b7b4bb07325ff080554ecef19a757ef63/kubernetes-py-1.10.0.6.tar.gz
Requirement already satisfied: six>=1.10.0 in /Users/sebastienc/.pyenv/versions/3.6.5/lib/python3.6/site-packages (from kubernetes-py) (1.11.0)
Requirement already satisfied: PyYAML>=3.13 in /Users/sebastienc/.pyenv/versions/3.6.5/lib/python3.6/site-packages (from kubernetes-py) (3.13)
Requirement already satisfied: requests>=2.10.0 in /Users/sebastienc/.pyenv/versions/3.6.5/lib/python3.6/site-packages (from kubernetes-py) (2.19.1)
Requirement already satisfied: uuid>=1.30 in /Users/sebastienc/.pyenv/versions/3.6.5/lib/python3.6/site-packages (from kubernetes-py) (1.30)
Requirement already satisfied: python-dateutil>=2.6.0 in /Users/sebastienc/.pyenv/versions/3.6.5/lib/python3.6/site-packages (from kubernetes-py) (2.7.3)
Requirement already satisfied: idna<2.8,>=2.5 in /Users/sebastienc/.pyenv/versions/3.6.5/lib/python3.6/site-packages (from requests>=2.10.0->kubernetes-py) (2.7)
Requirement already satisfied: certifi>=2017.4.17 in /Users/sebastienc/.pyenv/versions/3.6.5/lib/python3.6/site-packages (from requests>=2.10.0->kubernetes-py) (2018.8.24)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /Users/sebastienc/.pyenv/versions/3.6.5/lib/python3.6/site-packages (from requests>=2.10.0->kubernetes-py) (3.0.4)
Requirement already satisfied: urllib3<1.24,>=1.21.1 in /Users/sebastienc/.pyenv/versions/3.6.5/lib/python3.6/site-packages (from requests>=2.10.0->kubernetes-py) (1.23)
Installing collected packages: kubernetes-py
  Running setup.py install for kubernetes-py ... done
Successfully installed kubernetes-py-1.10.0.6

I've also tried using python 3.5.2 with pyenv and got some good results..

$ python --version
Python 3.5.2
$ pip install --upgrade kubernetes-py
Looking in indexes: https://pypi.python.org/simple
Collecting kubernetes-py
  Using cached https://files.pythonhosted.org/packages/a6/65/fb64124a3e91ec58aa0782dfa84b7b4bb07325ff080554ecef19a757ef63/kubernetes-py-1.10.0.6.tar.gz
Collecting six>=1.10.0 (from kubernetes-py)
  Using cached https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Collecting PyYAML>=3.13 (from kubernetes-py)
  Using cached https://files.pythonhosted.org/packages/9e/a3/1d13970c3f36777c583f136c136f804d70f500168edc1edea6daa7200769/PyYAML-3.13.tar.gz
Collecting requests>=2.10.0 (from kubernetes-py)
  Using cached https://files.pythonhosted.org/packages/65/47/7e02164a2a3db50ed6d8a6ab1d6d60b69c4c3fdf57a284257925dfc12bda/requests-2.19.1-py2.py3-none-any.whl
Collecting uuid>=1.30 (from kubernetes-py)
  Using cached https://files.pythonhosted.org/packages/ce/63/f42f5aa951ebf2c8dac81f77a8edcc1c218640a2a35a03b9ff2d4aa64c3d/uuid-1.30.tar.gz
Collecting python-dateutil>=2.6.0 (from kubernetes-py)
  Using cached https://files.pythonhosted.org/packages/cf/f5/af2b09c957ace60dcfac112b669c45c8c97e32f94aa8b56da4c6d1682825/python_dateutil-2.7.3-py2.py3-none-any.whl
Collecting idna<2.8,>=2.5 (from requests>=2.10.0->kubernetes-py)
  Using cached https://files.pythonhosted.org/packages/4b/2a/0276479a4b3caeb8a8c1af2f8e4355746a97fab05a372e4a2c6a6b876165/idna-2.7-py2.py3-none-any.whl
Collecting chardet<3.1.0,>=3.0.2 (from requests>=2.10.0->kubernetes-py)
  Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
Collecting urllib3<1.24,>=1.21.1 (from requests>=2.10.0->kubernetes-py)
  Using cached https://files.pythonhosted.org/packages/bd/c9/6fdd990019071a4a32a5e7cb78a1d92c53851ef4f56f62a3486e6a7d8ffb/urllib3-1.23-py2.py3-none-any.whl
Collecting certifi>=2017.4.17 (from requests>=2.10.0->kubernetes-py)
  Using cached https://files.pythonhosted.org/packages/df/f7/04fee6ac349e915b82171f8e23cee63644d83663b34c539f7a09aed18f9e/certifi-2018.8.24-py2.py3-none-any.whl
Installing collected packages: six, PyYAML, idna, chardet, urllib3, certifi, requests, uuid, python-dateutil, kubernetes-py
  Running setup.py install for PyYAML ... done
  Running setup.py install for uuid ... done
  Running setup.py install for kubernetes-py ... done
Successfully installed PyYAML-3.13 certifi-2018.8.24 chardet-3.0.4 idna-2.7 kubernetes-py-1.10.0.6 python-dateutil-2.7.3 requests-2.19.1 six-1.11.0 urllib3-1.23 uuid-1.30

I've updated the documentation a bit in this: #137

Thank you for checking! I think your #137 fixes what this issue initially requested, i.e. to add installation instructions. I will close this issue.

If pip is indeed the recommended / only supported way to install kubernetes-py, then I'm fine with #137. If you plan to cater to developers who want to run off Git, perhaps consider mentioning other options such as setup.py too. (I leave it to your judgement whether you consider my problems with setup.py a bug.)