Cargo not retrieving latest version from crates.io

I am totally baffled to why cargo fails to retrieve latest crate version that is advertised on crates.io.

Cargo.toml has these lines:
[dependencies]
icu = "0.6.0"
icu_provider_fs = "0.6.0"
icu_provider = "0.6.0"
icu_uniset = "0.6.0"
icu_segmenter = "0.6.0"

The version is taken directly from crates.io website.

Getting this error when trying to build: cargo build

error: failed to select a version for the requirement icu_provider = "^0.6.0"
candidate versions found which didn't match: 0.5.0, 0.4.0, 0.3.0, ...
location searched: crates.io index

Using the command: cargo search icu_provider
icu_provider = "0.6.0" # Trait and struct ....
icu_segmenter = "0.6.0" # Unicode line breaking ....
...

Why is cargo unable to get the latest version from crates.io, which is 0.6.0?

Hi,

I can pull icu_provider without error.
It isn't visible on crates.io, but icu_provider bumped its constraint on the rust edition in 0.6.0 (from 2018 to 2021 - icu4x/Cargo.toml at main · unicode-org/icu4x · GitHub), is your version of rust up to date ?

3 Likes

My Rust edition is 2021, though the version was 1.56.0. Ran rustup to update to latest version which is now 1.61.0.

Running cargo build I still get the same error of not finding version 0.6.0 from crates.io.

I even deleted ~/.cargo/registry to start with clean slate, and still get the same error.

I deleted

~/.cargo/registry

Edit

Cargo.toml

and commented out all except

icu = "0.6.0"

Ran

cargo fetch

Successfully retrieved index without error all the dependents for

icu v0.6.0

and included

icu_provider v0.6.0
icu_uniset v0.5.0

I then tried uncommented these crates that are not included in icu crate:

icu_provider_fs = "0.6.0"
icu_segmenter = "0.6.0"

and successfully fetched the index and the crates.

I noticed I had in Cargo.toml version 0.6.0 for icu_uniset instead of 0.5.0, which I suspect was the cause of the error, where cargo is reporting the error for the wrong crate icu_provider (which was at correct version of 0.6.0) instead of the error causing crate icu_uniset.

Thus one needs to be aware that the error reported for a crate can be actually for another crate than that is given in the error. Wasted 6 hours trying to solve error for icu_provider when it was not at fault, due to wrong crate was given in error message.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.