linuxpipansibledebianansible-awx

Ansible-builder - SyntaxError: invalid syntax


I needed to create a custom image for AWX so that I can add external python modules to my ansible playbooks. I installed ansible-builder to do that but I'm getting the following error for any commands I try to run with ansible-builder :

me@ansible:~$ ansible-builder --help
Traceback (most recent call last):
  File "/usr/local/bin/ansible-builder", line 7, in <module>
    from ansible_builder.cli import run
  File "/usr/local/lib/python3.5/dist-packages/ansible_builder/cli.py", line 104
    help=f'The name(s) for the container image being built (default: {constants.default_tag})')
                                                                                             ^
SyntaxError: invalid syntax

I installed it on debian 9 like so :

pip install ansible-builder

I tried to install it with pip and pip3, my user and root but I'm getting the same error everytime.


Solution

  • f-strings only became available in python 3.6 (PEP-498 and you are using python 3.5 (from your traceback: "/usr/local/lib/python3.5/dist-packages/ansible_builder/cli.py"), so you have a version incompatibility.

    You will need to update to a more recent python version. Even the oldest ansible-builder release on Pypi requires Python >=3.6, <4.0