5

I already have Python 2.7 installed but I wanted to try IPython so I installed IPython via Anaconda as recommended on the ipython website (although not sure what the pros/cons of doing this are). Now I would like to use ipdb debugger. I guess I need to make sure it installs underneath the Anaconda version of python rather than the normal python.

How do I install this? In general if I want to install some arbitrary python module under Anaconda how do I do this?

User
  • 62,498
  • 72
  • 186
  • 247

2 Answers2

4

Actually I think in the case of ipdb it's already installed with Anaconda. But in general it appears you can just install stuff via either pip or easy_install as necessary. The key that I was missing is to make sure you are using the pip/easy_install that comes with Anaconda (which are .bat files in the Scripts directory) rather than the system Python's pip/easy_install. So:

Anaconda\Scripts\easy_install somepackage

This will install somepackage in Anaconda\lib\site-packages\ and not in the system python. This appears to work and I can now import somepackage from my anaconda python. This seems to work. It wasn't clear to me from reading Anaconda documentation if everything needed to be in a conda package or not.

This answer seems to support this idea: Installing Anaconda into a Virtual Environment

Community
  • 1
  • 1
User
  • 62,498
  • 72
  • 186
  • 247
  • 1
    For some reason `ipdb` is not in the conda archives (for windows at least). As `User` says, using `pip` is the correct way and Conda is fine with mixing it with other installers: "If the package is not available, you can install it by the usual means, e.g. pip," ([Anaconda FAQ](http://docs.continuum.io/anaconda/faq.html)) – dirkjot Nov 24 '14 at 10:00
  • doesn't seem to be there for linux either – bph Mar 21 '16 at 12:19
  • on a linux miniconda2 system, I did cd ~/miniconda2/bin -> easy_install pdb and it installed to ~/miniconda2/lib/python2.7/site-packages/ipdb-0.9.0-py2.7.egg and idb popped up in the miniconda2/bin dir. This all looks about right to me – bph Mar 21 '16 at 12:23
2

Generally the first thing to check is whether someone else has already built it for your version of python and uploaded it to anaconda.org:

anaconda search -t conda ipdb

then find a repository with ipdb built for your OS, and try

conda install -c <repository> ipdb

e.g. conda install -c conda-forge ipdb

You might need to try a few different ones to find one built for your version of python. There is a feature request to make this easier.

If that doesn't work, then pip install ipdb will

naught101
  • 18,687
  • 19
  • 90
  • 138