Installed Ansible on Mac using following command as documented here:
pip install --user ansible
However, can't find Ansible with version command:
~ $ ansible --version
-bash: ansible: command not found
any clues?
For Modern macos/OSX, you need to find your ~/Library/Python/$version/bin directory and add it to your $PATH. This will help you locate the one where ansible got installed.
try here:
/usr/local/lib/python3.9/site-packages/ansible
change python3.9 with your python version...
otherwise in terminal write:
where ansible
probably return a path similar to this:
/usr/local/bin/ansible
Related
Installed ansible using pip on my macOS running Mojave (10.14.6)
pip install --user ansible
After running I got a successful installation
Successfully installed MarkupSafe-1.1.1 PyYAML-5.1.2 ansible-2.8.5 asn1crypto-1.0.1 cffi-1.12.3 cryptography-2.7 enum34-1.1.6 ipaddress-1.0.22 jinja2-2.10.3 pycparser-2.19
Running my first command
Macbook:~ t0o0tz$ ansible --version
-bash: ansible: command not found
Locate yielded no results. I ran an upgrade and received a bunch of:
Requirement already satisfied, skipping upgrade
During the upgrade I also got a location for ansible
ansible in /Users/t0o0tz/Library/Python/2.7/lib/python/site-packages (2.8.5)
But could not find ansible in 'site-packages'
site-packages contents below:
Extras.pth easy-install.pth vboxapi
README pip-19.2.3-py2.7.egg vboxapi-1.0-py2.7.egg-info
Am I missing something?
The executable file was located in $HOME/Library/Python/2.7/bin
./ansible --version
ansible 2.8.5
Thanks Matthew L Daniel!
I tried below command but it doesn't worked.!!
virtualenv --system-site-packages ~/tensorflow
-bash: virtualenv: command not found
The error virtualenv: command not found tells you exactly what is wrong. You need to install virtualenv to use it. Once you install it the command above should work. Then you will need to activate your virtual environment and use pip to install tensorflow.
So due to some strict versioning requirements I need to downgrade my version of Ansible from 2.1.1.0 to 1.9.4
How can I do this (preferably with brew)?
If not with brew, then this may be an option. Otherwise I have heard that using virtual env may also be a good option so that I can easily run version 2.1.1.0 or 1.9.4 similar to the manner in which rbenv works.
I vote for virtualenv. But if you want to install ansible 1.9:
$> brew uninstall ansible
$> brew search ansible
ansible
ansible#1.9
ansible#2.0
...
$> brew install ansible#1.9
$> pip remove ansible
$> pip install ansible==1.9.4
$> ansible --version
ansible 1.9.4
configured module search path = None
If you use pip, you can use
pip install ansible==<version-number>
This will uninstall old version and install the new one.
This logs are from my local machine when I downgraded my version from 2.7.4 to 2.4.2
Installing collected packages: ansible
Found existing installation: ansible 2.7.4
Uninstalling ansible-2.7.4:
Successfully uninstalled ansible-2.7.4
Running setup.py install for ansible ... done
Successfully installed ansible-2.4.2.0
If you installed ansible with pip, the use the following command.
pip uninstall ansible
NOTE after you use it still possible to run ansible and get the help commands which shows that it is not uninstalled properly. See https://github.com/ansible/ansible/issues/46337.
Required to execute the command as root.
I have ansible version 1.9 on my Centos 7 machine, but need to get version 1.9.2 as I'm running into compatibility issues with ansible and docker.
However, doing a yum update on the ansible package has no affect:
yum update -y ansible
No packages marked for update
How can I upgrade the package?
Edit:
I have upgraded the package using pip as suggested by #Eldad AK:
sudo pip install --upgrade ansible==1.9.2
And the upgrade appeared to be successful:
Successfully installed MarkupSafe-0.23 ansible-1.9.2 ecdsa-0.13 jinja2-2.8 paramiko-1.16.0 setuptools-20.7.0
However when i run the ansible executable and check the version, it's still at 1.9:
ansible --version
ansible 1.9 (devel affb66416f) last updated 2015/11/04 09:09:40 (GMT +100)
You can upgrade it using pip. Try
sudo pip install --upgrade ansible
This is how we update Ansible.
I hope this helps.
You probably have two versions of ansible installed:
1.9 installed via yum. Which is the one in your path and probably in /usr/bin/ansible.
1.9.2 installed via pip. Check /usr/lib/python-version/site-packages/, I guess there is an ansible-1.9.2-* directory there.
You can either uninstall the first one or include the second one in you PATH with a higher precedence.
A quick and dirty fix would be:
mv /usr/bin/ansible /usr/bin/ansible1.9 && mv /usr/bin/ansible-playbook /usr/bin/ansible-playbook1.9
ln -s /usr/lib/python-<version>/ansible-1.9.2-py[...].egg/EGG/scripts/ansible /usr/bin/ansible
ln -s /usr/lib/python-<version>/ansible-1.9.2-py[...].egg/EGG/scripts/ansible-playbook /usr/bin/ansible-playbook
sudo python -m pip uninstall ansible
sudo python -m pip install ansible
Using Python 2.7 installed via homebrew. I then used pip to install IPython. So, IPython seems to be installed under:
/usr/local/lib/python2.7/site-packages/
I think this is true because there is a IPython directory and ipython egg.
However, when I type ipython in the terminal I get:
-bash: ipython: command not found
I do not understand why this ONLY happens with IPython and not with python? Also, how do I fix this? What path should I add in .bashrc? And how should I add?
Currently, my .bashrc reads:
PATH=$PATH:/usr/local/bin/
Thanks!
I had this issue too, the following worked for me and seems like a clean simple solution:
pip uninstall ipython
pip install ipython
I'm running mavericks and latest pip
Check IPython whether is installed by below command:
$python -m IPython
If you got this result as above picture.
Then run this command on terminal and add into ~/.bash_profile file
$alias ipython='python -m IPython'
So try run "ipython" again on terminal. It works fine for me.
Reference topics:
ipython on MacOS 10.10 - command not found
iPython installed but not found
Create .pydistutils.cfg in your homedir with following content:
[global]
verbose=1
[install]
install-scripts=$HOME/bin
[easy_install]
install-scripts=$HOME/bin
And then: pip install -U --user ipython. Of course $HOME/bin must be in your $PATH. Packages are going to be installed in $HOME/Library/Python, so user only, not system wide.
Try run brew install ipython:
then run xcode-select --install;
run brew install git,
If you got this result as above picture. Refer to enter link description here
At last, run brew install ipython
I use pip3 install ipython is OK.
maybe ipython rely on python3
After trying to a number of solutions like above with out joy, when I restarted my terminal, Ipython command launched. Don't forgot to restart your terminal after all the fiddling!
P.S. I think the brew install Ipython did it ... but can't be sure.
For me the only thing that helped was:
python -m pip install --upgrade pip
Upgrading pip did the work and all the installations started working properly!
Give it a try.