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

Support for Python 3 #193

Closed
mcandre opened this Issue Feb 12, 2013 · 35 comments

Comments

Projects
None yet
@mcandre

mcandre commented Feb 12, 2013

Please add support for Python 3.

Some tools require Python 2, some require Python 3, and this makes it really hard to setup a build environment. Better to support both when possible.

@TooTallNate

This comment has been minimized.

Contributor

TooTallNate commented Feb 12, 2013

Ditto on #194: this is an issue with upstream gyp, and in fact they are aware of the problem: http://code.google.com/p/gyp/issues/detail?id=36

Go make some noise in that issue if you want to see Python 3 supported (or better yet, send the patch!).

@CamiloMM

This comment has been minimized.

CamiloMM commented Jul 26, 2014

As someone who doesn't do Python: why is there still so much incompatibility? Python 3.0 was released on 2008 and has a lot of advantages over 2.x, so why does 2.x still hold so much predominance?

@unbornchikken

This comment has been minimized.

unbornchikken commented Aug 14, 2014

I've started a petition, you can sign it there: https://www.change.org/petitions/google-inc-upgrade-gyp-to-support-phyton-3

@mcandre

This comment has been minimized.

mcandre commented Aug 14, 2014

@unbornchikken Er, you may want to correct a typo in the petition: "Phyton 3".

@CamiloMM

This comment has been minimized.

CamiloMM commented Aug 14, 2014

@unbornchikken Is everything a petition nowadays...? Nevermind, signed.
watt-can-you-do-sign-the-petition

@mcandre Well, that's because he's phyton for it.

@unbornchikken

This comment has been minimized.

unbornchikken commented Aug 15, 2014

typo fixed. never start a petition after midnight.

meme idea: i do petitions instead of PRs 😊

@TooTallNate

This comment has been minimized.

Contributor

TooTallNate commented Aug 15, 2014

I appreciate the sentiment, but I believe Google is going to be focusing their time on gn these days. They have plans to phase out gyp before the end of 2014. I'm looking for some time/motivation to write node-gn 😄

@unbornchikken

This comment has been minimized.

unbornchikken commented Aug 15, 2014

hm, should i start a new petition? 😊

i think it's maximum a couple days of work to update gyp scripts to p3, it can be done if they care. the problem is that v8 guys are thinking in v8 even today, but there is a mutch larger dependent platform to care, but they don't. i can understand, they got dollars for v8 not for node. maybe online activity like petitions will wake up their bosses, and give guys some days to patch shit up.

@unbornchikken

This comment has been minimized.

unbornchikken commented Aug 15, 2014

For motivation: start a repo, and put a Donate button in the readme. You will be suprised. ;)

@CamiloMM

This comment has been minimized.

CamiloMM commented Aug 15, 2014

@TooTallNate Then you'll just have to make massive pull requests for each package out there that uses node-gyp. No biggie :)

(On all honesty, I'm rooting for something better to come along).

@unbornchikken

This comment has been minimized.

unbornchikken commented May 4, 2015

coz da petition didnt help: https://github.com/unbornchikken/cmake-js

@untitaker

This comment has been minimized.

untitaker commented Jul 16, 2015

Please try to use env python2. The current version of node-gyp completely breaks on distributions that have their default Python binary set to Python 3.

@demurgos

This comment has been minimized.

demurgos commented Nov 29, 2015

Looks like they are working on it.

https://codereview.chromium.org/1454433002

@bendavis78

This comment has been minimized.

Contributor

bendavis78 commented May 9, 2016

Is there any reason why node-gyp can't autodetect the location of python2 and use that to run gyp?

@bnoordhuis

This comment has been minimized.

Member

bnoordhuis commented May 9, 2016

@bendavis78 It does, it looks for python2 first before falling back to python. On Windows, it also looks in well-known locations and consults the python launcher when available.

@mikemaccana

This comment has been minimized.

mikemaccana commented May 21, 2016

This just hit me too trying node on Windows for the first time (first time on Windows that is, have been using node since 0.6).

npm install node-gyp asked for Python, I installed the current version of Python. Then it complains about python 3.

@stochastic-thread

This comment has been minimized.

stochastic-thread commented Apr 23, 2017

this is so annoying

@refack

This comment has been minimized.

Member

refack commented Apr 23, 2017

You're all missing the point 😉
The real goal is to remove the dependency on python completely #960

@CamiloMM

This comment has been minimized.

CamiloMM commented Apr 23, 2017

@maxkoryukov

This comment has been minimized.

maxkoryukov commented Apr 23, 2017

@refack, we all missing the point? Lets look at things globally: #960 is about coding for tiny PYTHON interpreter in JAVASCRIPT ;)

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░▄▄███▄▄▄░▄▄██▄░░░░░░░
░░░░░░░░░██▀███████████████▀▀▄█░░░░░░
░░░░░░░░█▀▄▀▀▄██████████████▄░░█░░░░░
░░░░░░░█▀▀░▄██████████████▄█▀░░▀▄░░░░
░░░░░▄▀░░░▀▀▄████████████████▄░░░█░░░
░░░░░▀░░░░▄███▀░░███▄████░████░░░░▀▄░
░░░▄▀░░░░▄████░░▀▀░▀░░░░░░██░▀▄░░░░▀▄
░▄▀░░░░░▄▀▀██▀░░░░░▄░░▀▄░░██░░░▀▄░░░░
█░░░░░█▀░░░██▄░░░░░▀▀█▀░░░█░░░░░░█░░░
█░░░▄▀░░░░░░██░░░░░▀██▀░░█▀▄░░░░░░▀▀▀
▀▀▀▀░▄▄▄▄▄▄▀▀░█░░░░░░░░░▄█░░█▀▀▀▀▀█░░
░░░░█░░░▀▀░░░░░░▀▄░░░▄▄██░░░█░░░░░▀▄░
░░░░█░░░░░░░░░░░░█▄▀▀▀▀▀█░░░█░░░░░░█░
░░░░▀░░░░░░░░░░░░░▀░░░░▀░░░░▀░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

Of course, Node.JS is not the same as javascript.


Hmm, sign the petition is not a bad idea though))

@refack

This comment has been minimized.

Member

refack commented Apr 27, 2017

@maxkoryukov eventually https://github.com/indutny/gyp.js was written to run on node.js, with a port to C for bootstrapping https://github.com/indutny/dukgyp

willmore pushed a commit to salemove/docker-jenkins-agents that referenced this issue Jul 10, 2017

chris.willmore
Downgrade python to 2
node-gyp requires Python.

For more info:
nodejs/node-gyp#193
@er3456qi

This comment has been minimized.

er3456qi commented Sep 9, 2017

Hey, it is 2017 now, does node-gyp support python 3 ? NO!

@untitaker

This comment has been minimized.

untitaker commented Sep 9, 2017

@SatishMHiremath

This comment has been minimized.

SatishMHiremath commented Feb 17, 2018

I have faced and fixed this issue relates node-sass and python error.Try installing latest angular cli command with the steps below

Set the system variable path as well:
C:\Users\windowsusername\AppData\Roaming\npm

C:\Users\windowsusername\AppData\Roaming\npm\node_modules@angular\cli\bin;

C:\Program Files\nodejs;

Then start using angular cli command prompt using:
angular client project folder path>npm install -g @latest

angular client project folder path>npm install -g node-gyp

@fengerzh

This comment has been minimized.

fengerzh commented Mar 8, 2018

It's 2018, still Python 2. 😕

Of course we could install Windows 95, Windows XP, Windows 7, Windows 10 on one machine, but why?

Of course we could install Yosemite, Sierra, High Sierra on one machine, but why?

Of course we could install Python 2, Python 3 on one machine, but why?

I just want to install one copy of one version of Python on my machine, and it should be the newest one, which is Python 3, not the apparently deprecated Python 2.

@banrieen

This comment has been minimized.

banrieen commented Mar 10, 2018

npm install -g appium on win10 pro 64bit with Python3.6.3 and Python3.6.4 :

gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "C:\Python36", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (C:\Users\lizhen\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack at PythonFinder. (C:\Users\lizhen\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack at C:\Users\lizhen\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\lizhen\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\lizhen\AppData\Roaming\npm\node_modules\appium\node_modules\heapdump
gyp ERR! node -v v8.10.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules\appium\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: heapdump@0.3.9 (node_modules\appium\node_modules\heapdump):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: heapdump@0.3.9 install: node-gyp rebuild
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

From haraka/Haraka#1721 wzup tips:
This is what I did to solve the issue. From here https://github.com/nodejs/node-gyp

@dpotier

This comment has been minimized.

dpotier commented Mar 14, 2018

I was having this issue installing wdio-mocha-framework with npm and I noticed in the error logs node apparently has a flag to target which python. So if you have both python 2 and python 3 installed on your machine you can do:

npm install wdio-mocha-framework --save-dev --python=python2.7

And it works.

I get the point is that there shouldn't be this dependency in TYOOL 2018 but I thought I would leave this work around here since it would have helped me to see it.

Source: switching between python versions stackoverflow

@NetOperatorWibby

This comment has been minimized.

NetOperatorWibby commented Mar 24, 2018

Copied from another issue, in case this helps someone lurking in 2019 and this still isn't fixed

This assumes you're using ZSH and are on macOS.

xcode-select --install

brew install python@2
echo 'export PATH="/usr/local/opt/python@2/bin:$PATH"' >> ~/.zshrc
npm config set python python2.7
@mtobeiyf

This comment has been minimized.

mtobeiyf commented Mar 27, 2018

For Windows users:

$ npm install --global --production windows-build-tools

This will install windows build tools including python 2.7 and vs tools in your user directory. Then

$ npm config set python C:\Users\USERNAME\.windows-build-tools\python27\python.exe

or you may select your installed python 2.7
I tried setting env variables, didn't help. Use npm config solved it.

@Dian8

This comment has been minimized.

Dian8 commented Apr 14, 2018

So, after about 10 years gyp still does not support python3 ?

@joshas

This comment has been minimized.

joshas commented Apr 14, 2018

There are signals that gyp project might land Python 3 patches sometime: https://groups.google.com/forum/#!topic/gyp-developer/U66xtisrYRM . As far as I understand most of the work is done, both Python 2 and Python 3 are supported, but some tests are failing on Python 3.
With Python 2 EOL approaching, it would be about time to fix this issue. node-gyp is quite popular with still increasing download count and 422 dependent packages.

@aljones15

This comment has been minimized.

aljones15 commented Apr 29, 2018

hope they fix it soon most distros no longer ship with python 2 out of the box anymore. regularly running into build issues with node-gyp

@bricss

This comment has been minimized.

bricss commented Apr 29, 2018

I'm afraid that no one in long-term period of time is gonna fix it.
In 2016, GYP was abandoned and replaced with GN by Google in Chromium & V8 projects. So the best solutions may be to move towards GN in sync with Chromium team, or switched to use CMake instead.

@lolzcalvin

This comment has been minimized.

lolzcalvin commented May 18, 2018

@bricss many thanks for the CMake suggestion!

@reebr

This comment has been minimized.

reebr commented Nov 9, 2018

Still using Python 2?

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