Thanks Will
I found the binary for the pip installed latest version of ansible. It seems to finally work fine It is located here: */Users/xxxxx/Library/Python/3.11/bin* % ./ansible --version ansible [core 2.15.2] config file = None configured module search path = ['/Users/xxxxxx/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /Users/xxxxxx/Library/Python/3.11/lib/python/site-packages/ansible ansible collection location = /Users/xxxxxx/.ansible/collections:/usr/share/ansible/collections executable location = ./ansible python version = 3.11.4 (v3.11.4:d2340ef257, Jun 6 2023, 19:15:51) [Clang 13.0.0 (clang-1300.0.29.30)] (/Library/Frameworks/Python.framework/Versions/3.11/bin/python3) jinja version = 3.1.2 libyaml = True My PATH is missing this directory *For VSCode terminal how can I add this to the beginning of my PATH. I can leave the older version on ansible in the PATH if I prepend this /Users/xxxxx/Library/Python/3.11/bin path to the beginning so that I don't need to make a lot of modifications.* I ask because I don't understand the docs explaining how to add to the PATH in VSCode. (they modify the JSON config file) As you can see I have a lot of repetition in the PATH as well. I don't know how that happened. Here is my current PATH /Users/xxxxx/google-cloud-sdk/bin:/Library/Frameworks/Python.framework/Versions/3.11/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Frameworks/Python.framework/Versions/3.7/bin/:/Users/xxxxx/google-cloud-sdk/bin:/Library/Frameworks/Python.framework/Versions/3.11/bin:/usr/local/sbin warm regards Dave On Wednesday, August 9, 2023 at 4:01:03 PM UTC-7 Will McDonald wrote: > It'll be whichever installed ansible is first in your PATH and is > executable. > > Here's a simple example: > > $ echo $PATH > /usr/local/bin:/usr/bin > > $ ll /usr/local/bin/wtf /usr/bin/wtf > -rwxr-xr-x 1 root root 35 Aug 9 23:48 /usr/bin/wtf* > -rwxr-xr-x 1 root root 41 Aug 9 23:48 /usr/local/bin/wtf* > > $ cat /usr/local/bin/wtf /usr/bin/wtf > #!/bin/sh > echo We are in: /usr/local/bin > $ cat /usr/bin/wtf > #!/bin/sh > echo We are in: /usr/bin > > $ wtf > We are in: /usr/local/bin > > Swap the order in the PATH: > > $ export PATH=/usr/bin:/usr/local/bin > $ wtf > We are in: /usr/bin > > Make the closest script non-executable: > > $ sudo chmod -x /usr/bin/wtf > $ wtf > We are in: /usr/local/bin > > If you're pip-installing things ideally you want to do that in a Python > virtual environment (venv) so you don't trample over system Python modules. > Bonus of using venv is then when you toggle that venv 'on' the version > executed is largely taken care of for you. > > See https://www.redhat.com/sysadmin/python-venv-ansible, > https://www.cbtnuggets.com/blog/technology/devops/how-to-install-ansible-in-a-python-virtual-environment > > or many of the other how-tos for references. > > > On Wed, 9 Aug 2023 at 23:16, dmastrop <[email protected]> wrote: > >> hi >> >> I have 2 versions of ansible installed on my Mac.(it was not intentional) >> >> One version was not installed through pip and the other version was >> installed through pip. >> >> I had to manually fix some permissions issues and now that those are >> addressed my terminal (VSCode) invokes the older version rather than the >> newer version. >> >> *What determines which version is run when there are multiple versions on >> a computer?* >> (from what I have read, pip does not install an ansible.cfg file and I >> don't know if that is where the setting is) >> >> >> I thought it might be the $PATH in the terminal but the path includes >> both versions. >> >> >> this is the version ansible 3.7.9(core 2.11.12). This was not installed >> through pip >> >> >> % ansible --version >> >> [DEPRECATION WARNING]: Ansible will require Python 3.8 or newer on the >> controller starting with Ansible 2.12. Current >> >> *version: 3.7.9 *(v3.7.9:13c94747c7, Aug 15 2020, 01:31:08) [Clang 6.0 >> (clang-600.0.57)]. This feature will be removed >> >> from ansible-core in version 2.12. Deprecation warnings can be disabled >> by setting deprecation_warnings=False in >> >> ansible.cfg. >> >> *ansible [core 2.11.12] * >> >> config file = None >> >> configured module search path = >> ['/Users/davemastropolo/.ansible/plugins/modules', >> '/usr/share/ansible/plugins/modules'] >> >> ansible python module location = >> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ansible >> >> ansible collection location = >> /Users/davemastropolo/.ansible/collections:/usr/share/ansible/collections >> >> executable location = >> /Library/Frameworks/Python.framework/Versions/3.7/bin//ansible >> >> python version = 3.7.9 (v3.7.9:13c94747c7, Aug 15 2020, 01:31:08) >> [Clang 6.0 (clang-600.0.57)] >> >> jinja version = 3.1.2 >> >> libyaml = True >> >> >> >> >> this (below) is the newer version installed through pip: >> >> this *was* invoked through the terminal prior to fixing the permission >> issue on one of the directories (it was invoked but failing due to the >> permission issue) >> >> >> Once the permission issue was addressed, ansible now invokes the older >> version (above) >> >> >> >> % python3 -m pip list >> Package Version >> ------------ -------- >> >> *ansible 8.2.0ansible-core 2.15.2* >> certifi 2023.5.7 >> cffi 1.15.1 >> cryptography 41.0.3 >> Jinja2 3.1.2 >> MarkupSafe 2.1.3 >> packaging 23.1 >> pip 23.1.2 >> pycparser 2.21 >> PyYAML 6.0.1 >> resolvelib 1.0.1 >> setuptools 65.5.0 >> >> >> >> warm regards >> >> Dave >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ansible Project" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/ansible-project/158f2e5f-0a55-4a18-98e5-cbadde94a98fn%40googlegroups.com >> >> <https://groups.google.com/d/msgid/ansible-project/158f2e5f-0a55-4a18-98e5-cbadde94a98fn%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/c3e694aa-5c34-4850-be87-c403bfcab0edn%40googlegroups.com.
