Installing numpy for Sublime Text 3

Swapneel Mehta picture Swapneel Mehta · Apr 13, 2016 · Viewed 15.2k times · Source

I'm using Sublime Text 3 on Ubuntu 14.04, and I'm just warming up to Package Management in Sublime. I came across this plugin Advanced CSV and installed it via Package Control but it says it requires the numPy library installed "in the packages folder". Now I'm a little confused as to what that means and I've found a number of similar questions but it was with respect to plugin development hence I didn't really understand them.

My question is do I achieve this by a standard installation of a Python library such as numPy after extracting the folder numpy-1.11.0 to /home/{username}/.config/sublime-text-3/Packages/ or is it some other technique with respect to building or adding the dependency to a config file ?

Answer

MattDMo picture MattDMo · Apr 13, 2016

Julien Salinas' answer covers some of the broad strokes, but not the correct details. You can't just download numpy-1.11.0.tar.gz from PyPI and extract it into Packages/numpy. It needs to be built by running setup.py, and the annoying thing is that it needs to be built using Python 3.3, which you may or may not have already installed on your system. The reason for this is 3.3 is the version of Python that ST3 uses internally, and since plugins run (in most cases) using Sublime's interpreter, any compiled modules need to be built with the same major.minor version of that interpreter (the major.minor.micro version shouldn't make a difference).

Assuming you don't, you'll have to download Python-3.3.6.tgz (MD5 checksum here) from python.org and build it yourself. This is fairly straightforward if you're used to building programs from source on Linux, but in order to get all the modules built (it'll say at the end of the make run what modules weren't built) you'll most likely need to install some external libraries.

Once you get 3.3.6 built and installed (I'd recommend a custom location so there's no chance of it interfering with the system version(s) of Python), extract the numpy archive to a custom location and build it with setup.py using Python 3.3.6. Again, you may need some external libraries to successfully build it. Once it's built, install it to Python 3.3.6's site-packages directory, then finally you can copy the numpy folder from site-packages to ~/.config/sublime-text-3/Packages. Note the capitalization (or lack thereof) - the final directory should be Packages/numpy, not Packages/Numpy as indicated in the other answer. Once properly installed, restart Sublime and the Advanced CSV plugin should function as expected.

Good luck!