How to install libspatialindex on Google Colaboratory - r-tree

To efficiently analyse spatial data with Python, I use the rtree spatial index library, relying on the libspatialindex C library.
I am able to successfully install rtree in the Google Colaboratory notebook using !pip install rtree.
As expected, this is not sufficient, as libspatialindex needs to be installed first, as confirmed by import rtree resulting in:
OSError: Could not find libspatialindex_c library file
I am unsure whether and how to install external libraries in the Google Collaboratory. Following https://github.com/libspatialindex/libspatialindex/wiki/1.-Getting-Started I managed to run !curl -L http://download.osgeo.org/libspatialindex/spatialindex-src-1.8.5.tar.gz | tar xz but I do not have permissions for configure:
!spatialindex-src-1.8.5/configure
/bin/sh: 1: spatialindex-src-1.8.5/configure: Permission denied

Edit: Looks like the bug has been fixed. Building no longer requires the !mount ... command below. I've updated the example notebook accordingly.
The original response follows.
This looks like a Colab bug. The /content directory is mounted with noexec, which is what's causing the permissions error.
Until that's fixed, you can remount /content with the exec permissions you need using the command:
!mount -o remount,exec /content
Here's a complete notebook that installs libspatialindex and rtree.
https://colab.research.google.com/notebook#fileId=1N7i9zmOwVcUzd4eHWZux4p_WTBMZHi8C

Related

How to install the locate command on nixos

I've searched on the nixos package manager, if there is package named locate.
Yes and several. But that's not the bash command that I am searching for.
I want to add this bash command
locate name.extention
which gave me the path of this file
The package mlocate provides a locate executable. The package plocate provides an executable named plocate which might be better. Both of these packages will require some extra setup steps to allow them to build their file location database, and I don't happen to have a link to those instructions at the moment.
nix-shell -p mlocate

Apache Jena Commands not found

I'm trying to set up my system (Ubuntu 16.04) with Apache Jena 3.10.0, and followed the provided instructions, but I'm unable to access any of the commands that I should have access to.
For example, sparql --version and bin/sparql --version both return:
sparql: command not found
I have downloaded and extracted the files to /home/[user]/apache-jena-3.10.0, then run:
export JENA_HOME=/home/[user]/apache-jena-3.10.0
export PATH=$PATH:$JENA_HOME/bin
The command cd $JENA_HOME successfully goes the apache-jena-3.10.0 directory.
I feel that there is a basic linux thing here that I'm missing, but I've tried a lot of things and had no luck so far. Any help would be greatly appreciated. Thanks!
The files in the download from Apache were not marked as executable. From the main apache-jena-3.10.0 directory, chmod -R 775 bin changed all files so I could run them from command line.

Google Cloud Platform - Viewing downloaded files after wget

I am completing this tutorial and am at the part where you download the code for the tutorial. The request we send to Github is:
wget https://github.com/GoogleCloudPlatform/cloudml-samples/archive/master.zip
I understand that this downloads archive to GCP, and I can see the files in the Cloud shell, but is there a way to see the files through the Google Console GUI? I would like to browse the files I have downloaded to understand their structure better.
By clicking on the pencil icon on the top right corner, the Cloud Shell Code editor will pop.
Quoting the documentation:
"The built-in code editor is based on Orion. You can use the code
editor to browse file directories as well as view and edit files, with
continued access to the Cloud Shell. The code editor is available by
default with every Cloud Shell instance."
You can find more info here: https://cloud.google.com/shell/docs/features#code_editor
If you prefer to use the command line to view files, you can install and run the tree Unix CLI command 1 and run it in Cloud Shell to list contents of directories in a tree-like format.
install tree => $ sudo apt-get install tree
run it => $ tree ./ -h --filelimit 4
-h will show human readable size of files/directories
and you can use --filelimit to set the maximum number of directories to descent within the list.
Use $ man tree to see the available parameters for the command, or check the man online documentation here: https://linux.die.net/man/1/tree

How to install Cloud Foundry CLI on Ubuntu

I am a docker newbie.
I have an ubuntu image and wanted to install Cloud Foundry CLI on it and am unable to do so.
I downloaded the binary for CF CLI from https://github.com/cloudfoundry/cli/releases and untarred it. The untar is successful but I am unable to run the CLI.
When i run the cf i get /bin/sh: ./cf: not found message.
A couple ways to do this. Edit your path. Place the following in ~/.bash_profile or ~/.bashrc.
PATH=$PATH:/path/to/directory/containingcf
Or put cf in /usr/bin/ or somewhere that is already on your path.
If cf executable in current directory just use "./cf".
In general it is better to place cf executable somewhere in your PATH.
Please make sure the cf file has executable permissions and it is suitable for your OS architecture (e.g. Boot2Docker 1.5.0 works only with "Linux 32 bit" cf binary).

Installing Documentation fails

I followed the instructions for installing the documentation from the source build (by compiling the documentation scheme in CorePlotExamples) but it fails when trying to compile the documentation with the following errors.
3068: protocol_c_p_t_bar_plot_data_source-p.html
3069: protocol_c_p_t_scatter_plot_data_source-p.html
3070: _c_p_t_utilities_8m.html#a794f89cd14d4cfb21bf8c050b2df8237
3071: category_c_p_t_layer_07_c_p_t_platform_specific_layer_extensions_08.html
3072: interface_c_p_t_line_style.html#a4013bcb6c2e1af2e37cfabd7d8222320
3073: _c_p_t_utilities_8h.html#ae826ae8e3f55a0aa794ac2e699254cad
Loading symbols from /Users/GeoffCoopeMP/Downloads/core-plot-master-3/framework/CorePlotDocs.docset/html/com.CorePlot.Framework.docset/Contents/Resources/Tokens.xml
1000 tokens processed...
2000 tokens processed...**strong text**
3000 tokens processed...
4000 tokens processed...
5000 tokens processed...
* 5145 tokens processed ( 1.8 sec)
* 20 tokens ignored
Linking up related token references
Sorting tokens
rm -f com.CorePlot.Framework.docset/Contents/Resources/Documents/Nodes.xml
rm -f com.CorePlot.Framework.docset/Contents/Resources/Documents/Info.plist
rm -f com.CorePlot.Framework.docset/Contents/Resources/Documents/Makefile
rm -f com.CorePlot.Framework.docset/Contents/Resources/Nodes.xml
rm -f com.CorePlot.Framework.docset/Contents/Resources/Tokens.xml
mkdir -p ~/Library/Developer/Shared/Documentation/DocSets
cp -R com.CorePlot.Framework.docset ~/Library/Developer/Shared/Documentation/DocSets
cp: /Users/GeoffCoopeMP/Library/Developer/Shared/Documentation/DocSets/com.CorePlot.Framework.docset: Not a directory
make: *** [install] Error 1
find: /Users/GeoffCoopeMP/Library/Developer/Shared/Documentation/DocSets/com.CorePlot.Framework.docset/Contents/: Not a directory
false
Showing first 200 notices only
Command /bin/sh emitted errors but did not return a nonzero exit code to indicate failure
I found the com.CorePlot.Framework.docset files (7kb) but noticed the KIND is "Unix executable file" rather than the expected "Documention Set" like other Xcode help files.
The dockset files are also 7kb in the zip file download under the documentation folder and the kind is shown as Unix executable file there too.
Under my user Library folder I can see the dockets as in:
I also noticed that the docksets can be within the Xcode.app contents but placing these files here didn't work either.
So, is this 7k file the right one? should it be kind Documentation Set rather than Unix Exectuable File? Why does the documentation not compile in Xcode but still generates the files?
I am using Xcode version 5.1.1, Doxygen 1.8.7, graphviz 2.36 and Core Plot 2.0 source from github.
Any help would be much appreciated as I am trying to learn how to use this excellent SDK.
The Core Plot docsets should each be around 70 MB in size. A "docset" is a package which is a special type of folder treated as a single file in the Finder. When building Core Plot documentation, Doxygen makes the docset folder inside the Core Plot "framework" folder and copies it to your library from there.
Did the docset get built in the "framework" folder? Are there any aliases or file links in the path to the Core Plot folder that might be confusing Doxygen or the cp command?

Resources