Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requirement for rust and cargo? #1114

Closed
oc-ben-ellis opened this issue Jul 6, 2023 · 1 comment
Closed

Requirement for rust and cargo? #1114

oc-ben-ellis opened this issue Jul 6, 2023 · 1 comment
Labels
Invalid Not a bug, PEBKAC, or an unsupported setup

Comments

@oc-ben-ellis
Copy link

Is it intentional that there is now a requirement for rust and cargo to be installed? This has broken the poetry project which can now not be installed without rust and cargo. I've raised a ticket separately with them (python-poetry/poetry#8160) as suspect they'll lock into the previous versions of jsonschema.

Running the below gives an error,

`docker run -it --rm alpine:latest /bin/sh -c "apk add python3 py3-pip && pip install jsonschema"

Collecting rpds-py>=0.7.1 (from jsonschema)
  Downloading rpds_py-0.8.4.tar.gz (15 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]

      Cargo, the Rust package manager, is not installed or is not on PATH.
      This package requires Rust and Cargo to compile extensions. Install it through
      the system's package manager or via https://rustup.rs/

      Checking for Rust toolchain....
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.

Workaround is to install rust and cargo,

docker run -it --rm alpine:latest /bin/sh -c "apk add rust cargo python3 py3-pip && pip install jsonschema"

This works.

@oc-ben-ellis oc-ben-ellis changed the title Requirement for rust and cargo? Requirement for rust and cargo on alpine linux? Jul 6, 2023
@oc-ben-ellis oc-ben-ellis changed the title Requirement for rust and cargo on alpine linux? Requirement for rust and cargo? Jul 6, 2023
@Julian
Copy link
Member

Julian commented Jul 6, 2023

There's a (indeed intentional) dependency on rust for building from source, and no current MUSL wheels yet. The latter is tracked at crate-py/rpds#6 and just requires some understanding of what to tweak in maturin which hasn't been figured out yet. Help certainly welcome.

@Julian Julian closed this as not planned Won't fix, can't repro, duplicate, stale Jul 6, 2023
@Julian Julian added the Invalid Not a bug, PEBKAC, or an unsupported setup label Jul 12, 2023
DnPlas added a commit to canonical/kubeflow-dashboard-operator that referenced this issue Jul 24, 2023
Because some dependencies of jsonschema require the rust toolchain (see 1 and 2),
building the charm fails when building and installing some deps of jsonschema.
The workaround to this is to install jsonschema from binary, avoiding unnecesary
toolchains in the charm and reducing the chance of getting affected by third party
dependencies when they are updated.
[1]python-jsonschema/jsonschema#1117
[2] python-jsonschema/jsonschema#1114
DnPlas added a commit to canonical/kubeflow-dashboard-operator that referenced this issue Jul 24, 2023
Because some dependencies of jsonschema require the rust toolchain (see 1 and 2), building
the charm fails when building and installing some deps of jsonschema.
The workaround to this is to install jsonschema from binary, avoiding unnecesary toolchains
in the charm and reducing the chance of getting affected by third
party dependencies when they are updated.

Other considerations:
Other options were considered for fixing the issue, like installing rustc in the charm
directly and pinning jsonschema<4.18. The first option seem too invasive as charms will not
use rustc for anything during runtime. The last option restricted us from updating the package
in the event of a bug fix or if a new version is needed.
Installing from binary also has limitations, such as version management, which is now done
in charmcraft.yaml and not in the more common requirement files.

Fixes: #147

[1]python-jsonschema/jsonschema#1117
[2] python-jsonschema/jsonschema#1114
DnPlas added a commit to canonical/serialized-data-interface that referenced this issue Jul 25, 2023
Because some dependencies of jsonschema now require the rust toolchain (see 1 and 2), building
charms that depend on SDI (and therefore pull jsonschema) fail when building because none
of them have rustc available when pip installing the charm's python dependencies.

Reasoning:
jsonschema 4.18.x introduced a dependency on rdps-py which at the same time introduced
a dependency on maturin, a python package that requires the rustc toolchain to be
built and installed from source. jsonschema 4.17.x does not have that dependency.

Links:
[1]python-jsonschema/jsonschema#1117
[2] python-jsonschema/jsonschema#1114

Partially fixes: canonical/bundle-kubeflow#648
DnPlas added a commit to canonical/serialized-data-interface that referenced this issue Jul 25, 2023
* build: pin jsonschema to >4, <4.18 to avoid installing 4.18.x

Because some dependencies of jsonschema now require the rust toolchain (see 1 and 2), building
charms that depend on SDI (and therefore pull jsonschema) fail when building because none
of them have rustc available when pip installing the charm's python dependencies.

Reasoning:
jsonschema 4.18.x introduced a dependency on rdps-py which at the same time introduced
a dependency on maturin, a python package that requires the rustc toolchain to be
built and installed from source. jsonschema <4.18 does not have that dependency.

Links:
[1]python-jsonschema/jsonschema#1117
[2] python-jsonschema/jsonschema#1114

Partially fixes: canonical/bundle-kubeflow#648

Co-authored-by: Adam Dyess <[email protected]>
Co-authored-by: Andrew Scribner <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Invalid Not a bug, PEBKAC, or an unsupported setup
Projects
None yet
Development

No branches or pull requests

2 participants