IPython (& ipdb) issue with python 2.7

If you ever wanted to use ipdb (from IPython) debugger when using Python 2.7, you might have faced an issue like this:

$ sudo pip install ipython
Downloading/unpacking ipython
  Downloading ipython-6.0.0.tar.gz (5.1MB): 5.1MB downloaded
  Running setup.py (path:/tmp/pip_build_root/ipython/setup.py) egg_info for package ipython
    
    IPython 6.0+ does not support Python 2.6, 2.7, 3.0, 3.1, or 3.2.
    When using Python 2.7, please install IPython 5.x LTS Long Term Support version.
    Beginning with IPython 6.0, Python 3.3 and above is required.
...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/ipython

So you gotta go ahead and install IPython==5.0, because it’s the last LTS version. Do:

#pip install IPython==5.0

And then you should get:

ImportError: No module named packaging.version

Hm, that was not expected. Installing setuptools or packaging did not work for me at this moment. To get away with this error I had to install pip3 and then upgrade pip:

  251  sudo apt-get install python3-pip
  252  sudo pip3 install --upgrade pip
  253  sudo pip install ipython==5.0
  254  sudo pip install ipdb

After that, both IPython and ipdb installed with no issues or errors and life was happy again.

ALTERNATIVE SOLUTION:

If the above still does not fix the issue, or if pip and ipython are bound to python 3, you can try this, according described in the packaging.python.org website:

  1. Download get-pip.py
  2. Run python get-pip.py. [2] This will install or upgrade pip. Additionally, it will install setuptools and wheel if they’re not installed already.

Let me know if that worked for you too.

Good Luck!

2 thoughts on “IPython (& ipdb) issue with python 2.7

Leave a comment