Running the examples from https://github.com/kubernetes-client/python/tree/master/kubernetes#getting-started as follows (linked installation instructions included) fails due to
> sudo pip install git+https://github.com/kubernetes-client/python.git
WARNING: The directory '/mnt/data/cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
WARNING: The directory '/home/richter/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting git+https://github.com/kubernetes-client/python.git
Cloning https://github.com/kubernetes-client/python.git to /tmp/pip-req-build-sptoxq8f
Running command git clone -q https://github.com/kubernetes-client/python.git /tmp/pip-req-build-sptoxq8f
Running command git submodule update --init --recursive -q
Requirement already satisfied: certifi>=14.05.14 in /usr/lib/python3/dist-packages (from kubernetes===10.0.0-snapshot) (2018.8.24)
Requirement already satisfied: google-auth>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from kubernetes===10.0.0-snapshot) (1.6.3)
Requirement already satisfied: python-dateutil>=2.5.3 in /usr/lib/python3/dist-packages (from kubernetes===10.0.0-snapshot) (2.7.3)
Requirement already satisfied: pyyaml>=3.12 in /usr/lib/python3/dist-packages (from kubernetes===10.0.0-snapshot) (3.13)
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from kubernetes===10.0.0-snapshot) (2.21.0)
Requirement already satisfied: requests-oauthlib in /usr/local/lib/python3.7/dist-packages (from kubernetes===10.0.0-snapshot) (1.2.0)
Requirement already satisfied: setuptools>=21.0.0 in /usr/lib/python3/dist-packages (from kubernetes===10.0.0-snapshot) (40.8.0)
Requirement already satisfied: six>=1.9.0 in /usr/lib/python3/dist-packages (from kubernetes===10.0.0-snapshot) (1.12.0)
Requirement already satisfied: urllib3>=1.23 in /usr/lib/python3/dist-packages (from kubernetes===10.0.0-snapshot) (1.24.1)
Requirement already satisfied: websocket-client!=0.40.0,!=0.41.*,!=0.42.*,>=0.32.0 in /usr/local/lib/python3.7/dist-packages (from kubernetes===10.0.0-snapshot) (0.56.0)
Requirement already satisfied: cachetools>=2.0.0 in /usr/local/lib/python3.7/dist-packages (from google-auth>=1.0.1->kubernetes===10.0.0-snapshot) (3.1.1)
Requirement already satisfied: pyasn1-modules>=0.2.1 in /usr/lib/python3/dist-packages (from google-auth>=1.0.1->kubernetes===10.0.0-snapshot) (0.2.1)
Requirement already satisfied: rsa>=3.1.4 in /usr/local/lib/python3.7/dist-packages (from google-auth>=1.0.1->kubernetes===10.0.0-snapshot) (4.0)
Requirement already satisfied: oauthlib>=3.0.0 in /usr/local/lib/python3.7/dist-packages (from requests-oauthlib->kubernetes===10.0.0-snapshot) (3.0.2)
Requirement already satisfied: pyasn1>=0.1.3 in /usr/lib/python3/dist-packages (from rsa>=3.1.4->google-auth>=1.0.1->kubernetes===10.0.0-snapshot) (0.4.2)
Building wheels for collected packages: kubernetes
Building wheel for kubernetes (setup.py) ... done
Stored in directory: /tmp/pip-ephem-wheel-cache-rkog3wjt/wheels/09/2b/27/9e7dcb3e2ee8d46375251ebddc69cf5d57b53d00ad949f58ca
Successfully built kubernetes
Installing collected packages: kubernetes
Found existing installation: kubernetes 10.0.0
Uninstalling kubernetes-10.0.0:
Successfully uninstalled kubernetes-10.0.0
Successfully installed kubernetes-10.0.0-snapshot
> sudo pip3 install git+https://github.com/kubernetes-client/python.git
WARNING: The directory '/mnt/data/cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
WARNING: The directory '/home/richter/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting git+https://github.com/kubernetes-client/python.git
Cloning https://github.com/kubernetes-client/python.git to /tmp/pip-req-build-v2imjqwc
Running command git clone -q https://github.com/kubernetes-client/python.git /tmp/pip-req-build-v2imjqwc
Running command git submodule update --init --recursive -q
Requirement already satisfied (use --upgrade to upgrade): kubernetes===10.0.0-snapshot from git+https://github.com/kubernetes-client/python.git in /usr/local/lib/python3.7/dist-packages
Requirement already satisfied: certifi>=14.05.14 in /usr/lib/python3/dist-packages (from kubernetes===10.0.0-snapshot) (2018.8.24)
Requirement already satisfied: google-auth>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from kubernetes===10.0.0-snapshot) (1.6.3)
Requirement already satisfied: python-dateutil>=2.5.3 in /usr/lib/python3/dist-packages (from kubernetes===10.0.0-snapshot) (2.7.3)
Requirement already satisfied: pyyaml>=3.12 in /usr/lib/python3/dist-packages (from kubernetes===10.0.0-snapshot) (3.13)
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from kubernetes===10.0.0-snapshot) (2.21.0)
Requirement already satisfied: requests-oauthlib in /usr/local/lib/python3.7/dist-packages (from kubernetes===10.0.0-snapshot) (1.2.0)
Requirement already satisfied: setuptools>=21.0.0 in /usr/lib/python3/dist-packages (from kubernetes===10.0.0-snapshot) (40.8.0)
Requirement already satisfied: six>=1.9.0 in /usr/lib/python3/dist-packages (from kubernetes===10.0.0-snapshot) (1.12.0)
Requirement already satisfied: urllib3>=1.23 in /usr/lib/python3/dist-packages (from kubernetes===10.0.0-snapshot) (1.24.1)
Requirement already satisfied: websocket-client!=0.40.0,!=0.41.*,!=0.42.*,>=0.32.0 in /usr/local/lib/python3.7/dist-packages (from kubernetes===10.0.0-snapshot) (0.56.0)
Requirement already satisfied: rsa>=3.1.4 in /usr/local/lib/python3.7/dist-packages (from google-auth>=1.0.1->kubernetes===10.0.0-snapshot) (4.0)
Requirement already satisfied: cachetools>=2.0.0 in /usr/local/lib/python3.7/dist-packages (from google-auth>=1.0.1->kubernetes===10.0.0-snapshot) (3.1.1)
Requirement already satisfied: pyasn1-modules>=0.2.1 in /usr/lib/python3/dist-packages (from google-auth>=1.0.1->kubernetes===10.0.0-snapshot) (0.2.1)
Requirement already satisfied: oauthlib>=3.0.0 in /usr/local/lib/python3.7/dist-packages (from requests-oauthlib->kubernetes===10.0.0-snapshot) (3.0.2)
Requirement already satisfied: pyasn1>=0.1.3 in /usr/lib/python3/dist-packages (from rsa>=3.1.4->google-auth>=1.0.1->kubernetes===10.0.0-snapshot) (0.4.2)
Building wheels for collected packages: kubernetes
Building wheel for kubernetes (setup.py) ... done
Stored in directory: /tmp/pip-ephem-wheel-cache-ta8em7nd/wheels/09/2b/27/9e7dcb3e2ee8d46375251ebddc69cf5d57b53d00ad949f58ca
Successfully built kubernetes
> python2 ./kubernetes_python_example.py
Traceback (most recent call last):
File "./kubernetes_python_example.py", line 5, in <module>
import kubernetes.client
ImportError: No module named kubernetes.client
> python3 ./kubernetes_python_example.py
Traceback (most recent call last):
File "./kubernetes_python_example.py", line 10, in <module>
kubernetes.client.configuration.api_key['authorization'] = 'YOUR_API_KEY'
AttributeError: module 'kubernetes.client.configuration' has no attribute 'api_key'
experienced on Ubuntu 19.04 with Python 3.8 and 2.7
This README is auto-generated by swagger-codegen which might miss some Kubernetes-specific context (e.g. loading kubeconfig). I'd suggest starting with the manually maintained examples: https://github.com/kubernetes-client/python/tree/master/examples
This is not a solution to the problem. At least include a hint that examples shown in the README might not work into the auto-generation.
Most helpful comment
This is not a solution to the problem. At least include a hint that examples shown in the README might not work into the auto-generation.