Orjson on alpine linux virtual enviroment

Hello, I’m trying to upgrade to latest home assistant core version but Orjson can’t be installed.
I’m using linux alpine 3.12 and python 3.10.

This is the output message:

Collecting orjson
  Using cached orjson-3.7.7.tar.gz (640 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: orjson
  Building wheel for orjson (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for orjson (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [49 lines of output]
      Running `maturin pep517 build-wheel -i /root/homeassistant3.10/bin/python3.10 --compatibility off`
      warning: unused manifest key: package.resolver
      warning: unused manifest key: package.rust-version
         Compiling target-lexicon v0.12.4
         Compiling autocfg v1.1.0
         Compiling once_cell v1.13.0
         Compiling serde v1.0.138
         Compiling libc v0.2.126
         Compiling cfg-if v1.0.0
         Compiling version_check v0.9.4
         Compiling encoding_rs v0.8.31
         Compiling serde_json v1.0.82
         Compiling ryu v1.0.10
         Compiling itoa v1.0.2
         Compiling simdutf8 v0.1.4
         Compiling associative-cache v1.0.1
         Compiling smallvec v1.9.0
         Compiling inlinable_string v0.1.15
         Compiling bytecount v0.6.3
      error: could not compile `smallvec`.

      To learn more, run the command again with --verbose.
      warning: build failed, waiting for other jobs to finish...
      error: build failed
      💥 maturin failed
        Caused by: Failed to build a native library through cargo
        Caused by: Cargo build finished with "exit status: 101": `cargo rustc --manifest-path Cargo.toml --message-format json --release --lib -- -C link-arg=-s`
      📦 Including license file "LICENSE-APACHE"
      📦 Including license file "LICENSE-MIT"
      🔗 Found pyo3-ffi bindings
      🐍 Found CPython 3.10 at /root/homeassistant3.10/bin/python3.10
      error[E0658]: unions with non-`Copy` fields are unstable
         --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/smallvec-1.9.0/src/lib.rs:409:1
          |
      409 | / union SmallVecData<A: Array> {
      410 | |     inline: core::mem::ManuallyDrop<MaybeUninit<A>>,
      411 | |     heap: (*mut A::Item, usize),
      412 | | }
          | |_^
          |
          = note: see issue #55149 <https://github.com/rust-lang/rust/issues/55149> for more information


      error: aborting due to previous error


      For more information about this error, try `rustc --explain E0658`.

      Error: command ['maturin', 'pep517', 'build-wheel', '-i', '/root/homeassistant3.10/bin/python3.10', '--compatibility', 'off'] returned non-zero exit status 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for orjson
Failed to build orjson
ERROR: Could not build wheels for orjson, which is required to install pyproject.toml-based projects

Any help would be appreciated. Thanks

1 Like

Hello, did you manage to solve it? I have the same problem

Hello, sorry but I did not solve using Alpine 3.12. I used alpine 3.16 and I get no problem. I advise you to upgrade your Alpine to 3.16.