Reinstallation of rust does not work

I had some issues with the rust installation, so i tried fully reinstalling it. I ran rustup self uninstall and it was uninstalled, but rustup-init.exe still thinks it is installed, and does not let me install it again. How can i fix this problem?

Do the .rustup and .cargo directories in your home directory exist? If so try removing them.

The issue was that .rustup did not exist. .cargo was removed by rustup self uninstall.

edit your shell startup script, remove the environment variable RUSTUP_HOME if exists, then exit current shell then re-login and try again.

I am on windows, not linux.

oopsie, didn't pay attention you mentioned rustup-init.exe. anyway, the same principle applies, check if you have the RUSTUP_HOME environment variable set, if so, remove it (search "environment variable" in the search bar should show your the setting page or control panel, I don't remember exactly), then restart the operating system and try again.

It is not set, and i restarted the system since running the uninstallation command.

that is very strange. what's the exact error message you get?

no error, just the message you get saying that rustup is installed and how to uninstall it.

that just means your installation is successful. you can install your default toolchain if not already installed, and you are good to go.

for example, to install the stable toolchain and set as default:

rustup toolchain install stable
rustup default stable
cargo --version

no, it is not installed. windows does not find rust, .cargo does not exist, rustup-init.exe just thinks it is installed and wont let me install it again.

during the installation, there's a step asking you whether to modify PATH environment variable, make sure you selected yes. after the installation finished, you might need to close the shell and re-open it to load the modified PATH variable.

after that, you can manage toolchains using rustup command:

what is the output if you run the following commands?

rustup toolchain list
rustup toolchain install stable
rustup default stable

once the toolchain is installed, you should be able to use rust, you can run the following command to verify:

cargo --version

no you do not understand, it does not even say anything about rustup being installed when i run rustup-init.exe. just says it is already installed. .cargo does not exist.

I'm confused, can you copy and paste the whole message, or take a screenshot? you description is unclear to me.

also, did you try to open another shell and run the commands I mentioned above? did it show any messages at all?

Again, i use windows. Rustup is not found as .cargo and therefore .cargo\bin do not exist.

is that all? there should be prompt after that, right?

It sounds like you're running into this bug. EDIT: also this bug

That is the "welcome message" but it's getting truncated because of a bug.

IIRC, you can try tapping the enter key and the install should start.

1 Like

must be some junk left in the registry that's causing it.

find where rust is in the registry and maybe remove it bwfore attempting a reinstall again.

rustup only uses the Windows registry to add an uninstall link. It does not use this to detect if rustup is installed.

tried but it just closes the window