2

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 ?

MattDMo
  • 100,794
  • 21
  • 241
  • 231
Swapneel Mehta
  • 55
  • 1
  • 2
  • 12
  • First question - do you *need* the numpy functionality? Because it's going to be a pain installing it. – MattDMo Apr 13 '16 at 16:18
  • I agree it's a pain but I'll probably have to do it sometime in the future so might as well start now. Anyway, I'll try using Tiny Numpy but I'd really prefer to get done installing numPy so I don't run into issues later. – Swapneel Mehta Apr 13 '16 at 17:10

3 Answers3

2

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!

Community
  • 1
  • 1
MattDMo
  • 100,794
  • 21
  • 241
  • 231
0

As stated in the doc (https://github.com/wadetb/Sublime-Text-Advanced-CSV), you can either use numpy or Tiny Numpy. If Tiny Numpy is enough, then there is nothing to do since it is already included in the Advanced CSV installation folder.

If you really need Numpy - which can be tough to install - then download it and install it in a newly created sublime text package folder: ~/.config/sublime-text-3/Packages/numpy

This post explains you how precisely : Sublime Plugin: How can I import wx? Basically the trick is to import the package properly in your python file. Let's say you downloaded and installed numpy in this folder: ~/.config/sublime-text-3/Packages/numpy If you want to use ipmt function, then you should import it this way :

from .numpy import ipmt
Community
  • 1
  • 1
Julien Salinas
  • 1,059
  • 1
  • 10
  • 23
  • Could you kindly elaborate on how I'd go about the installation with respect to it ultimately being used by a Sublime Text package and not just a Python library. Do I need to add a system path variable or build from tools in order for it to work? – Swapneel Mehta Apr 13 '16 at 17:06
  • I just updated my answer. This is about adding a dot during the import. – Julien Salinas Apr 13 '16 at 17:30
  • Please edit it to `~/.config/sublime-text-3/Packages/numpy` as pointed out in case someone uses this answer as reference in the future. – Swapneel Mehta Apr 14 '16 at 05:50
  • I just edited my answer with "numpy" instead of "Numpy'. – Julien Salinas Apr 14 '16 at 06:15
0

Use the existing SublimeText dependency:

sublime-numpy

 

 

Resources:

Enteleform
  • 3,753
  • 1
  • 15
  • 30
  • 1
    Unfortunately, the package you linked to only has numpy for OS X and Windows. OP is on Linux. – MattDMo Apr 13 '16 at 21:49