Ansible无法完成,因为安装了Python 3,但已弃用Python

问题描述 投票:0回答:1

我正在尝试从Google运行LaunchKit以获得一些应用程序屏幕截图。我已经完成了GitHub页面(https://github.com/LaunchKit/LaunchKit)上所有涉及开放源代码的步骤。在完成所有步骤并运行$ vagrant up --provision之后,我得到以下信息:

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/trusty64' version '20190514.0.0' is up to date...
==> default: Running provisioner: ansible...
Vagrant has automatically selected the compatibility mode '2.0'
according to the Ansible version installed (2.9.2).

Alternatively, the compatibility mode can be specified in your Vagrantfile:
https://www.vagrantup.com/docs/provisioning/ansible_common.html#compatibility_mode

    default: Running ansible-playbook...

PLAY [all] *********************************************************************

TASK [Gathering Facts] *********************************************************
ok: [default]

TASK [update apt cache] ********************************************************
ok: [default]

TASK [common : install the unzip tool] *****************************************
ok: [default]

TASK [common : install launchkit dummy service] ********************************
ok: [default]

TASK [common : install vagrant start bug workaround] ***************************
ok: [default]

TASK [common-python : install python dev library] ******************************
ok: [default]

TASK [common-python : install packages for pip crypto] *************************
ok: [default]

TASK [common-python : install packages for ssl] ********************************
ok: [default]

TASK [common-python : install pip] *********************************************
ok: [default]

TASK [common-python : install python virtualenv] *******************************
ok: [default]

TASK [redis : install redis] ***************************************************
ok: [default]

TASK [redis : install redis config] ********************************************
ok: [default]

TASK [postgres : install postgres] *********************************************
ok: [default]

TASK [postgres : install postgres contrib] *************************************
ok: [default]

TASK [postgres : install postgres dev libraries] *******************************
ok: [default]

TASK [postgres : install postgres python library for further ansible configuration] ***
ok: [default]

TASK [postgres : install postgres config] **************************************
ok: [default]

TASK [postgres : install postgres security config] *****************************
ok: [default]

TASK [postgres : install postgres upstart service translation] *****************
ok: [default]

TASK [postgres : add local user as postgres superuser] *************************
ok: [default]

TASK [lk-django : install python lxml library] *********************************
ok: [default]

TASK [lk-django : install jpeg library for pillow] *****************************
ok: [default]

TASK [lk-django : install jpeg-dev library for pillow] *************************
ok: [default]

TASK [lk-django : install db adapter] ******************************************
ok: [default]

TASK [lk-django : upgrade pip] *************************************************
ok: [default]

TASK [lk-django : install python requirements] *********************************
fatal: [default]: FAILED! => {"changed": false, "cmd": ["/usr/local/bin/pip2", "install", "-r", "/vagrant/requirements.txt"], 
"msg": "stdout: Requirement already satisfied: boto==2.38.0 in /usr/local/lib/python2.7/dist-packages (from -r /vagrant/requirements.txt (line 1)) (2.38.0)\nRequirement already satisfied:
 celery[redis]==3.1.17 in /usr/local/lib/python2.7/dist-packages (from -r /vagrant/requirements.txt (line 2)) (3.1.17)\nRequirement already satisfied: cssutils==1.0.1
 in /usr/local/lib/python2.7/dist-packages (from -r /vagrant/requirements.txt (line 3)) (1.0.1)\nRequirement already satisfied: django-bitfield==1.7.1 in /usr/local/lib/python2.7/dist-packages (from -r /vagrant/requirements.txt (line 4)) (1.7.1)\nRequirement already satisfied:
 Django==1.7.3 in /usr/local/lib/python2.7/dist-packages (from -r /vagrant/requirements.txt (line 5)) (1.7.3)\nRequirement already satisfied: djorm-pgarray==1.2.0 in 
/usr/local/lib/python2.7/dist-packages (from -r /vagrant/requirements.txt (line 6)) (1.2)\nRequirement already satisfied: dnspython==1.12.0 in /usr/local/lib/python2.7/dist-packages (from -r /vagrant/requirements.txt (line 7)) (1.12.0)\nRequirement already satisfied:
 fabric==1.10.1 in /usr/local/lib/python2.7/dist-packages (from -r /vagrant/requirements.txt (line 8)) (1.10.1)\nRequirement already satisfied: hiredis==0.1.5 in /usr/local/lib/python2.7/dist-packages (from -r /vagrant/requirements.txt (line 9)) (0.1.5)\nRequirement already satisfied: Pillow==3.0.0 in /usr/local/lib/python2.7/dist-packages (from -r /vagrant/requirements.txt (line 10)) (3.0.0)\nRequirement already satisfied: premailer==1.3.0 in /usr/local/lib/python2.7/dist-packages (from -r /vagrant/requirements.txt (line 11)) (1.3.0)\nRequirement already satisfied: psycopg2==2.5.4 in 
/usr/local/lib/python2.7/dist-packages (from -r /vagrant/requirements.txt (line 12)) (2.5.4)\nRequirement already satisfied: pycrypto==2.6.1 in /usr/lib/python2.7/dist-packages 
(from -r /vagrant/requirements.txt (line 13)) (2.6.1)\nRequirement already satisfied: pylint==0.28.0 in /usr/local/lib/python2.7/dist-packages (from -r /vagrant/requirements.txt (line 14)) (0.28.0)\nRequirement already satisfied: python-memcached==1.53 in 
/usr/local/lib/python2.7/dist-packages (from -r /vagrant/requirements.txt (line 15)) (1.53)\nRequirement already satisfied: redis==2.10.3 in /usr/local/lib/python2.7/dist-packages (from -r /vagrant/requirements.txt (line 16)) (2.10.3)\nCollecting requests==2.5.3\n  Using cached https://files.pythonhosted.org/packages/95/54/44dc83b5f11c6da06bf9abd18c8a0905e0e297e0a9c3bfbc0c6ee4bdd33d/requests-2.5.3-py2.py3-none-any.whl\nProcessing 
/root/.cache/pip/wheels/59/10/55/80c2bd162c923de93fbec8237cdceeb795507da2748926850e/SQLAlchemy-0.9.8-cp27-none-linux_x86_64.whl\nCollecting tweepy==3.3.0\n  Using cached https://files.pythonhosted.org/packages/cd/8b/dfeeb1057d37af810161f8206aa5a6e6e9351dd87ea6f84e4f87d7e3c8a3/tweepy-3.3.0-py2.py3-none-any.whl\nProcessing 
/root/.cache/pip/wheels/1f/ea/0a/599a5398012b4e42f32cdfa9101fe35697d3df97282e1da5f3/ua_parser-0.3.6-cp27-none-any.whl\nRequirement already satisfied: billiard<3.4,>=3.3.0.19 in /usr/local/lib/python2.7/dist-packages (from celery[redis]==3.1.17->-r /vagrant/requirements.txt
 (line 2)) (3.3.0.23)\nRequirement already satisfied: pytz>dev in /usr/local/lib/python2.7/dist-packages (from celery[redis]==3.1.17->-r /vagrant/requirements.txt (line 2)) (2019.3)\nRequirement already satisfied: kombu<3.1,>=3.0.24 in /usr/local/lib/python2.7/dist-packages (from celery[redis]==3.1.17->-r /vagrant/requirements.txt (line 2)) 
(3.0.37)\nRequirement already satisfied: six in /usr/lib/python2.7/dist-packages (from django-bitfield==1.7.1->-r /vagrant/requirements.txt (line 4)) (1.5.2)\nRequirement already satisfied: paramiko>=1.10 in /usr/local/lib/python2.7/dist-packages (from fabric==1.10.1->-r 
/vagrant/requirements.txt (line 8)) (2.7.1)\nRequirement already satisfied: cssselect in /usr/local/lib/python2.7/dist-packages (from premailer==1.3.0->-r /vagrant/requirements.txt (line 11)) (1.1.0)\nRequirement already satisfied: lxml in /usr/lib/python2.7/dist-packages (from premailer==1.3.0->-r /vagrant/requirements.txt (line 11)) (3.3.3)\nRequirement already satisfied
: logilab-common>=0.53.0 in /usr/local/lib/python2.7/dist-packages (from pylint==0.28.0->-r /vagrant/requirements.txt (line 14)) (1.4.4)\nRequirement already satisfied: logilab-astng>=0.24.3 in /usr/local/lib/python2.7/dist-packages (from pylint==0.28.0->-r 
/vagrant/requirements.txt (line 14)) (0.24.3)\nCollecting requests-oauthlib>=0.4.1\n  Using cached 
https://files.pythonhosted.org/packages/a3/12/b92740d845ab62ea4edf04d2f4164d82532b5a0b03836d4d4e71c6f3d379/requests_oauthlib-1.3.0-py2.py3-none-any.whl\nRequirement already satisfied: anyjson>=0.3.3 in /usr/local/lib/python2.7/dist-packages (from kombu<3.1,>=3.0.24->celery[redis]==3.1.17->-r /vagrant/requirements.txt (line 2)) (0.3.3)\nRequirement already satisfied: amqp<2.0,>=1.4.9 in /usr/local/lib/python2.7/dist-packages (from kombu<3.1,>=3.0.24->celery[redis]==3.1.17->-r /vagrant/requirements.txt (line 2)) (1.4.9)\nRequirement already satisfied: bcrypt>=3.1.3 in /usr/local/lib/python2.7/dist-packages (from paramiko>=1.10->fabric==1.10.1->-r /vagrant/requirements.txt (line 8)) (3.1.7)\nRequirement already satisfied: cryptography>=2.5 in /usr/local/lib/python2.7/dist-packages (from paramiko>=1.10->fabric==1.10.1->-r /vagrant/requirements.txt (line 8)) (2.8)\nRequirement already satisfied: pynacl>=1.0.1 in /usr/local/lib/python2.7/dist-packages (from paramiko>=1.10->fabric==1.10.1->-r /vagrant/requirements.txt (line 8)) (1.3.0)\nRequirement already satisfied: setuptools in /usr/lib/python2.7/dist-packages (from logilab-common>=0.53.0->pylint==0.28.0->-r /vagrant/requirements.txt (line 14)) (3.3)\nCollecting oauthlib>=3.0.0\n  Using cached https://files.pythonhosted.org/packages/05/57/ce2e7a8fa7c0afb54a0581b14a65b56e62b5759dbc98e80627142b8a3704/oauthlib-3.1.0-py2.py3-none-any.whl\nRequirement already satisfied: cffi>=1.1 in /usr/local/lib/python2.7/dist-packages (from bcrypt>=3.1.3->paramiko>=1.10->fabric==1.10.1->-r /vagrant/requirements.txt (line 8)) (1.13.2)\nRequirement already satisfied: enum34; python_version < \"3\" in /usr/local/lib/python2.7/dist-packages (from cryptography>=2.5->paramiko>=1.10->fabric==1.10.1->-r /vagrant/requirements.txt (line 8)) (1.1.6)\nRequirement already satisfied: ipaddress; python_version < \"3\" in /usr/local/lib/python2.7/dist-packages (from cryptography>=2.5->paramiko>=1.10->fabric==1.10.1->-r /vagrant/requirements.txt (line 8)) (1.0.23)\nRequirement already satisfied: pycparser in /usr/local/lib/python2.7/dist-packages (from cffi>=1.1->bcrypt>=3.1.3->paramiko>=1.10->fabric==1.10.1->-r /vagrant/requirements.txt (line 8)) (2.19)\nInstalling collected packages: requests, sqlalchemy, oauthlib, requests-oauthlib, tweepy, ua-parser\n  
Found existing installation: requests 2.2.1\n\n:stderr: /usr/local/lib/python2.7/dist-packages/cryptography/hazmat/primitives/constant_time.py:26: CryptographyDeprecationWarning:
 Support for your Python version is deprecated. The next version of cryptography will remove support. Please upgrade to a release (2.7.7+) that supports hmac.compare_digest as soon as possible.\n  utils.PersistentlyDeprecated2018,\nDEPRECATION: 
Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for
 Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support\n/usr/local/lib/python2.7/dist-packages/pip/_vendor/urllib3/util/ssl_.py:380: 
SNIMissingWarning: An HTTPS request has been made, but the SNI (Server Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS
 certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-
usage.html#ssl-warnings\n  SNIMissingWarning,\n/usr/local/lib/python2.7/dist-packages/pip/_vendor/urllib3/util/ssl_.py:139: InsecurePlatformWarning: A true SSLContext object
 is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more
 information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n  InsecurePlatformWarning,\nERROR: tweepy 3.3.0 has requirement six>=1.7.3, but you'll have six
 1.5.2 which is incompatible.\nERROR: Cannot uninstall 'requests'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only
 a partial uninstall.\n"}

PLAY RECAP *********************************************************************
default                    : ok=25   changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.

[Python2的当前版本是2.7.10(高于它要求的2.7.7+),并且我还安装了python 3(3.7.6)。

这是我第一次在Terminal中进行深入研究。

[我也尝试过为python = python3创建别名,但是当调用--provision时,它似乎仍在运行Python2。

关于如何解决此问题的任何想法?

python-2.7 ansible open-source launch
1个回答
0
投票

任务[lk-django:安装python要求] **********************************致命:[默认]:失败! => {“已更改”:false,“ cmd”:[“ / usr / local / bin / pip2”,“安装”,“-r”,“ / vagrant / requirements.txt”],...错误:tweepy 3.3.0的要求为六个> = 1.7.3,但您将有六个1.5.2不兼容。错误:无法卸载“请求”。这是一个distutils安装的项目,因此我们无法准确确定属于该文件的文件,这只会导致部分卸载。\ n“}

手动卸载有冲突的程序包six 1.5.2


可以Use Python 3 on the managed machines with commands and playbooks。如果您认为这可以解决冲突,请在例如清单中设置变量ansible_python_interpreter

ansible_python_interpreter=/usr/bin/python3

pip版本应自动选择。 pip报告了该问题。参见source code

- name: install python requirements
  pip: requirements=/vagrant/requirements.txt

点子说:

默认情况下,它为Ansible Python解释器使用pip版本。例如,在python 3上为pip3,在python 2上为pip2或pip。

© www.soinside.com 2019 - 2024. All rights reserved.