You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
I cannot successfully install Angular on my mac. I keep getting gyp error and when I look at gyp-mac-tool it says:
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb which failed Error: not found: python2
gyp verb which failed at getNotFoundError (/Users/thackerfam/AngularProj/angular-cli/node_modules/which/which.js:13:12)
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?
Reacted by Nicolas Scozzaro, Shirshak and Maxwell Brown
./gyptest.py:61:47: F821 undefined name 'opts'
extra_path = [os.path.abspath(p) for p in opts.path] # <-- 'opts' should be changed to 'args'
^
./pylib/gyp/generator/make.py:1637:50: F821 undefined name 'target'
print "WARNING: no output for", self.type, target # <-- 'target' should be changes to 'self.target'
^
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.
Reacted by Dominik Schlösser, Samuel Williams, Dieter Devlieghere, Peter Horvath and Vico
Is there any interest in this? Python 2 is starting to get removed from distributions at this point.
Reacted by Antonio Romero, Tristan Dyer, Lukas Kollmer, Dominik Schlösser, Michael Keck, S. M. Mahmudul Haque, Samuel Williams, Christian Clauss, cocowalla, Souvik Sen and 30 more
Python 2 is starting to get removed from distributions at this point.
Correct e.g. brew is now installing/upgrading to Python 3 by default.
The following just worked for me as I already had a python2.7 executable installed via brew:
npm config set python python2.7
However, if you don't have a python2.7 executable, I suspect you can do something like:
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
Reacted by Chip Castle, Qian (Stanley) Xu, Jarrett Gliner, Robert Benjamin, Ronald, Abhishek Kannojia, Garrett Nay, Hideki Ashina, Antonio Romero, Thomas Loiret and 31 more
Reacted by Ricardo Malta, Albert Wang, Wouter Klijn, Shin Yang, Maxwell Brown, Archonic, José Salgado, Ziyang Zeng, Misha Behersky, Sundarreva and 1 more
Reacted by Anthony, Marcus Bergman, Sangguk Lee, superern, cartosys, Manav Kohli, José Salgado, Misha Behersky and ljubadr
For some reason, npm config set python python2.7 stopped working for me. Even after setting it, I get the error that node-gyp is trying to run python 3.6
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 :)
Python 2 is starting to get removed from distributions at this point.
Correct e.g. brew is now installing/upgrading to Python 3 by default.
The following just worked for me as I already had a python2.7 executable installed via brew:
npm config set python python2.7
However, if you don't have a python2.7 executable, I suspect you can do something like:
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
If you have the same problem it means that node-gyp is still trying to use Python 3. Maybe try setting the PYTHON environment variable to point to your installed Python 2?
Activity
richardlau commentedon Nov 14, 2017
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
mthacker801 commentedon Feb 8, 2018
I cannot successfully install Angular on my mac. I keep getting gyp error and when I look at gyp-mac-tool it says:
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb
whichfailed Error: not found: python2gyp verb
whichfailed at getNotFoundError (/Users/thackerfam/AngularProj/angular-cli/node_modules/which/which.js:13:12)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?
cclauss commentedon Feb 8, 2018
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
cclauss commentedon Feb 8, 2018
A few Python 2 issues on gyp:
$ python2 -m flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
SatishMHiremath commentedon 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
stanleyxu2005 commentedon Feb 26, 2018
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.
AdamMajer commentedon Mar 2, 2018
Is there any interest in this? Python 2 is starting to get removed from distributions at this point.
timoxley commentedon Mar 3, 2018
Correct e.g.
brewis now installing/upgrading to Python 3 by default.The following just worked for me as I already had a
python2.7executable installed viabrew:However, if you don't have a
python2.7executable, I suspect you can do something like:NetOpWibby commentedon Mar 24, 2018
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:
ioquatix commentedon May 4, 2018
For some reason,
npm config set python python2.7stopped working for me. Even after setting it, I get the error that node-gyp is trying to run python 3.6cclauss commentedon May 4, 2018
What does python2.7 --version return on your machine?
ioquatix commentedon May 4, 2018
ioquatix commentedon May 4, 2018
Here is the full error
Here is my config
Hmm, I'm sure I also had
apm config set python=python2.7. Maybe that's why it's not working.ioquatix commentedon May 4, 2018
That's odd, maybe it's a bug in
apm.Even thought I set it, it's not changed in the config!?
raininja commentedon May 7, 2018
@ioquatix what does "apm config get" show?
53 remaining items
cclauss commentedon Jun 5, 2019
@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
MattIPv4 commentedon Jul 6, 2019
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 :)
cclauss commentedon Jul 7, 2019
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.
superern commentedon Aug 3, 2019
Thanks! this resolves my issues
slim-hmidi commentedon Jul 1, 2020
I'm using Node.js v 12.18.2 and Python v3.8.1 on windows 10 and when I tried to run
npm installI got this error:cclauss commentedon Jul 1, 2020
Please upgrade node-gyp to v7 https://github.com/nodejs/node-gyp/releases
richardlau commentedon Jul 1, 2020
@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.
slim-hmidi commentedon Jul 1, 2020
@richardlau I installed python v2.7.16 but still the same problem.
richardlau commentedon Jul 1, 2020
If you have the same problem it means that node-gyp is still trying to use Python 3. Maybe try setting the
PYTHONenvironment variable to point to your installed Python 2?slim-hmidi commentedon Jul 1, 2020
I uninstalled python 3 and python 2.7.16 and I'm reinstalling python 2.7.16 again and I will try again.
slim-hmidi commentedon Jul 1, 2020
@richardlau it works now. thanks