azavea / pfb-network-connectivity

PFB Bicycle Network Connectivity
Other
40 stars 10 forks source link

Local analysis setup error after pip update #827

Closed beckymasond closed 3 years ago

beckymasond commented 3 years ago

When running ./scripts/setup to run the BNA locally, the setup process fails with the error:

==> default: Running provisioner: ansible_local...
    default: Installing Ansible...
    default: Installing pip... (for Ansible installation)
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

curl https://bootstrap.pypa.io/get-pip.py | sudo python

Stdout from the command:

Stderr from the command:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1883k  100 1883k    0     0  2685k      0 --:--:-- --:--:-- --:--:-- 2686k
Traceback (most recent call last):
  File "<stdin>", line 24226, in <module>
  File "<stdin>", line 199, in main
  File "<stdin>", line 82, in bootstrap
  File "/tmp/tmpHpQ6OO/pip.zip/pip/_internal/cli/main.py", line 60
    sys.stderr.write(f"ERROR: {exc}")
                                   ^
SyntaxError: invalid syntax

The problem started Saturday after a new version of pip was released. I tried troubleshooting as advised in https://github.com/pypa/get-pip/issues/83 by adding

ansible.pip_install_cmd = "curl https://bootstrap.pypa.io/3.5/get-pip.py | sudo python"

to the Vagrantfile. This resolved the first failure but led to a second failure with the same error output:

- azavea.terraform (0.3.1) was installed successfully
- dependency azavea.unzip is already installed, skipping.
    default: Running ansible-playbook...
cd /vagrant && PYTHONUNBUFFERED=1 ANSIBLE_NOCOLOR=true ansible-playbook --limit="default" --inventory-file=/tmp/vagrant-ansible/inventory -v --timeout=60 --extra-vars dev_user=rebec deployment/ansible/pfb.yml
/usr/local/lib/python2.7/dist-packages/ansible/parsing/vault/__init__.py:41: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
  from cryptography.exceptions import InvalidSignature
No config file found; using defaults

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

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

TASK [Update APT cache] ********************************************************
[WARNING]: Updating cache and auto-installing missing dependency: python-apt
ok: [default] => {"cache_update_time": 1611620925, "cache_updated": false, "changed": false}

TASK [azavea.pip : Get installed pip version] **********************************
ok: [default] => {"changed": false, "cmd": ["pip", "--version"], "delta": "0:00:00.102835", "end": "2021-01-26 00:28:50.989099", "rc": 0, "start": "2021-01-26 00:28:50.886264", "stderr": "", "stderr_lines": [], "stdout": "pip 20.3.4 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)", "stdout_lines": ["pip 20.3.4 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)"]}

TASK [azavea.pip : Download get-pip.py] ****************************************
changed: [default] => {"changed": true, "checksum_dest": null, "checksum_src": "209ddf0bb8d1cf06a1f17dd9f21970c76b3d2be2", "dest": "/tmp/get-pip.py", "elapsed": 0, "gid": 0, "group": "root", "md5sum": "b1e76b6f0733281080a19e1deb706bbf", "mode": "0644", "msg": "OK (1928477 bytes)", "owner": "root", "size": 1928477, "src": "/home/vagrant/.ansible/tmp/ansible-tmp-1611620931.05-177570435981006/tmp_7afC1", "state": "file", "status_code": 200, "uid": 0, "url": "https://bootstrap.pypa.io//get-pip.py"}

TASK [azavea.pip : Install pip] ************************************************
fatal: [default]: FAILED! => {"changed": true, "cmd": ["python", "get-pip.py", "pip==9.0.*"], "delta": "0:00:00.490821", "end": "2021-01-26 00:28:52.589065", "msg": "non-zero return code", "rc": 1, "start": "2021-01-26 00:28:52.098244", "stderr": "Traceback (most recent call last):\n  File \"get-pip.py\", line 24226, in <module>\n    main()\n  File \"get-pip.py\", line 199, in main\n    bootstrap(tmpdir=tmpdir)\n  File \"get-pip.py\", line 82, in bootstrap\n    from pip._internal.cli.main import main as pip_entry_point\n  File \"/tmp/tmpgb7hzr/pip.zip/pip/_internal/cli/main.py\", line 60\n    sys.stderr.write(f\"ERROR: {exc}\")\n                                   ^\nSyntaxError: invalid syntax", "stderr_lines": ["Traceback (most recent call last):", "  File \"get-pip.py\", line 24226, in <module>", "    main()", "  File \"get-pip.py\", line 199, in main", "    bootstrap(tmpdir=tmpdir)", "  File \"get-pip.py\", line 82, in bootstrap", "    from pip._internal.cli.main import main as pip_entry_point", "  File \"/tmp/tmpgb7hzr/pip.zip/pip/_internal/cli/main.py\", line 60", "    sys.stderr.write(f\"ERROR: {exc}\")", "                                   ^", "SyntaxError: invalid syntax"], "stdout": "", "stdout_lines": []}

PLAY RECAP *********************************************************************
default                    : ok=4    changed=1    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.
KlaasH commented 3 years ago

As noted on PR #828, there's a new line in deployment/ansible/group_vars/all.example that needs to be copied over to deployment/ansible/group_vars/all to make the fix work (see diff).