Python 3.8 packages

I have an issue with ansible and azure_cli that may be related to the move to python 3.8

I have installed both ansible and azure_cli. However, contrary to my expectations I could not use the azure_rm inventory plugin. It basically failed on missing modules.

Investigating further I noticed that both ansible and azure_cli (and awscli as well) now use python 3.8, and apparently each have their own copy of it, with its own library.

So ansible looks for python modules in /usr/local/Cellar/ansible/2.9.6_1/libexec/lib/python3.8/site-packages/, and azure_cli looks in /usr/local/Cellar/azure-cli/2.5.1/libexec/lib/python3.8/site-packages

So installing azure_cli does not as expected make the necessary azure modules available for ansible.

Why do these packages not use the shared python3.8, and install their python modules in a shared location?

Or have I overlooked something obvious?

Why do these packages not use the shared python3.8, and install their python modules in a shared location?

They do use a shared python install but all homebrew packages are kept strictly seperate in terms of install. This means in your case that the two aren’t meant to be able to see each others packages.

The script in /usr/local/bin that starts ansible has this at the head:


So ansible is installed with its own copy of Python.
The same happens with awscli and azure-cli (and many others I have installed…)

This has a few consequences…

  • I have by now 12 copies of python3.8 on my machine…
  • The ansible - aws - azure integrations are no longer working as expected.

A major use case for installing awscli and azure-cli is to be able to use AWS and Azure Dynamic Inventory in Ansible. By keeping them completely separate this integration is now broken.

Which means that I now need to do what I was hoping to avoid: Install all those tools using pip in stead, in a virtual env. And doing things like getting bash completion to work all by hand.

Those are actually just wrappers pointing to the main python@3.8 formula install.

I’d say for most people the main use case of these is to have a CLI to administer their cloud resources.

You can always create a tap, extract ansible to it and add the packages that you’re missing to your own version of it. That way the install will still be managed by homebrew and you can have whatever dependencies you want.