nabijaczleweli / cargo-update

A cargo subcommand for checking and applying updates to installed executables
MIT License
1.25k stars 41 forks source link

error: could not find `atuin` in registry `crates-io` with version `=18.3.0` (through cargo-binstall) #269

Closed Abhinickz closed 3 months ago

Abhinickz commented 3 months ago
$ atuin --version
atuin 18.3.0

$ cargo install-update -l
    Polling registry 'https://index.crates.io/'....

Package         Installed  Latest   Needs update
atuin           v18.2.0    v18.3.0  Yes

I have manually updated the atuin package but cargo-update fails to recognize the updated package version and again tries to update when cargo install-update -a runs.

cargo install-update -a
    Polling registry 'https://index.crates.io/'....

Package         Installed  Latest   Needs update
atuin           v18.2.0    v18.3.0  Yes

Updating atuin
 INFO resolve: Resolving package: 'atuin'
 ...
NobodyXu commented 3 months ago

cargo-install and cargo-binstall tools uses .cargo/.crates.toml to maintain a list of installed software and their version, so if you haven't updated it then it would still think the old version is installed.

NobodyXu commented 3 months ago

BTW I don't see a better way, not every crate implements --version and there's no guarantee they can even run at all.

That's assuming you trust the crate, running installed binary from cargo-install-update or cargo-binstall is kind of terrible.

nabijaczleweli commented 3 months ago

What does "I have manually updated the atuin package" mean in this scenario?

Abhinickz commented 3 months ago

What does "I have manually updated the atuin package" mean in this scenario.

Downloaded the tar gz from here https://github.com/atuinsh/atuin/releases/tag/v18.3.0 and replaced the binary $HOME/.cargo/bin/atuin

since I was getting this error:

$ cargo install-update atuin
    Polling registry 'https://index.crates.io/'.

Package  Installed  Latest   Needs update
atuin    v18.2.0    v18.3.0  Yes

Updating atuin
 INFO resolve: Resolving package: 'atuin'
 WARN Failed to send quickinstall report for package atuin-18.3.0-aarch64-unknown-linux-musl: Failed to download from remote: could not HEAD https://warehouse-clerk-tmp.vercel.app/api/crate/atuin-18.3.0-aarch64-unknown-linux-musl.tar.gz: HTTP status client error (402 Payment Required) for url (https://warehouse-clerk-tmp.vercel.app/api/crate/atuin-18.3.0-aarch64-unknown-linux-musl.tar.gz)
 WARN The package atuin v18.3.0 will be installed from source (with cargo)
    Updating crates.io index
error: could not find `atuin` in registry `crates-io` with version `=18.3.0`
ERROR Cargo errored! ExitStatus(unix_wait_status(25856))
ERROR Fatal error:
  x For crate atuin: subprocess /usr/bin/cargo install atuin --version 18.3.0 --force --root /home/pi/.cargo errored with exit status: 101
  `-> subprocess /usr/bin/cargo install atuin --version 18.3.0 --force --root /home/pi/.cargo errored with exit status: 101

Updated 0 packages.
Failed to update atuin.
nabijaczleweli commented 3 months ago

Packages are uniquely recorded in ~/.crates.toml, your original operation just moved some files around.

When I run cargo install atuin --version 18.3.0 --force --root /home/nabijaczleweli/.cargo manually, that seems to work (or at least start working).

But that was run from the cargo-binstall upcall for you.

Does /usr/bin/cargo install --root ~/.cargo -f --version =18.3.0 --registry crates-io atuin (as would be run by cargo-update) work? Does /usr/bin/cargo install atuin?

From /usr/bin/cargo I'm assuming you're using a distribution Rust? If not (and it's from rustup or something), does the same thing but unadorned (cargo install ...) work?

NobodyXu commented 3 months ago

I think this might be a bug, we need to strip = before passing version requirements to cargo-install

Looking st the command, I think cargo-binstall pass the right version?

I think it might be an issue in cargo, in cargo-binstall we just use cargo, unless you defined the environment variable CARGO

https://github.com/cargo-bins/cargo-binstall/blob/b599493600b644395007f78a3dabaaac5af5a33e/crates/binstalk/src/ops/resolve/resolution.rs#L154

NobodyXu commented 3 months ago

opened an issue in cargo-bins/cargo-binstall#1891

nabijaczleweli commented 3 months ago

No, --version takes a version requirement (and also allows 1.2.3 as sugar for =1.2.3). This reads to me as either archive/connectivity desync, or cargo version mismatch. only the OP knows

Abhinickz commented 3 months ago

I think the previous error was due to some connectivity issue?

    Updating crates.io index
warning: spurious network error (2 tries remaining): http parser error: stream ended at an unexpected time; class=Http (34)
warning: spurious network error (1 tries remaining): http parser error: stream ended at an unexpected time; class=Http (34)
error: failed to fetch `https://github.com/rust-lang/crates.io-index`
$ cargo install-update atuin
    Polling registry 'https://index.crates.io/'.

Package  Installed  Latest   Needs update
atuin    v18.2.0    v18.3.0  Yes

Updating atuin
 INFO resolve: Resolving package: 'atuin'
 WARN Failed to send quickinstall report for package atuin-18.3.0-aarch64-unknown-linux-musl: Failed to download from remote: could not HEAD https://warehouse-clerk-tmp.vercel.app/api/crate/atuin-18.3.0-aarch64-unknown-linux-musl.tar.gz: HTTP status client error (402 Payment Required) for url (https://warehouse-clerk-tmp.vercel.app/api/crate/atuin-18.3.0-aarch64-unknown-linux-musl.tar.gz)
 WARN The package atuin v18.3.0 will be installed from source (with cargo)
    Updating crates.io index
  Installing atuin v18.3.0
error: failed to compile `atuin v18.3.0`, intermediate artifacts can be found at `/tmp/cargo-installsIScfS`

Caused by:
  failed to select a version for `env_logger`.
      ... required by package `atuin v18.3.0`
  versions that meet the requirements `^0.11.2` are: 0.11.5, 0.11.4, 0.11.3, 0.11.2

  the package `atuin` depends on `env_logger`, with features: `anstream` but `env_logger` does not have these features.
   It has an optional dependency with that name, but that dependency uses the "dep:" syntax in the features table, so it does not have an implicit feature with that name.

  failed to select a version for `env_logger` which could resolve this conflict
ERROR Cargo errored! ExitStatus(unix_wait_status(25856))
ERROR Fatal error:
  x For crate atuin: subprocess /usr/bin/cargo install atuin --version 18.3.0 --force --root /home/pi/.cargo errored with exit status: 101
  `-> subprocess /usr/bin/cargo install atuin --version 18.3.0 --force --root /home/pi/.cargo errored with exit status: 101

Updated 0 packages.
Failed to update atuin.
$ /usr/bin/cargo install atuin --version 18.3.0 --force --root /home/pi/.cargo
    Updating crates.io index
  Installing atuin v18.3.0
error: failed to compile `atuin v18.3.0`, intermediate artifacts can be found at `/tmp/cargo-installyLxC2G`

Caused by:
  failed to select a version for `env_logger`.
      ... required by package `atuin v18.3.0`
  versions that meet the requirements `^0.11.2` are: 0.11.5, 0.11.4, 0.11.3, 0.11.2

  the package `atuin` depends on `env_logger`, with features: `anstream` but `env_logger` does not have these features.
   It has an optional dependency with that name, but that dependency uses the "dep:" syntax in the features table, so it does not have an implicit feature with that name.

  failed to select a version for `env_logger` which could resolve this conflict
$ /usr/bin/cargo install atuin
    Updating crates.io index
warning: spurious network error (2 tries remaining): http parser error: stream ended at an unexpected time; class=Http (34)
  Downloaded atuin v18.3.0
  Downloaded 1 crate (94.9 KB) in 0.37s
  Installing atuin v18.3.0
error: failed to compile `atuin v18.3.0`, intermediate artifacts can be found at `/tmp/cargo-installsbn91b`

Caused by:
  failed to select a version for `env_logger`.
      ... required by package `atuin v18.3.0`
  versions that meet the requirements `^0.11.2` are: 0.11.5, 0.11.4, 0.11.3, 0.11.2

  the package `atuin` depends on `env_logger`, with features: `anstream` but `env_logger` does not have these features.
   It has an optional dependency with that name, but that dependency uses the "dep:" syntax in the features table, so it does not have an implicit feature with that name.

  failed to select a version for `env_logger` which could resolve this conflict

Packages are uniquely recorded in ~/.crates.toml, your original operation just moved some files around.

So one needs to update the updated version in ~/.crates.toml after the manual update?

NobodyXu commented 3 months ago

which cargo version are you using?

I think it's too old.

So one needs to update the updated version in ~/.crates.toml after the manual update?

Yes

Abhinickz commented 3 months ago

which cargo version are you using? I think it's too old.

Yes, Debian 12 distribution rust version.

$ cargo --version
cargo 1.65.0
$ rustc --version
rustc 1.63.0

So one needs to update the updated version in ~/.crates.toml after the manual update?

Yes

Thanks, Please close this issue.