1

Sublime Text 2 can't access the packages I have (such as sklearn from Anaconda) whereas from the Terminal I can. How can I change this?

Anaconda here gives instruction on how to link to other editors such as Pycharm, but I can't find anything on Sublime Text. Thoughts and solutions?

Has QUIT--Anony-Mousse
  • 76,138
  • 12
  • 138
  • 194
Ragnar
  • 169
  • 7
  • @Dawny33 That post seems to be directed to Sublime Text 3 (not sure if that makes a difference) and I think it assumes they are already linked and is giving instructions on how to change other settings, not how to link them. Or am I missing something? – Ragnar Oct 20 '15 at 15:10
  • Sublime uses its own embedded python runtime. and In my experience it is a total pain to try to add any modules to that. – ThorSummoner Oct 22 '15 at 18:16

2 Answers2

0

The best doc you're going to find is the "Sublime Text Unofficial Documentation"

This question asks about adding modules to sublime as well: How to include third party Python packages in Sublime Text 2 plugins

Gist of the answer is to modify the embedded python's path to look for your modules.

Community
  • 1
  • 1
ThorSummoner
  • 16,657
  • 15
  • 135
  • 147
0

Create a file named Anaconda.sublime-build in ~/.config/sublime-text-<2/3>/Packages/User/ Edit the following contents of the file accordingly.

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

Now go to sublime text. Tools -> Build System -> Anaconda. You should now be able to build python modules using anaconda python in your system.

You can confirm the same using following commands.

import sys
print(sys.version)
Rohit Patwa
  • 1,092
  • 1
  • 9
  • 12