2

(There is a similar question, so I intended to provide more information below that one but got my post deleted. So I'll ask my own question here.)

I installed the newest version of iPython by typing sudo -H pip install ipython

I confirmed the installed version is 3.1.0

> pip show ipython
---
Metadata-Version: 2.0
Name: ipython
Version: 3.1.0
Summary: IPython: Productive Interactive Computing
Home-page: http://ipython.org
Author: The IPython Development Team
Author-email: ipython-dev@scipy.org
License: BSD
Location: /usr/local/lib/python2.7/dist-packages
Requires: 

However, when I type ipython command and enter the program, the message is:

Python 2.7.6 (default, Mar 22 2014, 22:59:56) 
Type "copyright", "credits" or "license" for more information.

IPython 1.2.1 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

The only way the IPython 3.1.0 can be called is to type ipython in the directory /usr/local/lib/python2.7/dist-packages where pip installed it.

By comparing the help file in iPython, I confirmed they are indeed different versions (so not just displaying wrong version).

Typing which ipython would give /usr/local/bin/ipython, whose content is

#!/usr/bin/python

# -*- coding: utf-8 -*-
import re
import sys

from IPython import start_ipython

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
    sys.exit(start_ipython())

Weirdly, when I use pip uninstall ipython to remove ipython 3.1.0, the old 1.2.1 version (which I assume came with the system and caused the confusion) also disappeared.

muru
  • 197,895
  • 55
  • 485
  • 740
chcubic
  • 21
  • Sorry you had a bad experience. Here we're not a forum, so we expect answers to be answers. Well done, you've done the right thing here. – Tim May 21 '15 at 21:26

1 Answers1

1

I had a similar issue. It turned out that I had two versions of IPython installed, and running ipython in the command line was launching the older version.

To resolve this issue, I simply had to update my PATH variable in my /.bashrc (or /.zshrc if you're using zsh as your shell) file.

export PATH="/path_to_my_anaconda/anaconda/bin:$PATH"

Since this section is pre-pended to your original PATH, running ipython should now launch the ipython version that is in anaconda (which I wanted) rather than the vanilla installation.

After sourcing the /.bashrc file with the above line, running ipython from the command line started the version of IPython I wanted.

Carl S
  • 111
  • 1