Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when i tried to run ansible-playbook i got this. Any idea? #3

Open
bleckmeister opened this issue Oct 15, 2021 · 1 comment
Open

when i tried to run ansible-playbook i got this. Any idea? #3

bleckmeister opened this issue Oct 15, 2021 · 1 comment

Comments

@bleckmeister
Copy link

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

@SpadaSchiavonesca
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants