mnubo / kubernetes-py

A python module for Kubernetes.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Module Does Not Load

john-eckhardt-netapp opened this issue · comments


john@farcry:~$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.2 LTS"

john@farcry:~$ sudo pip install --upgrade kubernetes-py
   ...
john@farcry:~$ sudo pip3 install --upgrade kubernetes-py
   ...

john@farcry:~$ python3 --version
Python 3.5.2
john@farcry:~$ python3 -c 'import kubernetes'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.5/dist-packages/kubernetes/__init__.py", line 9, in <module>
    from K8sComponentStatus import K8sComponentStatus
ImportError: No module named 'K8sComponentStatus'

john@farcry:~$ python --version
Python 2.7.12
john@farcry:~$ python -c 'import kubernetes'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named kubernetes

Hi,

Can you confirm the module version it pulled?

pip freeze | grep kubernetes-py

Thanks,

Sebastien

john@farcry:~$ sudo -H pip freeze | grep kubernetes-py
kubernetes-py==1.4.7.13

john@farcry:~$ sudo -H pip3 freeze | grep kubernetes-py
kubernetes-py==1.4.7.13

Can you try version 1.4.7.11 and let me know if you have the same issue? On my end it seems to work but I've found some components give errors (Components, Nodes, Deployments).

Here's what I've got with 1.4.7.13:

(.venv)[sebastienc@ned]$ python -c 'import kubernetes'
(.venv)[sebastienc@ned]$ echo $?
0
(.venv)[sebastienc@ned]$ python --version
Python 2.7.10
root@farcry:/home/john# pip install kubernetes-py==1.4.7.11
   ...

root@farcry:/home/john# pip freeze | grep kube
kubernetes-py==1.4.7.11

root@farcry:/home/john# python -c 'import kubernetes'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named kubernetes

root@farcry:/home/john# python --version
Python 2.7.12

root@farcry:/home/john# pip3 install kubernetes-py==1.4.7.11
   ...

root@farcry:/home/john# pip3 freeze | grep kube
kubernetes-py==1.4.7.11

root@farcry:/home/john# python3 -c 'import kubernetes'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.5/dist-packages/kubernetes/__init__.py", line 9, in <module>
    from K8sComponentStatus import K8sComponentStatus
ImportError: No module named 'K8sComponentStatus'

root@farcry:/home/john# python3 --version
Python 3.5.2

Also tried to install your module with a completely clean docker container.

Which resulted in this (maybe it's a clue for you) ...

root@75a0c30a1ebf:/# pip3 install --upgrade kubernetes-py
Collecting kubernetes-py
  Using cached kubernetes-py-1.4.7.13.tar.gz
Collecting importlib>=1.0.3 (from kubernetes-py)
  Using cached importlib-1.0.4.zip
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 5, in <module>
        import distutils.core
      File "/usr/lib/python3.5/distutils/core.py", line 16, in <module>
        from distutils.dist import Distribution
      File "/usr/lib/python3.5/distutils/dist.py", line 19, in <module>
        from distutils.util import check_environ, strtobool, rfc822_escape
      File "/usr/lib/python3.5/distutils/util.py", line 9, in <module>
        import importlib.util
    ImportError: No module named 'importlib.util'
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-kavgrgdv/importlib/

Commands in the console to get to that point ...


john@farcry:~$ docker run -i -t ubuntu:xenial

root@75a0c30a1ebf:/# history 
    1  apt update
    2  apt upgrade
    3  apt install python3 python3-pip
    4  python3 --version
    5  pip3 install --upgrade pip
    6  pip3 install kubernetes-py

Yeah I think I've found it. Seems specific to python 3.5+. I'm also removing the dependency on importlib since it breaks with python 3.5+. I'm running tests on a new version.

That's fantastic!

Thanks for being so active on the project, it makes me feel great about committing to the module for our purposes.

Let me know if you'd like a hand testing.

Alright. No problem!

Hi John,

I've committed some changes and built version 1.4.7.14. I've run our tests on it and it seems to work fine. Could you test it on your end too?

Thanks,

Sebastien

Looks great! :)

Thanks so much, in generally, but especially for the snappy turn-around ... so helpful. Appreciated.

This issue is resolved.