Skip to content
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

when rustup finds an existing rust install it doesn't give the user any hints about what to do next #3679

Open
davidbuzz opened this issue Feb 21, 2024 · 4 comments
Milestone

Comments

@davidbuzz
Copy link

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

@rami3l
Copy link
Member

rami3l commented 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 original cargo, etc.

That's exactly the meaning of the phrase

It is recommended that rustup be the primary Rust installation. Otherwise you may have confusion unless you are careful with your PATH.

I would be happy to accept potential wording improvements based on this point :)

@davidbuzz
Copy link
Author

davidbuzz commented 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
Copy link
Author

.. and why does it matter? ... because 'rustup' binary is not provided in the older/bundled build.

@rami3l
Copy link
Member

rami3l commented Feb 22, 2024

.. and why does it matter? ... because 'rustup' binary is not provided in the older/bundled build.

Thanks! I get your point. However, apart from having installed rust from the system package manager, this error can also occur when you run rustup-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.

@rami3l rami3l added this to the 1.28.0 milestone Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants