Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should intelligently try to detect Python 2.7 #1266

Closed
cwallenpoole opened this issue Aug 18, 2017 · 7 comments
Closed

Should intelligently try to detect Python 2.7 #1266

cwallenpoole opened this issue Aug 18, 2017 · 7 comments

Comments

@cwallenpoole
Copy link

cwallenpoole commented Aug 18, 2017

Having to install a virtualenv to get a node project working is counter intuitive.

If you were using hasbin, you could change this:

39   findPython(python, function (err, found) {
 40     if (err) {
 41       callback(err)
 42     } else {
 43       python = found
 44       getNodeDir()
 45     }
 46   })

To:

 39   findPython(python, function (err, found) {
 40     if (err) {
 41       if (!(gyp.opts.python || process.env.PYTHON) && hasbin.sync('python2.7')) {
 42         python = 'python2.7'
 43       } else {
 44         callback(err)
 45         return;
 46       }
 47     }
 48
 49     python = found
 50     getNodeDir()
 51   })
  • Node Version: 8
  • Platform: OSX
  • Compiler: Irreelvant
  • Module: Irrelevant, happens with every related gyp module
Verbose output (from npm or node-gyp):
gyp ERR! configure error
gyp ERR! stack Error: Python executable "/Users/christopherallen-poole/anaconda/bin/python" is v3.5.2, 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:262:7)
gyp ERR! stack     at emitTwo (events.js:125:13)
gyp ERR! stack     at ChildProcess.emit (events.js:213:7)
gyp ERR! stack     at maybeClose (internal/child_process.js:921:16)
gyp ERR! stack     at Socket.stream.socket.on (internal/child_process.js:348:11)
gyp ERR! stack     at emitOne (events.js:115:13)
gyp ERR! stack     at Socket.emit (events.js:210:7)
gyp ERR! stack     at Pipe._handle.close [as _onclose] (net.js:549:12)
gyp ERR! System Darwin 16.7.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
@bnoordhuis
Copy link
Member

What version of node-gyp are you using? We already go to some lengths to find a suitable python binary, although currently it looks for 'python2', not 'python2.7' (because python 2.6 is acceptable too.)

@cjbj
Copy link

cjbj commented Aug 18, 2017

[@bnoordhuis if python 2.6 is acceptable, it would be nice if the README stated this, instead of saying 'v2.7 recommended']

@refack
Copy link
Contributor

refack commented Aug 19, 2017

@cjbj I guess a PR with better wording would not be rejected 😉 (at worse some civil bikeshedding)

@gibfahn
Copy link
Member

gibfahn commented Aug 19, 2017

@bnoordhuis given your comment here: nodejs/node#14737 (comment), maybe we should consider python 2.6 doc-deprecated.

@bnoordhuis
Copy link
Member

Well, 2.7 is recommended (I'd even say strongly recommended) but:

  1. since we nominally still support node.js v0.10 and v0.12, and
  2. since those node.js versions support python 2.6, therefore
  3. node-gyp does too

@refack
Copy link
Contributor

refack commented Aug 19, 2017

@cwallenpoole could you provide your node-gyp version? And if you are running it through npm, if possible the full npm-debug.log?

@bnoordhuis
Copy link
Member

No follow-up, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants