matrix-org / rust-synapse-compress-state

A tool to compress some state in a Synapse instance's database
https://pypi.org/project/synapse-auto-compressor/
Apache License 2.0
142 stars 32 forks source link

error: failed to select a version for the requirement clap = "^4.0.15" #108

Closed Paule2020 closed 1 year ago

Paule2020 commented 1 year ago

Hi, I'm trying to cargo build using Ubuntu 20.04.5 and the following error occours when I enter cargo build - any ideas?

error: failed to select a version for the requirement clap = "^4.0.15" candidate versions found which didn't match: 3.2.23, 3.2.22, 3.2.21, ... location searched: crates.io index" appears

cargo update brings up the same error

I hope anyone has an idea to fix this. Best regards and thanks in advance Paule2020

DMRobertson commented 1 year ago

The latest release of clap is 4.0.18, from https://crates.io/crates/clap so that requirement should be fine.

I suggest you check your system to see if there is something preventing cargo from contacting crates.io. (are you using cargo build --offline? Is there some kind of proxy?)

Paule2020 commented 1 year ago

Hm, to be honest, I'm not an expert ;)

I tried to run cargo install cargo-crate and this wroks fine... However, it says : " Compiling clap v3.2.23" Trying to install "cargo install clap 4.0.18" brings up " Updating crates.io index Ignored package clap v3.2.23 is already installed, use --force to override error: could not find 4.0.18 in registry crates-io with version * Summary Successfully installed clap! Failed to install 4.0.18 (see error(s) above). warning: be sure to add /root/.cargo/bin to your PATH to be able to run the installed binaries error: some crates failed to install"

I also downloaded the clap.crate from github - can I install it manually? And no, I'm not using --offline

edit: I can ping crates.io using IPv6

DMRobertson commented 1 year ago

I also downloaded the clap.crate from github - can I install it manually?

Cargo should do this for you.

I suggest removing the clap crate and installing rather than building cargo with cargo install --git https://github.com/matrix-org/rust-synapse-compress-state.git.

Paule2020 commented 1 year ago

Thanks, However same error

cargo install --git https://github.com/matrix-org/rust-synapse-compress-state.git synapse_auto_compressor Updating git repository https://github.com/matrix-org/rust-synapse-compress-state.git Installing synapse_auto_compressor v0.1.3 (https://github.com/matrix-org/rust-synapse-compress-state.git#152808ba) Updating crates.io index error: failed to compile synapse_auto_compressor v0.1.3 (https://github.com/matrix-org/rust-synapse-compress-state.git#152808ba), intermediate artifacts can be found at /tmp/cargo-install4I0SoV

Caused by: failed to select a version for the requirement clap = "^4.0.15" candidate versions found which didn't match: 3.2.23, 3.2.22, 3.2.21, ... location searched: crates.io index required by package synapse_auto_compressor v0.1.3 (/root/.cargo/git/checkouts/rust-synapse-compress-state-ae456ad9d13e5abb/152808b/synapse_auto_compressor)

Paule2020 commented 1 year ago

Ah, I solved the problem... apt-get update &upgrade solved the problem....

DMRobertson commented 1 year ago

Odd. Perhaps Ubuntu has some kind of vendored version of rust libraries? Thanks for confirming, in any case.

Ruakij commented 1 year ago

I have the same issue here on Debian. Have tried update & upgrade to no avail.

I resorted to building and running it inside docker for now.

ZhenyaPav commented 1 year ago

@Ruakij Can you elaborate how you ran the docker image? I'm having the same issue right now with Debian.

Ruakij commented 1 year ago

@Ruakij Can you elaborate how you ran the docker image? I'm having the same issue right now with Debian.

I have just built the image from the Repository here.

You can just build it using docker build -t synapse-compress-state . And then run its commands using docker run synapse-compress-state synapse_auto_compressor ..

Of course you need to make sure it can connect to your postgres database, this depends on where you have that running. For on the host, --net host, for another container --net container:<container-id>. Add that to the docker-command like this docker run --net host synapse-compress-state synapse_auto_compressor ..