node-gyp: Python executable "python" is v3.4.3, which is not supported by gyp
I get this error
> node-gyp rebuild
gyp ERR! configure error
gyp ERR! stack Error: Python executable "python" is v3.4.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 failPythonVersion (/home/hacko/npm/lib/node_modules/wintersmith/node_modules/npm/node_modules/node-gyp/lib/configure.js:108:14)
gyp ERR! stack at /home/hacko/npm/lib/node_modules/wintersmith/node_modules/npm/node_modules/node-gyp/lib/configure.js:97:9
gyp ERR! stack at ChildProcess.exithandler (child_process.js:194: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:817:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
gyp ERR! System Linux 4.1.8-1-ck
gyp ERR! command "/usr/bin/node" "/home/hacko/npm/lib/node_modules/wintersmith/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/hacko/Projects/git/abougouffa/node_modules/wintersmith-livereload/node_modules/ws/node_modules/bufferutil
gyp ERR! node -v v4.1.1
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok
warn npm: optional dep failed, continuing utf-8-validate@1.1.0
warn npm: optional dep failed, continuing bufferutil@1.1.0
warn npm: optional dep failed, continuing fsevents@0.2.1
warn npm: optional dep failed, continuing fsevents@1.0.0
Because in my distro (Arch Linux) and many others, python3 is the default python interpreter (the “python” executable is a link for “python3”).
You can use “python2” instead of “python” in the shebang line, this is a standard since 2011 PEP-394
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Reactions: 15
- Comments: 32 (8 by maintainers)
If you are running into this issue while trying to
npm install
a package on MacOS, maybe you have installed a more recent version of Python using Anaconda. In that case you can makenpm
use the default version of Python installed with MacOS (2.7.x) using:npm config set python /usr/bin/python
That should resolve the issue for you.
npm install --python=python2.7
workedResolved (npm 3.9.5, node 6.2.2, python 3.4.4) by running:
@xing-kenny @lordgreg Please make sure you’re passing the
--python
argument to a Python 2 executable@brutalcrozt Install python 2.7. If node-gyp doesn’t find it automatically, tell it where to look with
--python /path/to/python2.7
.my python default is python3.6, I don’t want change it. So I using:
node-gyp rebuild --python python2.7
This problem still exists unfortunately. It doesn’t like python 3.5 and I’ve tried installing python 2.7, which also fails in a myriad of ways.
I experienced a similar error Here’s what I did:
It started working properly after that
Here’s what I found that was helpful:
Cheers!
Got this resolved by :
SET PYTHON=c:\path\to\python27\executable\python.exe
%PYTHON%
And ensuring it gets the python command promptnpm config set msvs_version 2013 --global
Hope this helps!
I use prahaladbelavadi’s method, it solve my issue.
I did –python=python2.7 as well after seeing https://stackoverflow.com/questions/20454199/how-to-use-a-different-version-of-python-during-npm-install
i have anaconda python 3.* installed. Apparently it is the default on my mac. Running plain old:
npm install tulind --save
gave me this error:Error: Python executable "/Users/**/anaconda/bin/python" is v3.6.0, which is not supported by gyp.
This worked for me, because I have python2.7 at /usr/bin/python:
npm install --save --python=/usr/bin/python tulind
Sorry… I was thinking Linux/Mac.
py --version set PYTHON=“D:\Python27\python.exe” # with the quotes $PYTHON --version npm install
See: http://acdcjunior.github.io/node-gyp-windows.html
Error still shows up. I need to install python 2.7.13 to work with this plugin.
@Pomax Our upstream dependency gyp is Python 2 only, and as it’s now EoL (Google won’t be maintaining it) it’s unlikely that it will be updated to support Python 3.
Efforts are underway to remove/reduce our dependence on it, see https://github.com/nodejs/node-gyp/pull/1092 and https://github.com/indutny/gyp.js.