Skip to content

Should intelligently try to detect Python 2.7 #1266

Closed

Description

@cwallenpoole

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"

Activity

  1. bnoordhuis commented on Aug 18, 2017

    @bnoordhuis
    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.)

  2. cjbj commented on Aug 18, 2017

    @cjbj

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

  3. refack commented on Aug 19, 2017

    @refack
    Contributor

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

  4. gibfahn commented on Aug 19, 2017

    @gibfahn
    Member

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

  5. bnoordhuis commented on Aug 19, 2017

    @bnoordhuis
    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
  6. refack commented on Aug 19, 2017

    @refack
    Contributor

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

  7. bnoordhuis commented on Sep 7, 2017

    @bnoordhuis
    Member

    No follow-up, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions