-
Notifications
You must be signed in to change notification settings - Fork 12.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
Rust doesn't build without "python" name being available #71818
Comments
Or if the scripts have been python3-ready, it should probably instead point to |
I guess mistakenly, when landing the python 3 preparation patch I assumed that python would be symlinked to the preferred python installation on most systems, but it seems like that's not proven out in practice. Do we have some sense whether there is some executable we can put in the x.py script shebang which would mostly just work on most systems? If python3 will do the trick, I'm down for approving a PR switching us over to that. |
I'm fairly sure that calling |
@mati865 Do you mean in general? Or specifically to fix it not working in the common case? I agree that doing so fixes the bug but I'm not clear on whether that's the right approach. It's surprising to me that we're forced to recommend python3 over python2.7, basically. |
@Mark-Simulacrum For what it's worth, python2.7 has been deprecated since January 1st, 2020. So I would argue that it's fine to recommend python3 over python2.7 now. |
@Mark-Simulacrum in this specific issue AFAIK user can choose which Python to use by calling |
@iago-lito Yes, I'm aware, but I believe that many distros still ship and use python 2. I think x.sh seems like overdoing it, and I do want the common case to work. With that in mind, I'll file a PR later today switching to python 3 as the default (though we will continue to support python 2.7). |
Python 2 was supposed to be sunset on 2015 (as announced in 2008), but people still supporting it led to it being extended to 2020. I don't think it's a good idea to support it any further, is there any reason to do so? |
This is not the place to discuss it -- if you want further details than this comment, please ask on Zulip etc. But I personally do not believe that it is Rust compiler's build systems place to force people to upgrade unrelated software; the intent of the build system is to work as well as it can on as wide a range of base systems as possible, including those that only have python 2. Filed #71841 for the fix to this issue. |
That PR got closed, if I understood correctly due to Windows compatibility issues. Looks like there is no python binary name that actually works across platforms anymore? Windows doesn't have |
@RalfJung maybe we should file this to python X) |
I think #75034 is a duplicate of this. |
There is now a tool called |
This change adds pre-setup instructions that outline how x.py requires python to be setup and how to work around the problem of x.py failing to locate python, especially now that Ubuntu 20.04's dropped default python command is causing people to encounter this issue regularly. See also: rust-lang#71818
…tions, r=Mark-Simulacrum Add x.py pre-setup instructions This change adds pre-setup instructions that outline how x.py requires python to be setup and how to work around the problem of x.py failing to locate python, especially now that Ubuntu 20.04's dropped default python command is causing people to encounter this issue regularly. See also: rust-lang#71818
I've updated README.md to explicitly detail that users need a |
Such a script would be ideal, except using |
To be precise, it may have So to sum up the three standard options are:
|
@ChrisDenton does that mean that " |
@jyn514 Ah, |
(hoisting from the other issue, closed in favor of this one) macOS Monterey 12.3 was released today. The release notes include:
The
On macOS Monterey 12.3, running
It would probably be the time to make the script require Python 3, with
This means that in addition to various linux distributions, macOS joins the club of It was also mentioned that the main reason for not having changed to While it is possible to work around this (e.g. by editing the local x.py script to mention Considering this issue has been open since 2020, what are the possible actions / next steps we could take to fix this properly for everyone? |
|
I think the likely immediate next step if someone would like to make progress on this is to do a survey across at least tier-1 platforms (macOS, Windows, Linux, in no particular order), with likely some more variants of each (by install method, etc) in terms of the likely binaries available in a common PATH, and ease of getting other binaries/symlinks (e.g., python-is-python3 and similar packages). A comment with that information would let us make an informed decision as to:
To be clear, this is not really about python 2 vs. python 3; we support both and I don't expect that to change in the immediate future. My recollection (but hard data would be good) is that just picking a python version is insufficient to guarantee a particular executable names availability, so I don't think making any choices there actually would help us. If it would, that's fine too. (Edit: Yes, in the long run #94829 is likely at least a start to the future, though I'm not sure we'll ever fully drop x.py -- or some similar tooling.) |
Hoisting from Zulip:
On my Windows 11 machine, if i run After I click the Get button to install it, in both Powershell and CMD, running After the installation, if I write a small file #!/usr/bin/env python3
import time
print("Hello, world")
time.sleep(5) and run So at least on windows 11 with the python3 installed directly from windows store (as it automatically suggests if you try to run python3) the shebang of I then uninstalled the version from the Windows Store, and installed using the newest installer from https://www.python.org/downloads/release/python-3102/ . I installed with the default options, without selecting the "add python 3.10 to PATH" option, as it was unselected by default. Even with this installation, running the abovementioned It has also been mentioned that some people use the 4.8.2. Shebang Lines Note especially: "Any of the above virtual commands can be suffixed with an explicit version (either just the major version, or the major and minor version)" I tried using this wrapper too, and I get the same behavior: Based on this, it looks to me like the shebang of I would be more than happy to create a tiny PR for this, if allowed! |
This circumvents an issue on newer OSes (including now macOS Monterery): rust-lang/rust#71818 Thanks to jyn514 for suggesting this fix.
I've proposed a possible solution in #98474. Please take a look. |
x.py: Support systems with only `python3` not `python` Fixes rust-lang#71818 without the pitfalls so far described in previous attempts.
Since Ubuntu 20.04, the name
python
no longer available by default withoutpython-is-python2
package being installed. The build scripts should point topython2
instead.The text was updated successfully, but these errors were encountered: