Skip to content

Dependency conflict with rquest due to async-compression and xz2 linking to lzma #15342

Closed

Description

@0xlearner

Describe the bug

Description

When using rquest with datafusion, a dependency conflict occurs because both crates depend on libraries that link to the native lzma library.

Steps to Reproduce

  1. Create a new Rust project:
    cargo new reproduce_conflict
    cd reproduce_conflict
  2. Cargo.toml:
    [package]
    name = "reproduce_conflict"
    version = "0.1.0"
    edition = "2024"
    
    [dependencies]
    rquest = { version = "3.0.5", features = ["full"] }
    datafusion = "46.0.1"
    
  3. Run cargo run

Actual Behavior:

error: failed to select a version for `xz2`.
    ... required by package `datafusion v46.0.1`
    ... which satisfies dependency `datafusion = "^46.0.1"` of package `reproduce_conflict v0.1.0 (/path/to/reproduce_conflict)`
versions that meet the requirements `^0.1` are: 0.1.7, 0.1.6, 0.1.5, 0.1.4, 0.1.3, 0.1.2, 0.1.1, 0.1.0

the package `xz2` links to the native library `lzma`, but it conflicts with a previous package which links to `lzma` as well:
package `datafusion-datasource v46.0.1`
    ... which satisfies dependency `datafusion-datasource = "^46.0.1"` of package `datafusion v46.0.1`
    ... which satisfies dependency `datafusion = "^46.0.1"` of package `reproduce_conflict v0.1.0 (/path/to/reproduce_conflict)`
Only one package in the dependency graph may specify the same links value. This helps ensure that only one copy of a native library is linked in the final binary. Try to adjust your dependencies so that only one package uses the `links = "lzma"` value. For more information, see https://doc.rust-lang.org/cargo/reference/resolver.html#links.

the package `datafusion` depends on `xz2`, with features: `static` but `xz2` does not have these features.

all possible versions conflict with previously selected packages.

  previously selected package `async-compression v0.4.21`
    ... which satisfies dependency `async-compression = "^0.4.20"` of package `rquest v3.0.5`
    ... which satisfies dependency `rquest = "^3.0.5"` of package `reproduce_conflict v0.1.0 (/path/to/reproduce_conflict)`

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

Is there any way to resolve this conflict to build this successfully?

Activity

  1. added
    bug
    on Mar 20, 2025
  2. alamb commented on Mar 21, 2025

    @alamb
    Contributor

    I wonder if you can turn off the compression feature in datafusion

    like default-features = false

  3. 0x676e67 commented on Mar 21, 2025

    @0x676e67

    I agree. If the default features aren’t needed, they can be disabled by turning off default-features. The dependency conflict arises because async-compression has updated its upstream xz dependency: Nullus157/async-compression@c174981.

  4. Omega359 commented on Mar 21, 2025

    @Omega359
    Contributor

    Would forcing df to use 0.4.19 (async-compression = { version = "=0.4.19") resolve this issue?

  5. findepi commented on Jul 21, 2025

    @findepi
    Member

    This is a result of a rift in the ecosystem. The xz2 crate has been forked and re-released under new name liblzma. The both have companion sys crates (lzma-sys and liblzma-sys respectively), which both define same static linking links = "lzma".
    While xz2 is not actively maintained, it's not considered abandoned by its maintainer -- alexcrichton/xz2-rs#128. On the other hand, last release was 3 years ago.

    Recently, the zip crate has migrated to the forked version (zip-rs/zip2#326), making it impossible to use datafusion and zip in one build. In particular, I became aware of this problem because of a dependency which transitively requires latest zip 0.4.3.

    All in all, not an awesome situation with no really good solution. I wish this fork didn't happen.
    I think we need to decide what to do with xz2 dependency that we ourselves define.
    It doesn't look like the problem will go away. It doesn't look like the carpet is big enough to cover all this.

  6. alamb commented on Jul 21, 2025

    @alamb
    Contributor

    Sounds like we should move to the non abandoned crate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions