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

Python executable "python" is v3.4.3, which is not supported by gyp #746

Closed
abougouffa opened this issue Sep 27, 2015 · 32 comments
Closed

Comments

@abougouffa
Copy link

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

@TooTallNate
Copy link
Contributor

This was fixed in #527, but it looks like you're using an ancient version of node-gyp for some reason (v1.0.3, current version that bundles with node v4.1.1 is node-gyp v3.0.3). Try updating to the latest node-gyp / npm and things should work for you again.

(Also see #384, #502).

@xing-kenny
Copy link

node-gyp -v v3.0.3 not ok

C:\Users\kenny>D:\\run\\nodejs\\node.exe D:\\run\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp@3.0.3
gyp info using node@4.2.2 | win32 | ia32
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 (D:\run\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:121:14)
gyp ERR! stack     at D:\run\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:110: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:818: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:469:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "D:\\run\\nodejs\\node.exe" "D:\\run\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\kenny
gyp ERR! node -v v4.2.2
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok

@lordgreg
Copy link

lordgreg commented Dec 8, 2015

Same here.

gyp ERR! configure error
gyp ERR! stack Error: Python executable "C:\Users\Gregor\AppData\Local\Programs\Python\Python35\python.exe" is v3.5.1, 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 (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:121:14)
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:110: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:818: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:469:12)
gyp ERR! System Windows_NT 10.0.10586
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Development\ionic2-starter\node_modules\bufferutil
gyp ERR! node -v v5.1.1
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm WARN install:bufferutil@1.2.1 bufferutil@1.2.1 install: `node-gyp rebuild`
npm WARN install:bufferutil@1.2.1 Exit status 1

@TooTallNate
Copy link
Contributor

@xing-kenny @lordgreg Please make sure you're passing the --python argument to a Python 2 executable

@lordgreg
Copy link

lordgreg commented Dec 8, 2015

@TooTallNate thank you for your swift reply. I managed to fix the above error with removing Python 3.* and installing Python 2.* and giving its executable into $PYTHON env. variable. Of course I've thought I'd finally get everything working but no... now I need VS compiler 👎

MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET Framework 2.0 SDK, 2) install Microsoft Visual Studio 2005 or 3) add the location of the component to the system path if it is installed elsewhere.  [C:\Develop ment\ionic2-starter\node_modules\bufferutil\build\binding.sln]
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.10586
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Development\ionic2-starter\node_modules\bufferutil
gyp ERR! node -v v5.1.1
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm WARN install:bufferutil@1.2.1 bufferutil@1.2.1 install: `node-gyp rebuild`
npm WARN install:bufferutil@1.2.1 Exit status 1

I'll try to install VS Community Edition. But that's just great... just to make gyp to work, I have to install python and visual studio. Crazy! 🎱

@sukrosono
Copy link

@TooTallNate hi i still hit this issue as well

  • node v4.2.4
  • node-gyp v3.2.1
  • npm v3.7.2
  • python v3.5.1

i am not sure on my pc is valid issue, because i have install update node and npm

which is clear in my machine is

Error stack -> cant find python executable
Err command "my new node path" "old node path\\path to node-gyp.js" "rebuild"

sorry but i already try stackoverflow solution for this, and 3 of them fail.

@bnoordhuis
Copy link
Member

@brutalcrozt Install python 2.7. If node-gyp doesn't find it automatically, tell it where to look with --python /path/to/python2.7.

@sukrosono
Copy link

@bnoordhuis thanks man, already did but lead to #307
i really going to far, since i just want install protractor. i verify that the file VCBuild.exe is not present.

any suggestion to find fastest way to satisfy this?
i won't and i can't install this one

File Name:                                          File Size:
vs2013.4_dskexp_ENU.iso                               6.5 GB
wdexpress_full.exe                                    1.1 MB

@bnoordhuis
Copy link
Member

You're going to need a compiler. You could give the instructions from #867 a try if VS is too big but one way or another, you're going to need some hard drive space.

@sukrosono
Copy link

i need time to add 7GB on my disk, so basically as long i need node-gyp i have to keep Microsoft Visual C++ build Tools with their 7GB hard drive space?

@bnoordhuis
Copy link
Member

You can try a customized install. I think you only need the C++ compiler and the SDK. Preempting a "how much space will that take?" question: I don't know. :-)

@ghost
Copy link

ghost commented May 29, 2016

Got this resolved by :

  • Installing 2.7 on my machine
    https://www.python.org/download/releases/2.7/
  • Setting the PYTHON path
    SET PYTHON=c:\path\to\python27\executable\python.exe
  • checking if PYTHON was correctly added by executing:
    %PYTHON%
    And ensuring it gets the python command prompt
  • Installing Visual Studio Community 2013 (sorry @brutalcrozt, - didn't track how much space it takes; took close to an hour for the install to run)
  • Running npm config set msvs_version 2013 --global
  • Finally, running
> node-gyp rebuild
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  contextify.cc
  win_delay_load_hook.c
     Creating library C:\node\node_modules\contextify\build\Release\contextify.lib and ob
  ject C:\node\node_modules\contextify\build\Release\contextify.exp
  Generating code
  Finished generating code
  contextify.vcxproj -> C:\node\node_modules\contextify\build\Release\\contextify.node
birst-wdc@0.0.0-a C:\
+-- graceful-fs@4.1.4  extraneous
+-- jsdom@3.1.2
| `-- contextify@0.1.15
|   +-- bindings@1.2.1
|   `-- nan@2.3.3
+-- node.js@0.0.0  extraneous
+-- pug@2.0.0-alpha8  extraneous
`-- python@0.0.4  extraneous

Hope this helps!

@chaffeqa
Copy link

chaffeqa commented Jul 4, 2016

Resolved (npm 3.9.5, node 6.2.2, python 3.4.4) by running:

npm install -g node-gyp

@geryit
Copy link

geryit commented Jan 12, 2017

npm install --python=python2.7 worked

@SoulFireMage
Copy link

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.

@Pomax
Copy link

Pomax commented Feb 23, 2017

Same. Running into

Error: Python executable "C:\Program Files\Python35\python.EXE" 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.

Which isn't very useful. Python 2.5 and 2.6 are abandonware with only 2.7 actively supported, and no plans for ever releasing any version past 2.7.x, Python 3 in the mean time really is the main dev branch with minor versions rolling out at quite the steady pace. Installing 2.7 on windows at this point is usually more likely to cause problems than solve them due to conflicting python versions doing all kinds of bad things outside of node-gyp context (say, you work on 20 projects half of which require node and half of which require python3).

Checking the version of node-gyp that is used here, the script reports node-gyp@3.4.0 (with my node currently at v7.3.0), so this is very much still an issue.

@gibfahn
Copy link
Member

gibfahn commented Feb 23, 2017

@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 #1092 and https://github.com/indutny/gyp.js.

@mgraszek
Copy link

Error still shows up. I need to install python 2.7.13 to work with this plugin.

@frekele
Copy link

frekele commented Mar 2, 2017

See: http://acdcjunior.github.io/node-gyp-windows.html

@fcoclavero
Copy link

@frekele this fixed the issue. Thanks!

@mcrowe
Copy link

mcrowe commented Nov 1, 2017

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 make npm 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.

@amnond
Copy link

amnond commented Nov 19, 2017

@mcrowe 👍 thanks, that sure saved me some time :-)

jonrh added a commit to activitystream/EventDrops that referenced this issue Dec 8, 2017
Doing some Friday house cleaning. When Python 3 is the default we can no longer do "yarn install" or "npm install" in the asclients repository, it will fail with an error. Upgrading to a more recent version of D3 will I think fix the problem because it will underneath upgrade jsdom to a newer version.

See:
https://github.com/activitystream/asclients/issues/412
nodejs/node-gyp#746
@Borkes
Copy link

Borkes commented Dec 26, 2017

my python default is python3.6, I don't want change it. So I using:
node-gyp rebuild --python python2.7

@cnrudd
Copy link

cnrudd commented Jan 12, 2018

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

@prahaladbelavadi
Copy link

I experienced a similar error
Here's what I did:

  • Created new environment on Anaconda for python 2.7 named python-2_7-old

screen shot 2018-01-14 at 1 05 53 pm

- Switched Environments
$ source activate python-2_7-old

It started working properly after that

Here's what I found that was helpful:

Cheers!

@mnovak20
Copy link

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

@polease
Copy link

polease commented Feb 13, 2018

I use prahaladbelavadi's method, it solve my issue.

@codeadict
Copy link

I actually use npm config set python /path/to/python2.7

@yunnysunny
Copy link

I have tried

npm install --python=/path/to/python2.7

set  PYTHON=/path/to/python2.7
npm install

But I node-gyp still use python3

@cclauss
Copy link
Contributor

cclauss commented Nov 12, 2019

python2 --version
python2.7 --version
python3 --version
set PYTHON=python2
npm install

@yunnysunny
Copy link

set  PYTHON=D:\Python27\python.exe
npm install

failed, still used python3 to execute.

python2 --version

command not found

python2.7 --version

command not found

The building.gyp I used is https://github.com/Blizzard/node-rdkafka/blob/master/binding.gyp. I think the problem is not involved node-gyp, for it call python as a script:

https://github.com/Blizzard/node-rdkafka/blob/4f287802eeaabdf18eb4ffd61722de1b7e85b1dc/binding.gyp#L42

@cclauss
Copy link
Contributor

cclauss commented Nov 12, 2019

Sorry... I was thinking Linux/Mac.

py --version
set PYTHON="D:\Python27\python.exe" # with the quotes
$PYTHON --version
npm install

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