andrewharvey / geojson-polygon-labels

Command line tool to generate point labels from GeoJSON polygons
ISC License
82 stars 16 forks source link

Failed to install #5

Closed stevage closed 6 years ago

stevage commented 6 years ago

It looks like on my system it failed to install because (of all things) my version of Python is too new?

> zipfile@0.5.11 install /Users/steveb/dev/region_labels/node_modules/zipfile
> node-pre-gyp install --fallback-to-build

node-pre-gyp info it worked if it ends with ok
node-pre-gyp verb cli [ '/usr/local/bin/node',
node-pre-gyp verb cli   '/Users/steveb/dev/region_labels/node_modules/zipfile/node_modules/.bin/node-pre-gyp',
node-pre-gyp verb cli   'install',
node-pre-gyp verb cli   '--fallback-to-build' ]
node-pre-gyp info using node-pre-gyp@0.6.32
node-pre-gyp info using node@8.9.4 | darwin | x64
node-pre-gyp verb command install []
node-pre-gyp info check checked for "/Users/steveb/dev/region_labels/node_modules/zipfile/lib/binding/node-v57-darwin-x64/zipfile.node" (not found)
node-pre-gyp http GET https://mapbox-node-binary.s3.amazonaws.com/zipfile/v0.5.11/node-v57-darwin-x64.tar.gz
node-pre-gyp http 403 https://mapbox-node-binary.s3.amazonaws.com/zipfile/v0.5.11/node-v57-darwin-x64.tar.gz
node-pre-gyp ERR! Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/zipfile/v0.5.11/node-v57-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for zipfile@0.5.11 and node@8.9.4 (node-v57 ABI) (falling back to source compile with node-gyp)
node-pre-gyp http 403 status code downloading tarball https://mapbox-node-binary.s3.amazonaws.com/zipfile/v0.5.11/node-v57-darwin-x64.tar.gz
node-pre-gyp verb command build [ 'rebuild' ]
gyp ERR! configure error
gyp ERR! stack Error: Python executable "/Users/steveb/anaconda3/bin/python" is v3.6.3, which is not supported by gyp.
gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.
gyp ERR! stack     at PythonFinder.failPythonVersion (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:492:19)
gyp ERR! stack     at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:474:14)
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:267:7)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at maybeClose (internal/child_process.js:925:16)
gyp ERR! stack     at Socket.stream.socket.on (internal/child_process.js:346:11)
gyp ERR! stack     at emitOne (events.js:116:13)
gyp ERR! stack     at Socket.emit (events.js:211:7)
gyp ERR! stack     at Pipe._handle.close [as _onclose] (net.js:554:12)
gyp ERR! System Darwin 16.6.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/Users/steveb/dev/region_labels/node_modules/zipfile/lib/binding/node-v57-darwin-x64/zipfile.node" "--module_name=zipfile" "--module_path=/Users/steveb/dev/region_labels/node_modules/zipfile/lib/binding/node-v57-darwin-x64"
gyp ERR! cwd /Users/steveb/dev/region_labels/node_modules/zipfile
gyp ERR! node -v v8.9.4
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok

Are there any workarounds?

andrewharvey commented 6 years ago

This issue must be upstream in the dependency tree somewhere not something I can fix.

It looks like it needs python < 3. On my Debian system I have python and python3 executables, and it uses python which is python 2.

As a workaround you could try to make python point to python 2.

stevage commented 6 years ago

Bleh. I can't believe "hack your system-wide python to solve a backward incompatibility problem" is still par-for-the-course Python usage in 2017. Any idea why Python is even a dependency here?

andrewharvey commented 6 years ago

In https://github.com/andrewharvey/geojson-polygon-labels/commit/3dc96e4bdf26b79f67cbea28ad3e0961bb640a60 I added a dependency to stream GeoJSON features so this utility could be run on large GeoJSON files without consuming much RAM. It's quite a heavy dependency though as it has a lot of upstream native code dependencies which is where this issue likely originates.

Could you try to install https://github.com/mapbox/stream-features-from-file and see if you get the same error from that?

stevage commented 6 years ago

Yup, that fails too. Yeah, that seems like an unnecessarily heavy dependency - well, for my use case at least.

I think the better way to make processing GeoJSON light on RAM is to work with line-delimited GeoJSON, then it's really easy.

Oh look, I made just the tool to get you started: https://www.npmjs.com/package/geojson2ndjson :) (Haven't really checked to see how it goes on RAM.)

andrewharvey commented 6 years ago

Exactly. Though I'd like to keep this tool as flexible as possible to work with normal GeoJSON as it reduces the steps people need to take.

Your geojson2ndjson looks good, but you're right I'd want to test this with say the SA1s as a GeoJSON and watch the memory usage.

andrewharvey commented 6 years ago

I'll close this issue as it's an upstream issue, but hope it get's fixed soon!