Python: Unable to install the python client

Created on 3 Jul 2020  路  5Comments  路  Source: kubernetes-client/python

What happened (please include outputs or screenshots):
Tried to install the python client:
Error 1: When trying to install through - python setup.py install

Switched to a new branch 'release-11.0'
M       kubernetes/base
Branch 'release-11.0' set up to track remote branch 'release-11.0' from 'origin'.
PS D:\python> python setup.py install
running install
running bdist_egg
running egg_info
writing kubernetes.egg-info\PKG-INFO
writing dependency_links to kubernetes.egg-info\dependency_links.txt
writing requirements to kubernetes.egg-info\requires.txt
writing top-level names to kubernetes.egg-info\top_level.txt
error: supposed package directory 'kubernetes\config' exists, but is not a directory

Error 2: While installing from pip

PS D:\python> python -m examples.api_discovery.py
Traceback (most recent call last):
  File "D:\Softwares\Anaconda3\lib\runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "D:\Softwares\Anaconda3\lib\runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "D:\Kubernetes open source - Python client\Python\python\examples\api_discovery.py", line 20, in <module>
    from kubernetes import client, config
  File "D:\Kubernetes open source - Python client\Python\python\kubernetes\__init__.py", line 20, in <module>
    import kubernetes.config
ModuleNotFoundError: No module named 'kubernetes.config'

What you expected to happen:
Run the examples given for the python client

How to reproduce it (as minimally and precisely as possible):
1) For error 1:
git clone --recursive https://github.com/kubernetes-client/python.git
cd python
python setup.py install

2) For error 2:
pip install kubernetes
python -m examples.api_discovery

Anything else we need to know?:
The path : python/kubernetes/config is a file instead of a directory as the Error 1 snippet suggests
https://github.com/kubernetes-client/python/blob/master/kubernetes/config

Environment:

  • Kubernetes version (kubectl version):
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.0", GitCommit:"9e991415386e4cf155a24b1da15becaa390438d8", GitTreeState:"clean", BuildDate:"2020-03-25T14:58:59Z", GoVersion:"go1.13.8", Compiler:"gc", Platform:"windows/amd64"}
Server Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.3", GitCommit:"2e7996e3e2712684bc73f0dec0200d64eec7fe40", GitTreeState:"clean", BuildDate:"2020-05-20T12:43:34Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}
  • OS (e.g., MacOS 10.13.6): Windows 10
  • Python version (python --version): Python 3.7.3
  • Python client version (pip list | grep kubernetes): 11.0.0b2
kinbug

All 5 comments

/assign

Hi, please check this document for additional installation instructions if you're installing from the source on Windows.

Since you might have had an incomplete installation of the Python client, I'd suggest trying to use pip to remove it first, clean out the corresponding folder in the Python library, and perform an reinstall.

/assign

Hi, please check this document for additional installation instructions if you're installing from the source on Windows.

Since you might have had an incomplete installation of the Python client, I'd suggest trying to use pip to remove it first, clean out the corresponding folder in the Python library, and perform an reinstall.

Thanks @micw523 before doing that I just removed the library using pip and then did pip install Kubernetes. This time it worked and I was able to install the python client successfully. Closing this issue.

What happened (please include outputs or screenshots):
Tried to install the python client:
Error 1: When trying to install through - python setup.py install

Switched to a new branch 'release-11.0'
M       kubernetes/base
Branch 'release-11.0' set up to track remote branch 'release-11.0' from 'origin'.
PS D:\python> python setup.py install
running install
running bdist_egg
running egg_info
writing kubernetes.egg-info\PKG-INFO
writing dependency_links to kubernetes.egg-info\dependency_links.txt
writing requirements to kubernetes.egg-info\requires.txt
writing top-level names to kubernetes.egg-info\top_level.txt
error: supposed package directory 'kubernetes\config' exists, but is not a directory

Error 2: While installing from pip

PS D:\python> python -m examples.api_discovery.py
Traceback (most recent call last):
  File "D:\Softwares\Anaconda3\lib\runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "D:\Softwares\Anaconda3\lib\runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "D:\Kubernetes open source - Python client\Python\python\examples\api_discovery.py", line 20, in <module>
    from kubernetes import client, config
  File "D:\Kubernetes open source - Python client\Python\python\kubernetes\__init__.py", line 20, in <module>
    import kubernetes.config
ModuleNotFoundError: No module named 'kubernetes.config'

What you expected to happen:
Run the examples given for the python client

How to reproduce it (as minimally and precisely as possible):

  1. For error 1:
    git clone --recursive https://github.com/kubernetes-client/python.git
    cd python
    python setup.py install
  2. For error 2:
    pip install kubernetes
    python -m examples.api_discovery

Anything else we need to know?:
The path : python/kubernetes/config is a file instead of a directory as the Error 1 snippet suggests
https://github.com/kubernetes-client/python/blob/master/kubernetes/config

Environment:

  • Kubernetes version (kubectl version):
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.0", GitCommit:"9e991415386e4cf155a24b1da15becaa390438d8", GitTreeState:"clean", BuildDate:"2020-03-25T14:58:59Z", GoVersion:"go1.13.8", Compiler:"gc", Platform:"windows/amd64"}
Server Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.3", GitCommit:"2e7996e3e2712684bc73f0dec0200d64eec7fe40", GitTreeState:"clean", BuildDate:"2020-05-20T12:43:34Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}
  • OS (e.g., MacOS 10.13.6): Windows 10
  • Python version (python --version): Python 3.7.3
  • Python client version (pip list | grep kubernetes): 11.0.0b2

client Kubernetes-11.0.0 support version.Info{Major:"1", Minor:"18"} 锛燂紵锛燂紵锛燂紵

Was this page helpful?
0 / 5 - 0 ratings