Friday 15 March 2019

python - Installing libspatialindex on Windows 8


I need to use Rtrees to make some code I'm running faster. However, in order to use Rtree, I need to install libspatialindex. When I've installed packages in the past I've been able to either download a .exe file from Chris Gohlke's site, or use setup.py install from the command prompt, after extracting the contents of a tar.gz file.


The problem I'm having is that 1.) There is no .exe file on Gohlke's site, and 2.) After downloading 'spatialindex-src-1.8.4.tar', and trying to extract it, I get the error 'Can not create output directory' - I have no idea what that's all about. 3.) I go to http://download.osgeo.org/libspatialindex/ and download the appropriate file - i.e. libspatialindex-1.8.1-win-msvc-2010-x64-x32.zip, when I unzip it seems obvious that everything I need is there - there are a number of .dll files. It seems like this last one is the best route, but after unzipping, I don't know what to do with all the files. Do they need to do into my DLLs folder?



Answer




Not really sure but libspatialindex is only a C library (low level).


You should just need to use the Rtree Windows installer, a Python package using libspatialindex on the top.


In fact, since we answered, the install process has changed. You need to get a remote URL to a file ending with .whl (for "wheel", a new Python packaging way to ease installation) or you can download the file and install from it.


Then, you will do from command line:


# Install from remote ressource
pip install http://www.lfd.uci.edu/~gohlke/pythonlibs/djcobkfp/Rtree-0.8.2-cp27-cp27m-win_amd64.whl
# Or for local downloaded file
pip install Rtree-0.8.2-cp27-cp27m-win_amd64.whl

We know what we are installing because of file name convention:




  • Rtree-0.8.2 = Rtree version 0.8.2

  • cp27-cp27m = Version of Python = 2.7

  • win_amd64 = Windows 64 bits architecture


For installation, you can also use this page from official docs.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...