zellij icon indicating copy to clipboard operation
zellij copied to clipboard

Error installing 0.31.0 with cargo install

Open cognitivegears opened this issue 2 years ago • 12 comments

Thank you for taking the time to file this issue! Please follow the instructions and fill in the missing parts below the instructions, if it is meaningful. Try to be brief and concise.

Basic information

zellij --version: n/a not installed, trying to install zellij v0.31.0 stty size: 55 72 uname -av or ver(Windows): Linux pop-os 5.17.15-76051715-generic #202206141358~1655919116~22.04~1db9e34 SMP PREEMPT Wed Jun 22 19 x86_64 x86_64 x86_64 GNU/Linux

List of programs you interact with as, PROGRAM --version: output cropped meaningful, for example: nvim --version: NVIM v0.5.0-dev+1299-g1c2e504d5 (used the appimage release) alacritty --version: alacritty 0.7.2 (5ac8060b)

alacritty 0.10.1-rc1

Further information Reproduction steps, noticeable behavior, related issues, etc

Running cargo install received the following error:

error: couldn't read /home/cognitivegears/.cargo/registry/src/github.com-1ecc6299db9ec823/termwiz-0.16.0/src/tmux_cc/tmux_cc/tmux.pest: No such file or directory (os error 2)
  --> /home/cognitivegears/.cargo/registry/src/github.com-1ecc6299db9ec823/termwiz-0.16.0/src/tmux_cc/mod.rs:12:14
   |
12 |     #[derive(Parser)]
   |              ^^^^^^
   |
   = note: this error originates in the macro `include_str` (in Nightly builds, run with -Z macro-backtrace for more info)

Although this looks like an error in termwiz, reporting here too in case a different version is needed, etc.

cognitivegears avatar Jul 29 '22 14:07 cognitivegears

@cognitivegears, Thank you for the report, do you mind running rustc --version and cargo --version and then reporting its output?

a-kenji avatar Jul 29 '22 14:07 a-kenji

Sure thing, thanks!

rustc --version:

rustc 1.61.0 (fe5b13d68 2022-05-18)

cargo --version:

cargo 1.61.0 (a028ae4 2022-04-29)

As a side note, cargo-binstall did install zellij fine. Also, I had also installed a previous version of zellij (sorry, don't remember which version now) with cargo install successfully, this was an upgrade.

cognitivegears avatar Jul 29 '22 14:07 cognitivegears

Also, just to try it, since I was a little out of date I tried updating rustc and cargo to the latest, but I'm still getting the same issue when trying to run cargo install. Now I have: rustc --version:

rustc 1.62.1 (e092d0b6b 2022-07-16)

cargo --version:

cargo 1.62.1 (a748cf5a3 2022-06-08)

cognitivegears avatar Jul 29 '22 15:07 cognitivegears

I'm also hitting this exact error, it's due to a version specification in the dependencies you can fix it with cargo install --fixed zellij

jscarrott avatar Jul 29 '22 15:07 jscarrott

I'm also hitting this exact error, it's due to a version specification in the dependencies you can fix it with cargo install --fixed zellij

@jscarrott - thanks for mentioning this! Could you say more about this or maybe link to some place where I can read more about it?

imsnif avatar Jul 29 '22 15:07 imsnif

So in a dependency specification somewhere there is a version specification that matches more than one version of the dependency. i.e. "foo = 1.0" matches 1.0.x. Normally when you run a cargo build a concrete version is decided once and written into your cargo.lock file. Cargo install by default doesn't use the lock file and so will resolve the dependency version again which can select a new version which in this case is broken. Building with cargo install --fixed just uses the lock file committed into the repository.

I am a little too busy at the moment to work out exactly which dependency is causing the issue.

You can reproduce this by just deleting the lock file in the repo before running a build.

jscarrott avatar Jul 29 '22 15:07 jscarrott

Just a quick note - I believe the option to cargo may be --locked, at least on my system. I can confirm that this command worked for me:

cargo install --locked --force zellij

(the --force was needed because I had previously used cargo-binstall to install zellij)

cognitivegears avatar Jul 29 '22 15:07 cognitivegears

Here is some more discussion on cargo install's default behaviour:

https://github.com/rust-lang/cargo/issues/7169

a-kenji avatar Jul 29 '22 15:07 a-kenji

Some other projects are recommending by default to install through cargo install --locked, instead of cargo install, should we recommend that as well?

a-kenji avatar Jul 29 '22 15:07 a-kenji

Holy cow. I definitely did not know this. I'm honestly a little bit surprised we're just hitting this issue now. Yes @a-kenji - I agree. We should definitely recommend it.

imsnif avatar Jul 29 '22 15:07 imsnif

Holy cow. I definitely did not know this. I'm honestly a little bit surprised we're just hitting this issue now. Yes @a-kenji - I agree. We should definitely recommend it.

Agreed, I am also quite surprised!

a-kenji avatar Jul 29 '22 16:07 a-kenji

Ah yeah it is indeed --locked that was me somehow transcribing what I had just typed wrong

jscarrott avatar Jul 29 '22 16:07 jscarrott

Seems there's a fix for this issue, closing it.

har7an avatar Oct 25 '22 14:10 har7an