Open bleckmeister opened 2 years ago
Check Python Version Compatibility. Ensure that Ansible and its dependencies are running in a Python 3 environment. Ansible 2.8 and later versions require Python 3.5+ for most functionalities, although some backward compatibility with Python 2.7 exists. However, the packaging module likely expects Python 3.
You can check the Python version being used by Ansible by running:
python --version
ansible --version
If shows Python 2.7, you'll need to install Python 3.
sudo apt-get update
sudo apt-get install python3
Assuming that you are running Debian/Ubuntu
ERROR! Unexpected Exception, this is probably a bug: invalid syntax (specifiers.py, line 39) the full traceback was:
Traceback (most recent call last): File "/usr/bin/ansible-playbook", line 104, in
mycli = getattr(import("ansible.cli.%s" % sub, fromlist=[myclass]), myclass)
File "/usr/lib/python2.7/site-packages/ansible/cli/init.py", line 21, in
from ansible.inventory.manager import InventoryManager
File "/usr/lib/python2.7/site-packages/ansible/inventory/manager.py", line 38, in
from ansible.plugins.loader import inventory_loader
File "/usr/lib/python2.7/site-packages/ansible/plugins/loader.py", line 35, in
from packaging.specifiers import SpecifierSet
File "/usr/lib/python2.7/site-packages/packaging/specifiers.py", line 39
class BaseSpecifier(metaclass=abc.ABCMeta):
^
SyntaxError: invalid syntax