developmentseed / skynet-data

[DEPRECATED] Data pipeline for machine learning with OpenStreetMap
ISC License
169 stars 32 forks source link

Installation problem relating to mapnik and tilelive-vector #1

Closed samuelleach closed 8 years ago

samuelleach commented 8 years ago

Hello - I'm interested in the approach you're taking to enable supervised learning via the OSM data and Mapbox/DigitalGlobe data.

I've been trying to run npm install on OSX and I seem to be running into some problems relating to mapnik:

> mapnik@3.5.13 install /Users/leach/github/skynet-data/node_modules/mapnik
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download: https://mapbox-node-binary.s3.amazonaws.com/mapnik/v3.5.13/Release/node-v48-darwin-x64.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for mapnik@3.5.13 and node@6.2.0 (node-v48 ABI) (falling back to source compile with node-gyp) 
  ACTION binding_gyp_make_vector_tile_target_generate_setting Release/obj/gen/mapnik_settings.js
  COPY /Users/leach/github/skynet-data/node_modules/mapnik/lib/binding/node-v48-darwin-x64/mapnik_settings.js
  TOUCH Release/obj.target/make_vector_tile.stamp
  CXX(target) Release/obj.target/mapnik/src/mapnik_logger.o
  CXX(target) Release/obj.target/mapnik/src/node_mapnik.o
../src/node_mapnik.cpp:2:10: fatal error: 'vector_tile_config.hpp' file not found
#include "vector_tile_config.hpp"
         ^
1 error generated.
make: *** [Release/obj.target/mapnik/src/node_mapnik.o] Error 1

If I brew uninstall mapnik I get the following sorts of errors when doing npm install

> mapnik@3.5.13 install /Users/leach/github/skynet-data/node_modules/mapnik
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download: https://mapbox-node-binary.s3.amazonaws.com/mapnik/v3.5.13/Release/node-v48-darwin-x64.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for mapnik@3.5.13 and node@6.2.0 (node-v48 ABI) (falling back to source compile with node-gyp) 
/bin/sh: mapnik-config: command not found
gyp: Call to 'mapnik-config --cflags' returned exit status 127 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:305:16)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
gyp ERR! System Darwin 15.4.0
gyp ERR! command "/usr/local/Cellar/node/6.2.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.j

I'm not familiar with installing mapnik. Is there a preferred distribution I should be using?

samuelleach commented 8 years ago

By the way, this seems to be related to what happens when I try to make data/images, which throws an error to do with a package tilelive-vector that failed to install:

make data/images

mkdir -p data/labels/color
cat data/sample.txt | ./rasterize-labels data/osm/brazil.mbtiles classes/water-roads-buildings.json data/labels/color
module.js:442
    throw err;
    ^

Error: Cannot find module 'tilelive-vector'
    at Function.Module._resolveFilename (module.js:440:15)
    at Function.Module._load (module.js:388:25)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/leach/github/skynet-data/rasterize-labels:4:14)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
make: *** [data/labels/color] Error 1
anandthakker commented 8 years ago

Hi @samuelleach -- sorry for the delay!

On the mapnik installation, it looks like from the node-pre-gyp message that there aren't prebuilt OSX binaries for Node 6.2. If you're able to easily switch node versions, I had no trouble when using v5.7 -- since there are binaries available for that, the npm install won't try building mapnik locally, and so (hopefully) it'll work.

I believe you're right that the tilelive-vector problem is related to the mapnik install problem.

samuelleach commented 8 years ago

AH - okay. Thank you very much for the pointer and suggestion. I will try that and report back.

samuelleach commented 8 years ago

Confirming what you said - node v5.7 works. Thanks!