mozilla / remote-settings

Delivering data to Firefox
https://remote-settings.readthedocs.io/
Apache License 2.0
14 stars 13 forks source link

Cannot build container on Mac OS #550

Closed leplatrem closed 9 months ago

leplatrem commented 9 months ago

Commit 2cbaeba061c0

πŸ’₯ maturin failed [...] Caused by: Cargo metadata failed. Do you have cargo in your PATH?

Poetry and Maturin are trying to build the canonicaljson-rs wheel instead of downloading the binary.

``` #22 12.97 #22 12.97 ChefBuildError #22 12.97 #22 12.97 Backend subprocess exited when trying to invoke build_wheel #22 12.97 #22 12.97 Running `maturin pep517 build-wheel -i /tmp/tmpdsigg6x9/.venv/bin/python --compatibility off` #22 12.97 πŸ’₯ maturin failed #22 12.97 Caused by: Cargo metadata failed. Do you have cargo in your PATH? #22 12.97 Caused by: No such file or directory (os error 2) #22 12.97 Error: command ['maturin', 'pep517', 'build-wheel', '-i', '/tmp/tmpdsigg6x9/.venv/bin/python', '--compatibility', 'off'] returned non-zero exit status 1 #22 12.97 #22 12.97 #22 12.97 at poetry/lib/python3.12/site-packages/poetry/installation/chef.py:152 in _prepare #22 12.97 148β”‚ #22 12.97 149β”‚ error = ChefBuildError("\n\n".join(message_parts)) #22 12.97 150β”‚ #22 12.97 151β”‚ if error is not None: #22 12.97 β†’ 152β”‚ raise error from None #22 12.97 153β”‚ #22 12.97 154β”‚ return path #22 12.97 155β”‚ #22 12.97 156β”‚ def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path: #22 12.97 #22 12.97 Note: This error originates from the build backend, and is likely not a problem with poetry but with canonicaljson-rs (0.6.0) not supporting PEP 517 builds. You can verify this by running 'pip wheel --use-pep517 "canonicaljson-rs (==0.6.0)"'. ```

Some built wheels were missing for canonicaljson-rs, and this PR fixed it https://github.com/mozilla-services/python-canonicaljson-rs/pull/88 However, this does not seem to be sufficient. Poetry does not pick the built wheel.

When ran from the container, the following commands are successful:

RUN pip wheel --use-pep517 "canonicaljson-rs (==0.6.0)"
#19 0.895 Collecting canonicaljson-rs==0.6.0
#19 0.895   Obtaining dependency information for canonicaljson-rs==0.6.0 from https://files.pythonhosted.org/packages/c0/ad/cc6718b8d18fd027e9e55b8b748295e1a1cb2f972ca105f48e970a7a405c/canonicaljson_rs-0.6.0-cp312-cp312-manylinux_2_24_aarch64.whl.metadata
#19 0.986   Downloading canonicaljson_rs-0.6.0-cp312-cp312-manylinux_2_24_aarch64.whl.metadata (2.1 kB)
#19 1.007 Downloading canonicaljson_rs-0.6.0-cp312-cp312-manylinux_2_24_aarch64.whl (1.5 MB)
#19 1.192    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.5/1.5 MB 8.3 MB/s eta 0:00:00
#19 1.198 Saved ./canonicaljson_rs-0.6.0-cp312-cp312-manylinux_2_24_aarch64.whl
#19 DONE 1.3s
RUN pip install --verbose "canonicaljson-rs (==0.6.0)"
#20 0.280 Using pip 23.2.1 from /usr/local/lib/python3.12/site-packages/pip (python 3.12)
#20 0.405 Collecting canonicaljson-rs==0.6.0
#20 0.405   Obtaining dependency information for canonicaljson-rs==0.6.0 from https://files.pythonhosted.org/packages/c0/ad/cc6718b8d18fd027e9e55b8b748295e1a1cb2f972ca105f48e970a7a405c/canonicaljson_rs-0.6.0-cp312-cp312-manylinux_2_24_aarch64.whl.metadata
#20 0.481   Downloading canonicaljson_rs-0.6.0-cp312-cp312-manylinux_2_24_aarch64.whl.metadata (2.1 kB)
#20 0.501 Downloading canonicaljson_rs-0.6.0-cp312-cp312-manylinux_2_24_aarch64.whl (1.5 MB)
#20 0.648    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.5/1.5 MB 10.6 MB/s eta 0:00:00
#20 0.676 Installing collected packages: canonicaljson-rs
#20 0.700 Successfully installed canonicaljson-rs-0.6.0

Hence, why is Poetry failing to pick it and tries to compile it from sources down the line?

It looks like poetry lock is not picking the new published wheel that was previously missing.

leplatrem commented 9 months ago

Ok, by doing poetry cache clear --all ., I could obtain the desired changes on the poetry.lock file.

diff --git a/poetry.lock b/poetry.lock
index 49f6c72..7b62fa2 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -297,6 +297,7 @@ files = [
     {file = "canonicaljson_rs-0.6.0-cp311-none-win_amd64.whl", hash = "sha256:f66dff64e1ccf0050c59a6808c6a4c1691cc33d35215e0bfeb4e92888d4ef344"},
     {file = "canonicaljson_rs-0.6.0-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:e357662b5a275e283074c867dfe11eb282b99b2d90836c89283fe304b99a09c4"},
     {file = "canonicaljson_rs-0.6.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:faf7a6903fa045b4b557b83a836967e4f67c33ea9be213af23e94d219771f387"},
+    {file = "canonicaljson_rs-0.6.0-cp312-cp312-manylinux_2_24_aarch64.whl", hash = "sha256:529a466570442a2a419cbd030355b496be07456bddd572ba21d50e37d1031045"},
     {file = "canonicaljson_rs-0.6.0-cp312-cp312-manylinux_2_24_ppc64le.whl", hash = "sha256:538182095b298ec23e47bdd0fe92e4c60c267dafe1b9d82ed2d4163e9935aecb"},
     {file = "canonicaljson_rs-0.6.0-cp312-cp312-manylinux_2_24_s390x.whl", hash = "sha256:837a152355e8877a5bd2bb080e13540f0351d590df3668ea35527ee46e20ff89"},
     {file = "canonicaljson_rs-0.6.0-cp312-cp312-manylinux_2_24_x86_64.whl", hash = "sha256:fdfc8eb8c248642544e75cd596c5b21704a85ddae0b6abfa83eabe5f1d8360fa"},
@@ -3346,4 +3347,4 @@ test = ["zope.testing"]
 [metadata]
 lock-version = "2.0"
 python-versions = ">=3.11, <3.13"
-content-hash = "ed37792dcac86b227f90b614ff9eba1444eb7e91e8e9bab13760d0c8de06afe4"
+content-hash = "4dcdf08c9a1561f6ca09c1946476f02644c710c2ac31a3250eaa5ab51bf5d979"

πŸŽ‰