Support for Python 3
mcandre opened this issue ยท 60 comments
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.
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!).
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?
I've started a petition, you can sign it there: https://www.change.org/petitions/google-inc-upgrade-gyp-to-support-phyton-3
@unbornchikken Er, you may want to correct a typo in the petition: "Phyton 3".
@unbornchikken Is everything a petition nowadays...? Nevermind, signed.
@mcandre Well, that's because he's phyton for it.
typo fixed. never start a petition after midnight.
meme idea: i do petitions instead of PRs ๐
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
๐
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.
For motivation: start a repo, and put a Donate button in the readme. You will be suprised. ;)
@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).
coz da petition didnt help: https://github.com/unbornchikken/cmake-js
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.
Looks like they are working on it.
Is there any reason why node-gyp can't autodetect the location of python2 and use that to run gyp?
@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.
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.
this is so annoying
You're all missing the point ๐
The real goal is to remove the dependency on python completely #960
@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))
@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
Hey, it is 2017 now, does node-gyp support python 3 ? NO!
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
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.
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
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.
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
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.
So, after about 10 years gyp still does not support python3 ?
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.
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
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.
Still using Python 2?
When I unknowingly upgrade Node LTS, going from 8 to 10, and my node-sass
binding is unusable (again) and I want to rebuild node-sass
and get to the message that Python at some/existing/path/to/python.exe
doesn't exist (with "gyp:" line prefix)... which leads me here... I kinda lost the hope for node/npm ecosystem. How many languages and platforms do I actually need to build an Angular application? (Sure, I should watch my versions, but still...)
Hey so now that GYP is fixed. - https://bugs.chromium.org/p/gyp/issues/detail?id=36
When do we get this re-opened and fixed properly? @TooTallNate - (tagging you because you were the one that closed this originally.)
If we want to keep up with the future (not just updated python) should we just abandon node-gyp in favor of the suggestions from @bricss?
Related nodejs/build#1631 (comment) (general thoughts on python 2/3 pain).
For addon authors, CMake isn't a terrible idea, you should consider it at least. The way node-gyp is integrated into Node makes it convenient for fetching various variables about the build being compiled against, but this isn't strictly essential and if you can achieve it with a better supported tool then that might be a good idea.
At the moment we just don't have a good strategy for the future of GYP and our reliance on it. Maybe that'll come one day, but it's going to need some folks to propose and push something new.
It's 2019, still Python 2. ๐
some say they'll never update
With the rise of WASM do we really need to support native libraries in Node projects any longer
@mcandre I'm no WAsm expert but, as I understand it, WebAssembly modules are sandboxed in a way that many existing native modules could not function within. ๐
Furthermore, there is a large collection of existing native modules that would either need to be converted or else cease to be officially supported. ๐ฌ
It's 2019-5-19, still Python 2.
Wow, It's been six years.
Why not just ditch Python? Python sucks anyway. Let us ditch Python 2 and Python 3.
haha :( ๐ ๐
People still use python2... :( python2 should have been removed from universe earlier so we don't have to face this problem :/
What is the block here? There's a tool for AUTOMATED migration to Python 3: https://docs.python.org/2/library/2to3.html
It's part of the core Python library itself!
@devinbost Unfortunately, that tool only migrates some parts of the code. Some bigger breaking changes then still need to be fixed manually.
Hold your horses! It seems like something is afoot: 66ad305
@kumarharsh Now way ๐ค!
The Python 3 tests are currently run in allow_failures mode: https://travis-ci.com/nodejs/node-gyp
If we can get those test to be green and drop the allow_failures mode then we can ๐ ๐ ๐พ
Please review any Python pull requests and provide fixes for the failing tests if you can.
Finally after 6 years :)
and not a moment too soon.
Warning: Python 2 will be retired on 1st January 2020: https://pythonclock.org/
Time to shed Python 2 by UK The National Cyber Security Centre
kill py2
2024, still here.
The node.js OpenJS Foundation has explicitly chosen other priorities over this. Please voice you complaint to them.
https://projects.propublica.org/nonprofits/organizations/471491876/202313179349304446/full
A notable alternative is to use Go code rather than Python. Go dramatically reduces the need for native C/C++ code in the first place. And Go has builtin support for FFI via cgo.
Don't use interpreted programming languages that blow up in production on variable name typos at runtime in 2024.