-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
configure fails on linux for distributions using python 3 as default #9512
Comments
This also applies to Arch Linux on which |
That won't help. configure does |
Indeed, macOS has no As for gyp: There's https://bugs.chromium.org/p/gyp/issues/detail?id=36, but it's unlikely gyp will ever gain support for Python3 as it's pretty much a dead project from what I understand. |
There's a bunch of issues in the node-gyp repo that are similar to this. Unfortunately, the conclusion that @silverwind mentioned is likely what we can expect; upstream gyp won't get ported to python 3. |
manjaro is based on arch linux and it has python2 and python2.7 links |
I don't think so. The python interpreter will throw syntax errors before the script even gets a chance to run. The only way to work around that is to split off the main configure script into a separate script and leave only a loader stub that is legal python 2 + 3 but that seems like overcomplicating things when the python 2 prerequisite is listed in BUILDING.md. |
I think it should be possible to make the file parseable in Python 3 and print a error when For the |
Can you guys help me check my first PR on node. If there is any problems, let me know. |
A couple ideas:
(1) is certainly simpler. |
Αnother option is to special-case MacOS, doing something like:
|
So, this actually does't fix the problem:
There are a whole bunch of other python scripts in the tree that also hard-code the name of the python executable, so they'd all have to be run with python2, and it isn't entirely straightforward to do that short of patching the source tree, since they aren't invoked directly by the user. Here's a list:
The Archlinux PKGBUILD just applies a sed command to the whole source tree: https://git.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/nodejs#n27 I agree the solution I proposed isn't pretty, and I wouldn't want to apply it to many files. It also looks like a lot of these are in dependencies that node pulls in in-tree? Probably don't want to be patching those. This probably ought to be re-opened, since the problem persists. I don't have another solution immediately popping into my head, but will think on the matter. |
@zenhack: only a small fraction of those files are used in build. The problem is still that python3 default installs (or python3 itself) is supported, so I think that operating systems/package managers that runs python3 as default (kudos btw) are better off handling the issue. |
If |
@gibfahn, I think that would do the right thing. Re: having systems handle the issue, I really don't think that's the right place in the stack to fix this. Arch right now has to patch a really excessive number of packages because of this kind of thing, and any other system that wants to default to python 3 will have to do the same. Doing it upstream seems much more sustainable. |
(The most elegant solution would be to write portable python, but that's a bit more work from where we are now -- though it's not hard when writing new code). |
What distribution is that that doesn't provide a |
@silverwind I think the problem is that if |
Quoting Gibson Fahnestock (2016-11-30 17:34:41)
@silverwind I think the problem is that if python points to Python
3, then even if you run the main configure file with ./python2
configure, when subshells are spawned with the #!/usr/bin/env python,
then they end up still running with python3, which doesn't work.
Exactly. On Archlinux, /usr/bin/python is python 3. Putting something
that points to python 2 ahead of it in $PATH would do the trick.
|
For future reference, here's how I got it to work on Manjaro (~Arch): mkdir /home/gcg/python2
ln -s /usr/bin/python2 /home/gcg/python2/python Then I run tests with PATH=/home/gcg/python2:$PATH make -j4 test (credits go to @zenhack) |
@gunar: try |
@jbergstroem maybe we should add this info on the error print? Line 5 in 76ba3bf
|
@silverwind sounds good to me! |
@jbergstroem your method did not work :-(
But thanks! |
Hmm, where's this https://docs.python.org/3.7/using/cmdline.html#environment-variables |
Sorry; its used in |
So we need to suggest |
No; passing |
Alright, so |
Nevermind, I see |
EDIT: I had a problem but when I updated to the latest 8.7.0 code it works. |
So this was implemented in #16058, so this should now finally work without having to set |
Currently the configure script executes via "python", this works perfectly fine on systems that use python 2.x as their default python but it fails on systems that use python 3.x. Would it be possible/feasible to adjust it to execute via "python2" instead of "python"? Alternatively an updated configure script that works on 2.x and 3.x python would be good.
Python 3 error when trying to run configure:

Is there possibly just a missing module for python3?
The text was updated successfully, but these errors were encountered: