Open
Description
Problem you are trying to solve
have an app that I'm building that gives instructions to "install rust", and links to the rustup site.
I ran this as instructed:
curl https://sh.rustup.rs -sSf | sh
info: downloading installer
warning: it looks like you have an existing installation of Rust at:
warning: /usr/bin
warning: It is recommended that rustup be the primary Rust installation.
warning: Otherwise you may have confusion unless you are careful with your PATH
warning: If you are sure that you want both rustup and your already installed Rust
warning: then please reply `y' or `yes' or set RUSTUP_INIT_SKIP_PATH_CHECK to yes
warning: or pass `-y' to ignore all ignorable checks.
error: cannot install while Rust is installed
rustup's idea of what rust is, not installed, because of "some other" rust and no idea how to fix that above error.
Solution you'd like
I wanted it to install rust using rustup
after 10 minutes of googling this came up:
https://www.reddit.com/r/rust/comments/se7ecj/how_to_uninstall_rust_without_rustup/
rust-lang/rls#1399
#953
.. so its not just me..
solution:
emit this message instead:
"Would you like to uninstall the system-provided/older rust and use a newer one?" run 'sudo apt remove rustc' or similar for your platform
Notes
No response
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
rami3l commentedon Feb 22, 2024
@davidbuzz Thanks a lot for filing this issue!
No, it's not necessary for you to remove the system-provided Rust. Looking at the user guide you can see that it's possible for those Rust installations to coexist (and for Rustup to adopt the system toolchain), but the PATH must be modified in such a way that Rustup's
cargo
shim precedes the originalcargo
, etc.That's exactly the meaning of the phrase
I would be happy to accept potential wording improvements based on this point :)
davidbuzz commentedon Feb 22, 2024
'You appear to have a rust installed with your package-manager. Usually there's no need for two versions of rust, but the one we're about to install is almost certainly newer.. More details about co-existing in the user-guide at https://rust-lang.github.io/rustup/installation/already-installed-rust.html
Would you like us to first remove the older one first? Y/n"
[If they say 'n', maybe point out the directories of both, and which one is first-in-their-path right now]
davidbuzz commentedon Feb 22, 2024
.. and why does it matter? ... because 'rustup' binary is not provided in the older/bundled build.
rami3l commentedon Feb 22, 2024
Thanks! I get your point. However, apart from having installed
rust
from the system package manager, this error can also occur when you runrustup-init
and you already have an existing Rustup installation, whether via the system package manager or via a manual installation. From Rustup's point of view we should give general directions instead of directly helping the user out, but indeed it would be nice if we can point out several common possibilities.lgimberis commentedon Nov 21, 2024
Still a problem. Personally, I just had to
apt remove rustc
.The function that must be true for this error to be printed is named
rustc_or_cargo_exists_in_path
. A message that explicitly reflects this (thatrustc
and/orcargo
being on PATH is causing the problem) would be more actionable and helpful than hearing "because rust is installed", asrust
is not a program and cannot be uninstalled.