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

Use python2 binary, since python can be an alias to python3 #1030

Closed
flying-sheep opened this issue Oct 7, 2016 · 8 comments
Closed

Use python2 binary, since python can be an alias to python3 #1030

flying-sheep opened this issue Oct 7, 2016 · 8 comments

Comments

@flying-sheep
Copy link

would have been fixed in #911

@ioquatix
Copy link

ioquatix commented Oct 9, 2016

I'm having issues trying to compile stuff

gyp ERR! configure error 
gyp ERR! stack Error: Python executable "/opt/local/bin/python" is v3.3.6, 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 failPythonVersion (/Applications/User/Atom.app/Contents/Resources/app/apm/node_modules/node-gyp/lib/configure.js:454:14)
gyp ERR! stack     at /Applications/User/Atom.app/Contents/Resources/app/apm/node_modules/node-gyp/lib/configure.js:443:9
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:204:7)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at maybeClose (internal/child_process.js:827:16)
gyp ERR! stack     at Socket.<anonymous> (internal/child_process.js:319:11)
gyp ERR! stack     at emitOne (events.js:77:13)
gyp ERR! stack     at Socket.emit (events.js:169:7)
gyp ERR! stack     at Pipe._onclose (net.js:477:12)
gyp ERR! System Darwin 16.0.0
gyp ERR! command "/Applications/User/Atom.app/Contents/Resources/app/apm/bin/node" "/Applications/User/Atom.app/Contents/Resources/app/apm/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /Users/samuel/.atom/packages/autocomplete-ctags/node_modules/ctags
gyp ERR! node -v v4.4.5
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok 

Python defaults to 3.x but python2.6 and python2.7 are available. ??????????

@flying-sheep
Copy link
Author

that’s OK. PEP 394 says:

python refers to python3 on at least Arch Linux […] so python should be used in the shebang line only for scripts that are source compatible with both Python 2 and 3.

in preparation for an eventual change in the default version of Python, Python 2 only scripts should either be updated to be source compatible with Python 3 or else to use python2 in the shebang line.

#911 would fix node-gyp to do this right and use python2 if available, but still falls back to python if it’s not available.

@ioquatix
Copy link

ioquatix commented Feb 1, 2017

This allows you to work around the issue for atom:

apm config set python $(which python2.7)

Perhaps it works with npm too.

@ioquatix
Copy link

ioquatix commented Feb 1, 2017

@bnoordhuis
Copy link
Member

I'm going to close this because I don't think we'll change the current behavior. node-gyp goes to some lengths to find a python2 binary with a fallback to just 'python'. IOW, this should work most of the time and when it doesn't you can pass --python <path> explicitly (or set it with npm config.)

@flying-sheep
Copy link
Author

when this was created, it certainly didn’t thought 😉

@bnoordhuis
Copy link
Member

It did, actually. The algorithm was tweaked a little, though.

@flying-sheep
Copy link
Author

am i missing something?

look at #911’s diff (my PR from back then): i don’t see any attempt at the previous code to use anything but the “python” binary.

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

3 participants