尝试安装kubespray仓库中的requirement.txt,发现有报错:
# cat requirements.txt ansible==2.9.6 jinja2==2.11.1 netaddr==0.7.19 pbr==5.4.4 hvac==0.10.0 jmespath==0.9.5 ruamel.yaml==0.16.10 # pip --no-cache-dir install -i https://pypi.douban.com/simple -r ./requirements.txt Looking in indexes: https://pypi.douban.com/simple Collecting ansible==2.9.6 (from -r ./requirements.txt (line 1)) Downloading https://pypi.doubanio.com/packages/ae/b7/c717363f767f7af33d90af9458d5f1e0960db9c2393a6c221c2ce97ad1aa/ansible-2.9.6.tar.gz (14.2MB) 100% |████████████████████████████████| 14.2MB 47.5MB/s Collecting jinja2==2.11.1 (from -r ./requirements.txt (line 2)) Downloading https://pypi.doubanio.com/packages/27/24/4f35961e5c669e96f6559760042a55b9bcfcdb82b9bdb3c8753dbe042e35/Jinja2-2.11.1-py2.py3-none-any.whl (126kB) 100% |████████████████████████████████| 133kB 71.7MB/s Collecting netaddr==0.7.19 (from -r ./requirements.txt (line 3)) Downloading https://pypi.doubanio.com/packages/ba/97/ce14451a9fd7bdb5a397abf99b24a1a6bb7a1a440b019bebd2e9a0dbec74/netaddr-0.7.19-py2.py3-none-any.whl (1.6MB) 100% |████████████████████████████████| 1.6MB 71.5MB/s Collecting pbr==5.4.4 (from -r ./requirements.txt (line 4)) Downloading https://pypi.doubanio.com/packages/7a/db/a968fd7beb9fe06901c1841cb25c9ccb666ca1b9a19b114d1bbedf1126fc/pbr-5.4.4-py2.py3-none-any.whl (110kB) 100% |████████████████████████████████| 112kB 65.7MB/s Collecting hvac==0.10.0 (from -r ./requirements.txt (line 5)) Downloading https://pypi.doubanio.com/packages/8d/d7/63e63936792a4c85bea3884003b6d502a040242da2d72db01b0ada4bdb28/hvac-0.10.0-py2.py3-none-any.whl (116kB) 100% |████████████████████████████████| 122kB 72.1MB/s Collecting jmespath==0.9.5 (from -r ./requirements.txt (line 6)) Downloading https://pypi.doubanio.com/packages/a3/43/1e939e1fcd87b827fe192d0c9fc25b48c5b3368902bfb913de7754b0dc03/jmespath-0.9.5-py2.py3-none-any.whl Collecting ruamel.yaml==0.16.10 (from -r ./requirements.txt (line 7)) Downloading https://pypi.doubanio.com/packages/a6/92/59af3e38227b9cc14520bf1e59516d99ceca53e3b8448094248171e9432b/ruamel.yaml-0.16.10-py2.py3-none-any.whl (111kB) 100% |████████████████████████████████| 112kB 69.7MB/s Collecting PyYAML (from ansible==2.9.6->-r ./requirements.txt (line 1)) Downloading https://pypi.doubanio.com/packages/ba/d4/3cf562876e0cda0405e65d351b835077ab13990e5b92912ef2bf1a2280e0/PyYAML-5.4.1-cp27-cp27mu-manylinux1_x86_64.whl (574kB) 100% |████████████████████████████████| 583kB 79.0MB/s Collecting cryptography (from ansible==2.9.6->-r ./requirements.txt (line 1)) Downloading https://pypi.doubanio.com/packages/86/41/44173175d378c9e3a73294bb33c73725f7726def5ce267af6bd11b72eb23/cryptography-3.3.2-cp27-cp27mu-manylinux1_x86_64.whl (2.7MB) 100% |████████████████████████████████| 2.7MB 72.8MB/s Collecting MarkupSafe>=0.23 (from jinja2==2.11.1->-r ./requirements.txt (line 2)) Downloading https://pypi.doubanio.com/packages/fb/40/f3adb7cf24a8012813c5edb20329eb22d5d8e2a0ecf73d21d6b85865da11/MarkupSafe-1.1.1-cp27-cp27mu-manylinux1_x86_64.whl Collecting six>=1.5.0 (from hvac==0.10.0->-r ./requirements.txt (line 5)) Downloading https://pypi.doubanio.com/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl Collecting requests>=2.21.0 (from hvac==0.10.0->-r ./requirements.txt (line 5)) Downloading https://pypi.doubanio.com/packages/29/c1/24814557f1d22c56d50280771a17307e6bf87b70727d975fd6b2ce6b014a/requests-2.25.1-py2.py3-none-any.whl (61kB) 100% |████████████████████████████████| 61kB 55.5MB/s Collecting ruamel.ordereddict; platform_python_implementation == "CPython" and python_version <= "2.7" (from ruamel.yaml==0.16.10->-r ./requirements.txt (line 7)) Downloading https://pypi.doubanio.com/packages/36/74/5de3e0c24f0d32522647c8c405556a8a1856ea9679a3ed7aff723cfa4406/ruamel.ordereddict-0.4.15-cp27-cp27mu-manylinux1_x86_64.whl (93kB) 100% |████████████████████████████████| 102kB 60.1MB/s Collecting ruamel.yaml.clib>=0.1.2; platform_python_implementation == "CPython" and python_version < "3.9" (from ruamel.yaml==0.16.10->-r ./requirements.txt (line 7)) Downloading https://pypi.doubanio.com/packages/b7/81/c04fb9be62657d4dce8aa2d99fde258a3af1cd77ec72af525593e9560127/ruamel.yaml.clib-0.2.4.tar.gz (180kB) 100% |████████████████████████████████| 184kB 75.0MB/s Complete output from command python setup.py egg_info: Traceback (most recent call last): File "<string>", line 1, in <module> File "/usr/lib/python2.7/site-packages/setuptools/__init__.py", line 2, in <module> from setuptools.extension import Extension, Library File "/usr/lib/python2.7/site-packages/setuptools/extension.py", line 5, in <module> from setuptools.dist import _get_unpatched File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 7, in <module> from setuptools.command.install import install File "/usr/lib/python2.7/site-packages/setuptools/command/__init__.py", line 8, in <module> from setuptools.command import install_scripts File "/usr/lib/python2.7/site-packages/setuptools/command/install_scripts.py", line 3, in <module> from pkg_resources import Distribution, PathMetadata, ensure_directory File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 3027, in <module> add_activation_listener(lambda dist: dist.activate()) File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 741, in subscribe callback(dist) File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 3027, in <lambda> add_activation_listener(lambda dist: dist.activate()) File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2514, in activate list(map(declare_namespace, self._get_metadata('namespace_packages.txt'))) File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2082, in declare_namespace path = sys.modules[parent].__path__ KeyError: 'ruamel' ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-p_F7GG/ruamel.yaml.clib/ You are using pip version 10.0.0, however version 21.1.3 is available. You should consider upgrading via the 'pip install --upgrade pip' command.
经排查,为ruamel.yaml.clib版本升级导致,故限制版本以解决问题
# pip --no-cache-dir install -i https://pypi.douban.com/simple ruamel.yaml.clib==0.2.2 Looking in indexes: https://pypi.douban.com/simple Collecting ruamel.yaml.clib==0.2.2 Downloading https://pypi.doubanio.com/packages/18/41/ae8b1db1762ef782653b4fe65887cad34fd3ce838ae9099482a5db687b9c/ruamel.yaml.clib-0.2.2-cp27-cp27mu-manylinux1_x86_64.whl (493kB) 100% |████████████████████████████████| 501kB 68.4MB/s Installing collected packages: ruamel.yaml.clib Successfully installed ruamel.yaml.clib-0.2.2 You are using pip version 10.0.0, however version 21.1.3 is available. You should consider upgrading via the 'pip install --upgrade pip' command. # pip --no-cache-dir install -i https://pypi.douban.com/simple ruamel.yaml==0.16.10 Looking in indexes: https://pypi.douban.com/simple Collecting ruamel.yaml==0.16.10 Downloading https://pypi.doubanio.com/packages/a6/92/59af3e38227b9cc14520bf1e59516d99ceca53e3b8448094248171e9432b/ruamel.yaml-0.16.10-py2.py3-none-any.whl (111kB) 100% |████████████████████████████████| 112kB 70.1MB/s Collecting ruamel.ordereddict; platform_python_implementation == "CPython" and python_version <= "2.7" (from ruamel.yaml==0.16.10) Downloading https://pypi.doubanio.com/packages/36/74/5de3e0c24f0d32522647c8c405556a8a1856ea9679a3ed7aff723cfa4406/ruamel.ordereddict-0.4.15-cp27-cp27mu-manylinux1_x86_64.whl (93kB) 100% |████████████████████████████████| 102kB 64.0MB/s Requirement already satisfied: ruamel.yaml.clib>=0.1.2; platform_python_implementation == "CPython" and python_version < "3.9" in /usr/lib64/python2.7/site-packages (from ruamel.yaml==0.16.10) (0.2.2) Installing collected packages: ruamel.ordereddict, ruamel.yaml Successfully installed ruamel.ordereddict-0.4.15 ruamel.yaml-0.16.10 You are using pip version 10.0.0, however version 21.1.3 is available. You should consider upgrading via the 'pip install --upgrade pip' command. # pip --no-cache-dir install -i https://pypi.douban.com/simple -r ./requirements.txt Looking in indexes: https://pypi.douban.com/simple Requirement already satisfied: ansible==2.9.6 in /usr/lib/python2.7/site-packages (from -r ./requirements.txt (line 1)) (2.9.6) Requirement already satisfied: jinja2==2.11.1 in /usr/lib64/python2.7/site-packages (from -r ./requirements.txt (line 2)) (2.11.1) Collecting netaddr==0.7.19 (from -r ./requirements.txt (line 3)) Downloading https://pypi.doubanio.com/packages/ba/97/ce14451a9fd7bdb5a397abf99b24a1a6bb7a1a440b019bebd2e9a0dbec74/netaddr-0.7.19-py2.py3-none-any.whl (1.6MB) 100% |████████████████████████████████| 1.6MB 80.3MB/s Collecting pbr==5.4.4 (from -r ./requirements.txt (line 4)) Downloading https://pypi.doubanio.com/packages/7a/db/a968fd7beb9fe06901c1841cb25c9ccb666ca1b9a19b114d1bbedf1126fc/pbr-5.4.4-py2.py3-none-any.whl (110kB) 100% |████████████████████████████████| 112kB 67.2MB/s Collecting hvac==0.10.0 (from -r ./requirements.txt (line 5)) Downloading https://pypi.doubanio.com/packages/8d/d7/63e63936792a4c85bea3884003b6d502a040242da2d72db01b0ada4bdb28/hvac-0.10.0-py2.py3-none-any.whl (116kB) 100% |████████████████████████████████| 122kB 76.4MB/s Collecting jmespath==0.9.5 (from -r ./requirements.txt (line 6)) Downloading https://pypi.doubanio.com/packages/a3/43/1e939e1fcd87b827fe192d0c9fc25b48c5b3368902bfb913de7754b0dc03/jmespath-0.9.5-py2.py3-none-any.whl Requirement already satisfied: ruamel.yaml==0.16.10 in /usr/lib/python2.7/site-packages (from -r ./requirements.txt (line 7)) (0.16.10) Requirement already satisfied: PyYAML in /usr/lib64/python2.7/site-packages (from ansible==2.9.6->-r ./requirements.txt (line 1)) (5.4.1) Requirement already satisfied: cryptography in /usr/lib64/python2.7/site-packages (from ansible==2.9.6->-r ./requirements.txt (line 1)) (3.3.2) Requirement already satisfied: MarkupSafe>=0.23 in /usr/lib64/python2.7/site-packages (from jinja2==2.11.1->-r ./requirements.txt (line 2)) (1.1.1) Requirement already satisfied: six>=1.5.0 in /usr/lib/python2.7/site-packages (from hvac==0.10.0->-r ./requirements.txt (line 5)) (1.16.0) Collecting requests>=2.21.0 (from hvac==0.10.0->-r ./requirements.txt (line 5)) Downloading https://pypi.doubanio.com/packages/29/c1/24814557f1d22c56d50280771a17307e6bf87b70727d975fd6b2ce6b014a/requests-2.25.1-py2.py3-none-any.whl (61kB) 100% |████████████████████████████████| 61kB 61.2MB/s Requirement already satisfied: ruamel.ordereddict; platform_python_implementation == "CPython" and python_version <= "2.7" in /usr/lib64/python2.7/site-packages (from ruamel.yaml==0.16.10->-r ./requirements.txt (line 7)) (0.4.15) Requirement already satisfied: ruamel.yaml.clib>=0.1.2; platform_python_implementation == "CPython" and python_version < "3.9" in /usr/lib64/python2.7/site-packages (from ruamel.yaml==0.16.10->-r ./requirements.txt (line 7)) (0.2.2) Requirement already satisfied: enum34; python_version < "3" in /usr/lib/python2.7/site-packages (from cryptography->ansible==2.9.6->-r ./requirements.txt (line 1)) (1.1.10) Requirement already satisfied: cffi>=1.12 in /usr/lib64/python2.7/site-packages (from cryptography->ansible==2.9.6->-r ./requirements.txt (line 1)) (1.14.5) Requirement already satisfied: ipaddress; python_version < "3" in /usr/lib/python2.7/site-packages (from cryptography->ansible==2.9.6->-r ./requirements.txt (line 1)) (1.0.16) Collecting chardet<5,>=3.0.2 (from requests>=2.21.0->hvac==0.10.0->-r ./requirements.txt (line 5)) Downloading https://pypi.doubanio.com/packages/19/c7/fa589626997dd07bd87d9269342ccb74b1720384a4d739a1872bd84fbe68/chardet-4.0.0-py2.py3-none-any.whl (178kB) 100% |████████████████████████████████| 184kB 80.8MB/s Collecting urllib3<1.27,>=1.21.1 (from requests>=2.21.0->hvac==0.10.0->-r ./requirements.txt (line 5)) Downloading https://pypi.doubanio.com/packages/5f/64/43575537846896abac0b15c3e5ac678d787a4021e906703f1766bfb8ea11/urllib3-1.26.6-py2.py3-none-any.whl (138kB) 100% |████████████████████████████████| 143kB 61.0MB/s Collecting idna<3,>=2.5 (from requests>=2.21.0->hvac==0.10.0->-r ./requirements.txt (line 5)) Downloading https://pypi.doubanio.com/packages/a2/38/928ddce2273eaa564f6f50de919327bf3a00f091b5baba8dfa9460f3a8a8/idna-2.10-py2.py3-none-any.whl (58kB) 100% |████████████████████████████████| 61kB 59.3MB/s Collecting certifi>=2017.4.17 (from requests>=2.21.0->hvac==0.10.0->-r ./requirements.txt (line 5)) Downloading https://pypi.doubanio.com/packages/05/1b/0a0dece0e8aa492a6ec9e4ad2fe366b511558cdc73fd3abc82ba7348e875/certifi-2021.5.30-py2.py3-none-any.whl (145kB) 100% |████████████████████████████████| 153kB 81.9MB/s Requirement already satisfied: pycparser in /usr/lib/python2.7/site-packages (from cffi>=1.12->cryptography->ansible==2.9.6->-r ./requirements.txt (line 1)) (2.20) Installing collected packages: netaddr, pbr, chardet, urllib3, idna, certifi, requests, hvac, jmespath Successfully installed certifi-2021.5.30 chardet-4.0.0 hvac-0.10.0 idna-2.10 jmespath-0.9.5 netaddr-0.7.19 pbr-5.4.4 requests-2.25.1 urllib3-1.26.6 You are using pip version 10.0.0, however version 21.1.3 is available. You should consider upgrading via the 'pip install --upgrade pip' command.
Done
kubespray v2.16.0 requirement.txt 修改如下图即可