Fixing Failed to import the required Python library (setuptools) in Ansible run

ansible Jun 16, 2020

I was getting a "Failed to import the required Python library (setuptools) on [machine name]'s Python /usr/bin/python." Part of the issue is that I have Python 2 and Python 3 running on my Raspberry Pi.  After digging through the web, I found this article on Stack Overflow that fixed the issue for me.

The gist of it was to run this command:

update-alternatives --install /usr/bin/python python /usr/bin/python3 10

This is a cleaner way than to do an alias as this allows the user to still run a sudo command on python


Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.