hirosystems / clarinet

Write, test and deploy high-quality smart contracts to the Stacks blockchain and Bitcoin.
https://hiro.so/clarinet
GNU General Public License v3.0
307 stars 141 forks source link

Failed to select version for 'tokio' on `cargo install` #231

Closed whoabuddy closed 2 years ago

whoabuddy commented 2 years ago

I was upgrading to the latest version today (v0.24.0) with cargo install --path . --locked and received the following error:

  Installing clarinet v0.24.0 (/home/whoabuddy/Dev/stacks/clarinet)
    Updating crates.io index
error: failed to select a version for `tokio`.
    ... required by package `deno v1.11.0 (/home/whoabuddy/Dev/stacks/clarinet/vendor/deno/cli)`
    ... which is depended on by `clarinet v0.24.0 (/home/whoabuddy/Dev/stacks/clarinet)`
versions that meet the requirements `=1.8.1` are: 1.8.1

all possible versions conflict with previously selected packages.

  previously selected package `tokio v1.14.0`
    ... which is depended on by `clarinet v0.24.0 (/home/whoabuddy/Dev/stacks/clarinet)`

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

This was with clarinet 0.20.0 already installed, previously I've had no issue updating this way, is there an extra step I need to take?

obycode commented 2 years ago

Hi @whoabuddy. I haven't seen that before. Could you try a clean install and let me know if you still get this error?

cargo clean
cargo install --path . --locked
whoabuddy commented 2 years ago

Hi @obycode - tried that and still the same error. Looking at my rust/cargo versions installed I'm a little behind:

rustc 1.55.0 (c8dfcfe04 2021-09-06)
cargo 1.55.0 (32da73ab1 2021-08-23)

I'm updating those now and will try a clean install after then report back.

whoabuddy commented 2 years ago

With the latest versions I still saw the same error:

rustc 1.58.1 (db9d1b20b 2022-01-20)
cargo 1.58.0 (f01b232bc 2022-01-19)

Based on this article I tried the following:

rm -rf ~/.cargo/registry
cargo clean
cargo install --path . --locked

Unfortunately, I'm still running into a similar error:

  Installing clarinet v0.24.0 (/home/whoabuddy/Dev/stacks/clarinet)
    Updating crates.io index
error: failed to select a version for `tokio`.
    ... required by package `deno v1.11.0 (/home/whoabuddy/Dev/stacks/clarinet/vendor/deno/cli)`
    ... which satisfies path dependency `deno` (locked to 1.11.0) of package `clarinet v0.24.0 (/home/whoabuddy/Dev/stacks/clarinet)`
versions that meet the requirements `=1.8.1` are: 1.8.1

all possible versions conflict with previously selected packages.

  previously selected package `tokio v1.14.0`
    ... which satisfies dependency `tokio = "=1.14.0"` of package `clarinet v0.24.0 (/home/whoabuddy/Dev/stacks/clarinet)`

failed to select a version for `tokio` which could resolve this conflict
whoabuddy commented 2 years ago

Noting this from Cargo.lock which seems to be the offending line:

[[package]]
name = "tokio"
version = "1.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70e992e41e0d2fb9f755b37446f20900f64446ef54874f40a60c78f021ac6144"
dependencies = [
 "autocfg",
 "bytes",
 "libc",
 "memchr",
 "mio",
 "num_cpus",
 "once_cell",
 "parking_lot",
 "pin-project-lite",
 "signal-hook-registry",
 "tokio-macros",
 "winapi 0.3.9",
]

Also in Cargo.toml:

[dependencies]
...(truncated)...
tokio = { version = "=1.14.0", features = ["full"] }
whoabuddy commented 2 years ago

One last comment - I thought I'd try manually changing the value in Cargo.toml to match what it was asking for:

tokio = { version = "=1.8.1", features = ["full"] }

New version of the error, looks like the updated version requirement is also coming from clarity-repl v0.21.0:

  Installing clarinet v0.24.0 (/home/whoabuddy/Dev/stacks/clarinet)
    Updating crates.io index
error: failed to compile `clarinet v0.24.0 (/home/whoabuddy/Dev/stacks/clarinet)`, intermediate artifacts can be found at `/home/whoabuddy/Dev/stacks/clarinet/target`

Caused by:
  failed to select a version for `tokio`.
      ... required by package `clarity-repl v0.21.0`
      ... which satisfies dependency `clarity_repl = "=0.21.0"` of package `clarinet v0.24.0 (/home/whoabuddy/Dev/stacks/clarinet)`
  versions that meet the requirements `=1.14.0` are: 1.14.0

  all possible versions conflict with previously selected packages.

    previously selected package `tokio v1.8.1`
      ... which satisfies dependency `tokio = "=1.8.1"` of package `clarinet v0.24.0 (/home/whoabuddy/Dev/stacks/clarinet)`

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

Happy to test out any other ideas!

obycode commented 2 years ago

Ah, I see the problem now. Deno is a submodule of clarinet and needs to be updated separately. Try:

$ git submodule update

Verify that you now have the right version of the vendored deno:

$ git submodule status
 769ab635751e5a1de01af348a318eb97e185d4e5 vendor/deno (v1.10.3-127-g769ab635)

If that looks good, now you should be able to build and install:

cargo install --path . --locked
obycode commented 2 years ago

I opened PR #232 to document this.

whoabuddy commented 2 years ago

Quick follow-up on my side: I was unable to get the submodule to update with my current directory, so removed it and started again with cloning via the new instructions. The install was successful and everything is working as expected now, thank you!

Replaced package `clarinet v0.20.0 (/home/whoabuddy/Dev/stacks/clarinet)` with `clarinet v0.24.0 (/home/whoabuddy/Dev/stacks/clarinet)` (executable `clarinet`)
obycode commented 2 years ago

Thanks for the followup @whoabuddy. I'm glad that a new install worked, but I'm still curious about what went wrong. What kind of issue did you see when you were unable to update the submodule?

whoabuddy commented 2 years ago

I'm not sure what I did, sorry, should've grabbed the output but figured it was something with my configuration versus the repo itself.

From what I remember - the submodule folder was blank and using git submodule update --recursive didn't update it, so when trying to build I'd get an error about a missing .toml file in the vendor/deno directory.

blockstack-devops commented 2 years ago

:tada: This issue has been resolved in version 0.25.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

blockstack-devops commented 2 years ago

:tada: This issue has been resolved in version 0.28.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: