Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 5f8173d

Browse files
author
David Robertson
authored
Workaround pip bug installing latest treq and not-latest twisted from hashes (#12439)
The requirements file generated by `poetry export` isn't correctly processed by `pip install -r requirements.txt`. It contains twisted and treq, both pinned to 22.2.0. When `pip` installs treq, it notices that `Twisted[tls]` is required. It then tries to acquire the latest twisted release, only to fail (because this hash isn't listed in the requirements file).From e.g. https://github.com/matrix-org/synapse/runs/5977154990?check_suite_focus=true > ``` > #15 9.204 Collecting Twisted[tls]>=18.7.0 > #15 9.205 ERROR: In --require-hashes mode, all requirements must have their versions pinned with ==. These do not: > #15 9.205 Twisted[tls]>=18.7.0 from https://files.pythonhosted.org/packages/db/99/38622ff95bb740bcc991f548eb46295bba62fcb6e907db1987c4d92edd09/Twisted-22.4.0-py3-none-any.whl#sha256=f9f7a91f94932477a9fc3b169d57f54f96c6e74a23d78d9ce54039a7f48928a2 (from treq==22.2.0->-r /synapse/requirements.txt (line 724)) > #15 ERROR: executor failed running [/bin/sh -c pip install --prefix="/install" --no-warn-script-location -r /synapse/requirements.txt]: exit code: 1 > ``` The underlying pip issue is pypa/pip#9644. A comment notes that one can avoid this behaviour with by `pip install`ing with the `--no-deps` flag. Let us do so. (At first glance, the problem looks like python-poetry/poetry#5311, but that was a bug in `poetry install`; this is `poetry export`, whose behaviour is fine AFAICS).
1 parent ab3165e commit 5f8173d

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

changelog.d/12439.misc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Bundle locked versions of dependencies into the Docker image.

docker/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ RUN \
9393
# This is aiming at installing the `[tool.poetry.depdendencies]` from pyproject.toml.
9494
COPY --from=requirements /synapse/requirements.txt /synapse/
9595
RUN --mount=type=cache,target=/root/.cache/pip \
96-
pip install --prefix="/install" --no-warn-script-location -r /synapse/requirements.txt
96+
pip install --prefix="/install" --no-deps --no-warn-script-location -r /synapse/requirements.txt
9797

9898
# Copy over the rest of the synapse source code.
9999
COPY synapse /synapse/synapse/

0 commit comments

Comments
 (0)