Rust: Rust doesn't build without "python" name being available

Created on 3 May 2020  路  13Comments  路  Source: rust-lang/rust

Since Ubuntu 20.04, the name python no longer available by default without python-is-python2 package being installed. The build scripts should point to python2 instead.

A-contributor-roadblock A-rustbuild C-bug

Most helpful comment

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 https://github.com/rust-lang/rust/pull/71841 for the fix to this issue.

All 13 comments

Or if the scripts have been python3-ready, it should probably instead point to python3?

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 python3 x.py should work.

@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 python2 x.py or python3 x.py instead of ./x.py even if /usr/bin/python doesn't exist.
The only general solution I can think of is creating x.sh that will probe for available Python versions.

@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).

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 https://github.com/rust-lang/rust/pull/71841 for the fix to this issue.

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 python3 and some Linux distros don't have python? What a mess.

Looks like there is no python binary name that actually works across platforms anymore? Windows doesn't have python3 and some Linux distros don't have python? What a mess.

@RalfJung maybe we should file this to python X)

I think https://github.com/rust-lang/rust/issues/75034 is a duplicate of this.

There is now a tool called x which will find the appropriate version of python and run it: https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html#running-xpy-slightly-more-conveniently. Would that meet this use case?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cramertj picture cramertj  路  512Comments

nikomatsakis picture nikomatsakis  路  259Comments

nikomatsakis picture nikomatsakis  路  340Comments

nikomatsakis picture nikomatsakis  路  210Comments

nikomatsakis picture nikomatsakis  路  274Comments