-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 #1337
Comments
Historically the blocker to this has been the gyp dependency and normally changes should be upstreamed there unless we're planning on forking gyp in which case we would want our own gyp project so that we can share the changes with the main Node.js project. cc @nodejs/gyp |
I cannot successfully install Angular on my mac. I keep getting gyp error and when I look at gyp-mac-tool it says: I have had python 3 installed forever and do not want python 2 as it can cause havoc to have both installed as they are not compatible with one another. If this is the reason for my inability to use Angular, what should I do? |
On your Mac, what happens when you do:
I would highly recommend Homebrew as essential if you are doing real development on a Mac. Brew allows you to easily install both Python 2 and Python3 with: brew install python python@2 |
A few Python 2 issues on gyp: $ python2 -m flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
|
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\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 node-gyp |
It's a bit embraced that the original gyp project relies on python 2, and after couple of years, the patch is getting too big so that no people is dare to review and merge it. Need to give the gyp community more feedback to move this forward. |
Is there any interest in this? Python 2 is starting to get removed from distributions at this point. |
Correct e.g. The following just worked for me as I already had a
However, if you don't have a brew install python@2
# follow the instructions printed after installing `python@2` to get python 2 on your PATH
# e.g. echo 'export PATH="/usr/local/opt/python@2/bin:$PATH"' >> ~/.bashrc
npm config set python python2.7 |
Tim's method should go in the README. I use ZSH and there was a message mentioned Xcode when I installed Python 2 so my process was as follows: 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 some reason, |
What does python2.7 --version return on your machine? |
|
Here is the full error
Here is my config
Hmm, I'm sure I also had |
That's odd, maybe it's a bug in
Even thought I set it, it's not changed in the config!? |
@ioquatix what does "apm config get" show?
|
|
It's one thing to retain support for Python 2 (though many projects are dropping it altogether). It's another thing entirely to _not _ support Python 3. Please consider this. Python 3 is a decade old, after all... 😄 |
star this https://bugs.chromium.org/p/gyp/issues/detail?id=36 to help resolve this issue |
starred, not sure why 10 years have passed and we are still dealing with this! |
GYP is dead. Google moved on to GN. |
What is GN? |
Yea but this thread https://groups.google.com/forum/#!topic/gyp-developer/U66xtisrYRM says it's just a matter of Dirk landing and reviewing the patch. |
My question is this: why can't we just fork gyp and add the patch and go with that? |
There is no reason why not. That is the way of open source. If no maintainer steps forward with a cogent plan that fits your needs, you can always hit the fork button. |
Perhaps @refack can help to keep things progressing on this repo. |
It is doable. The issue will be more about visibility. More than 4 million install events in a year through homebrew will mean that we need to communicate to all these people about the node removal from homebrew-core, and give instructions on how to tap the new node tap. All the install scripts from the whole industry will probably need an updated too. There will be no automatic redirection to an external tap. I do not want to pollute this thread more with homebrew discussions though. We are not the only ones to ship node, so the issue is more global than this. Not sure this issue is the best place to discuss all this. We have not taken any decision right now, my initial message was more a gentle nudge to warn you that bigger changes may come :) |
Indeed, it's much more global than this. There has been discussion on removing python2 from openSUSE Tumbleweed distribution at beginning of next year. For those that don't know, Tumbleweed is the rolling release distribution of openSUSE project. https://lists.opensuse.org/opensuse-factory/2019-04/msg00229.html
|
Is this in progress? |
@mingrammer #1723 (comment) lists some current Python 3 incompatibilities if you have some time to work on this. We also created GYP3 nodejs/node#26620 |
Would it be possible to edit the opening post in this thread with a general summary of the situation with regards to the move to Python 3 due to the Python 2 EOL and drop from Brew/macOS/Linux distros? It'd be great if that could then be kept up to date so the average user can easily see an overview of the current situation and the plan going forward :) |
Closing this PR as GYP seems to be Python 3 compatible:
If you find any Python 3 incompatibles in this code, please open an issue. NOTE: nodejs/node is not yet compatible with Python 3 but an effort is ongoing there. |
Thanks! this resolves my issues |
I'm using Node.js v 12.18.2 and Python v3.8.1 on windows 10 and when I tried to run
|
Please upgrade node-gyp to v7 https://github.com/nodejs/node-gyp/releases |
@slim-hmidi If you want to use Python 3 you'll have to take up with node-sass as they're still depending on node-gyp ^3.8.0: https://github.com/sass/node-sass/blob/e1fc1580c2e979113c95850b8ae5d83845063ca5/package.json#L67 node-gyp added Python 3 support in the 5.x and later releases. |
@richardlau I installed python v2.7.16 but still the same problem. |
If you have the same problem it means that node-gyp is still trying to use Python 3. Maybe try setting the |
I uninstalled python 3 and python 2.7.16 and I'm reinstalling python 2.7.16 again and I will try again. |
@richardlau it works now. thanks |
See
#1150,#1335,#1336, andhttps://travis-ci.com/nodejs/node/builds/79706150(nodejs/node#21942)Verbose output (from npm or node-gyp):
The text was updated successfully, but these errors were encountered: