Sublime Hax: PANDAS and NumPy in Sublime REPL

Sublime with Python REPL

Note: if you don’t have SublimeREPL installed in Sublime, refer to this post.

Problem: Your favorite Python Modules like PANDAS is not working 
If you try to import Pandas in the SublimeREPL, you are going to get an error saying it couldn’t find it, even if you have it install on your system. What the heck is going on!? Well, the SublimeREPL is not using your system version of Python and thus is unable to access the modules you have installed on it.

Solution: Change the SublimeREPL setting to use your System version of Python
Ok, first go to Sublime Text > Preferences > Browse Packages…
Screen Shot 2015-03-25 at 11.09.04 AM

Navigate to Packages > SublimeREPL > config > Python > Main.sublime-menu like so:
Screen Shot 2015-03-25 at 11.13.38 AM

You should see a file like this: Note Line 22 is not going to be commented out for you, that is of my own doing.
Screen Shot 2015-03-25 at 11.16.11 AM

Now you have the choice of either deleting or commenting out line 22. My line 23 is what you are going to want to add to this file. The path (“/Library/Frameworks/Python.framework/Versions/3.4/bin/python3”) is where my python3 is located on my system.

If you are using Python 2 and don’t know where it is on your machine, you can type which python into your command line (Terminal) and it should give you the path. Mine is at /usr/local/bin/python.
Don’t forget to add a comma at the end of your additional line!

Now, if you don’t have PANDAS installed, you need to do one of two things:
If you have Python 3.4 (Released in March), simply type into

pip3 install pandas

If you have a older version of Python:
You will need pip if you don’t have it. Type this into your Terminal
Then you can install PANDAS with this in

pip install pandas

And you are done!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s