IPython command not found Terminal OSX. Pip installed
Asked Answered
P

9

24

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!

Patisserie answered 25/5, 2013 at 2:45 Comment(6)
Is it actually running the python you installed, as it already had python before you installed another version of it.Introjection
I added the comment to the main question.Patisserie
Find out where the ipython script was installed, and if necessary symlink it to somewhere on your PATH.Hauteur
What is it that I look for "ipython installation"? Do I look for .app or .egg? And what command do I use to symlink? Thanks!Patisserie
From bash you have to start ipython with the following command: ipython-2.7 (and NOT just with ipython)Transform
For quick reference to answer below by Luna Kong: specify a python module (such as IPython) using the -m parameter: 'python -m IPython'.Batangas
T
26

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

Troostite answered 22/3, 2014 at 21:14 Comment(3)
Thanks for your answer. I just installed Anaconda and got everything to work.Patisserie
For some users, doing just pip install ipython might give an access denied error. In that case, you need: sudo pip install ipythonRescissory
Using pip install -U --user --force ipython worked through.Leavitt
A
24

Check IPython whether is installed by below command:

$python -m IPython

enter image description here 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

Assamese answered 3/10, 2017 at 13:18 Comment(1)
just had similar issue when updating from Mac OSX Mojave to Catalina and changing to zsh as a standard shell, even in the bash version of it the ipython command was broken, adding alias ipython="python3 -m IPython" to ~/.zshrc fixes itEclogue
M
4

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.

Melanism answered 25/5, 2013 at 23:31 Comment(7)
Hmm....when I do the pip command as you suggested I get: no such option: --user #I added my account name as user, obviously! Any ideas why the command fails?Patisserie
pip needs to be installed into homedir too. Run easy_install --user pip, to got one in your $HOME/bin and then --user option will be enabled.Melanism
Wait, when I try EXACTLY the command you suggested I have the following: pip install -U --user ipython Requirement already up-to-date: ipython in /usr/local/lib/python2.7/site-packages Cleaning up...Patisserie
OK, I did the following: easy_install --user pip Searching for pip Best match: pip 1.3.1 Processing pip-1.3.1-py2.7.egg Adding pip 1.3.1 to easy-install.pth file Installing pip script to /Users/XXXX/bin Installing pip-2.7 script to /Users/XXXX/bin where XXXX is the username. I also have the .pydistutils.cfg file in my home directory and still ipython command is not recognized.Patisserie
The run again: pip install -U --user --force ipython, to get it reinstalled and scripts put in $HOME/bin.Melanism
Yay! That works. Thanks SO MUCH for your patience and perseverance.Patisserie
Found this necessary again on El Capitan; thanks for the detailed instructions.Thesda
Z
4

Try run brew install ipython:

enter image description here

then run xcode-select --install

run brew install git,

enter image description here

If you got this result as above picture. Refer to enter link description here

At last, run brew install ipython

Zajac answered 24/10, 2018 at 3:8 Comment(0)
N
2

I use pip3 install ipython is OK.

maybe ipython rely on python3

Nougat answered 12/12, 2019 at 3:32 Comment(0)
C
0

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.

Claptrap answered 14/1, 2020 at 21:29 Comment(0)
I
0

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.

Imperium answered 8/1, 2021 at 8:30 Comment(1)
Artem R U Sure?Rachmaninoff
B
0

Another way is to find the ipython launcher script that was created when installing ipython via pip and use it.

Find where ipython is by running:

find / -name ipython

You may have to add sudo: sudo find / -name ipython

In my case (macOS: Ventura 3.13, python 3.11 ) this returned:

/Library/Frameworks/Python.framework/Versions/3.11/bin/ipython

Verify that this ipython script works as expected.

Run the whole path in the terminal: /Library/Frameworks/Python.framework/Versions/3.11/bin/ipython. You should see the ipython console prompt

console screenshot of ipython

Next, you need to tell your mac that the command ipython means in fact /Library/Frameworks/Python.framework/Versions/3.11/bin/ipython. You do that by creating a symbolic link in /usr/local/bin/ to the real location of ipython with ln -s <source file> <target file>.

In the terminal run:

ln -s /Library/Frameworks/Python.framework/Versions/3.11/bin/ipython /usr/local/bin/ipython

And ipython now starts an ipython session

ipython starts the ipython console

Biosphere answered 19/4, 2023 at 8:16 Comment(0)
M
0

brew install ipython worked for apple sillicon chips.

Memorabilia answered 19/6, 2024 at 13:46 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.