python package error when running from sublime
Question: I installed the python package `isochrones` using `pip install isochrones`.

When I type `from isochrones.dartmouth import Dartmouth_Isochrone` in the
`Sublime text editor` I get the following error:

    
    
    from isochrones.dartmouth import Dartmouth_Isochrone
    ImportError: No module named dartmouth
    

However, the same command works when I run it from `ipython`.

What's going on?! I have a long code, so working in `ipython` is not possible.
I want to use `sublime`.


Answer: You need to create a new [build
system](http://docs.sublimetext.info/en/latest/file_processing/build_systems.html)
for Anaconda. Select **`Tools → Build System → New Build System...`** and
replace the contents of the file that opens with the following:

    
    
    {
        "cmd": ["/Applications/anaconda/bin/python", "-u", "$file"],
        "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
        "selector": "source.python"
    }
    

When you hit save, it should automatically open your User directory
(`~/Library/Application Support/Sublime Text 2/Packages/User`). Save the file
there as `Anaconda Python.sublime-build`. Finally, select **`Tools → Build
System → Anaconda Python`** so the proper system will run when you select
Build.

Now that the build system is all set up, you need to ensure that you're
installing things under the right Python distribution. OS X comes with Python
built-in as `/usr/bin/python`, with system packages residing in a range of
possible directories, depending on which build of OS X you're using. From the
command line, run

    
    
    which pip
    

to ensure it points to the Anaconda installation. If it doesn't, you'll have
to alter your `PATH` variable to put `/Applications/anaconda/bin` at the
front, before `/usr/bin` and `/usr/local/bin`. How to do that is beyond the
scope of this answer, but it's easy to find out by a quick Google search.

You should now be able to use your Anaconda `pip`-installed packages with
Sublime Text.

