rebuild image, got pip installed, and apache-flink...
# pyflink
g
rebuild image, got pip installed, and apache-flink as the link... while trying to install sentence_transformers.
Copy code
docker compose exec --interactive --tty jobmanager /bin/bash
flink@jobmanager:~$ pip install sentence_transformers
Defaulting to user installation because normal site-packages is not writeable
Collecting sentence_transformers
  Downloading sentence_transformers-5.1.2-py3-none-any.whl (488 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 488.0/488.0 KB 870.2 kB/s eta 0:00:00
Collecting scikit-learn
  Downloading scikit_learn-1.7.2-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (9.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 9.5/9.5 MB 12.3 MB/s eta 0:00:00
Collecting tqdm
  Downloading tqdm-4.67.1-py3-none-any.whl (78 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 78.5/78.5 KB 14.8 MB/s eta 0:00:00
Collecting transformers<5.0.0,>=4.41.0
  Downloading transformers-4.57.3-py3-none-any.whl (12.0 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12.0/12.0 MB 24.2 MB/s eta 0:00:00
Collecting huggingface-hub>=0.20.0
  Downloading huggingface_hub-1.2.1-py3-none-any.whl (520 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 520.9/520.9 KB 24.6 MB/s eta 0:00:00
Collecting Pillow
  Downloading pillow-12.0.0-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (6.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.3/6.3 MB 19.0 MB/s eta 0:00:00
Collecting torch>=1.11.0
  Downloading torch-2.9.1-cp310-cp310-manylinux_2_28_aarch64.whl (104.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 104.2/104.2 MB 9.0 MB/s eta 0:00:00
Collecting scipy
  Downloading scipy-1.15.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (35.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 35.5/35.5 MB 19.1 MB/s eta 0:00:00
Requirement already satisfied: typing_extensions>=4.5.0 in /usr/local/lib/python3.10/dist-packages (from sentence_transformers) (4.15.0)
Collecting packaging>=20.9
  Downloading packaging-25.0-py3-none-any.whl (66 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 66.5/66.5 KB 17.2 MB/s eta 0:00:00
Collecting pyyaml>=5.1
  Downloading pyyaml-6.0.3-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (740 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 740.6/740.6 KB 38.3 MB/s eta 0:00:00
Collecting shellingham
  Downloading shellingham-1.5.4-py2.py3-none-any.whl (9.8 kB)
Collecting typer-slim
  Downloading typer_slim-0.20.0-py3-none-any.whl (47 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 47.1/47.1 KB 11.7 MB/s eta 0:00:00
Collecting fsspec>=2023.5.0
  Downloading fsspec-2025.12.0-py3-none-any.whl (201 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 201.4/201.4 KB 27.5 MB/s eta 0:00:00
Collecting hf-xet<2.0.0,>=1.2.0
  Downloading hf_xet-1.2.0-cp37-abi3-manylinux_2_28_aarch64.whl (3.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.2/3.2 MB 35.1 MB/s eta 0:00:00
Collecting httpx<1,>=0.23.0
  Downloading httpx-0.28.1-py3-none-any.whl (73 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 73.5/73.5 KB 13.7 MB/s eta 0:00:00
Collecting filelock
  Downloading filelock-3.20.0-py3-none-any.whl (16 kB)
Collecting jinja2
  Downloading jinja2-3.1.6-py3-none-any.whl (134 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 134.9/134.9 KB 26.2 MB/s eta 0:00:00
Collecting sympy>=1.13.3
  Downloading sympy-1.14.0-py3-none-any.whl (6.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.3/6.3 MB 24.8 MB/s eta 0:00:00
Collecting networkx>=2.5.1
  Downloading networkx-3.4.2-py3-none-any.whl (1.7 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.7/1.7 MB 32.3 MB/s eta 0:00:00
Collecting safetensors>=0.4.3
  Downloading safetensors-0.7.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (491 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 491.7/491.7 KB 21.1 MB/s eta 0:00:00
Requirement already satisfied: requests in /usr/local/lib/python3.10/dist-packages (from transformers<5.0.0,>=4.41.0->sentence_transformers) (2.32.5)
Requirement already satisfied: regex!=2019.12.17 in /usr/local/lib/python3.10/dist-packages (from transformers<5.0.0,>=4.41.0->sentence_transformers) (2025.11.3)
Requirement already satisfied: numpy>=1.17 in /usr/local/lib/python3.10/dist-packages (from transformers<5.0.0,>=4.41.0->sentence_transformers) (1.24.4)
Collecting huggingface-hub>=0.20.0
  Downloading huggingface_hub-0.36.0-py3-none-any.whl (566 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 566.1/566.1 KB 44.2 MB/s eta 0:00:00
Collecting tokenizers<=0.23.0,>=0.22.0
  Downloading tokenizers-0.22.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.3/3.3 MB 20.5 MB/s eta 0:00:00
Collecting threadpoolctl>=3.1.0
  Downloading threadpoolctl-3.6.0-py3-none-any.whl (18 kB)
Collecting joblib>=1.2.0
  Downloading joblib-1.5.2-py3-none-any.whl (308 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 308.4/308.4 KB 41.0 MB/s eta 0:00:00
Collecting anyio
  Downloading anyio-4.12.0-py3-none-any.whl (113 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 113.4/113.4 KB 19.2 MB/s eta 0:00:00
Requirement already satisfied: certifi in /usr/local/lib/python3.10/dist-packages (from httpx<1,>=0.23.0->huggingface-hub>=0.20.0->sentence_transformers) (2025.11.12)
Collecting httpcore==1.*
  Downloading httpcore-1.0.9-py3-none-any.whl (78 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 78.8/78.8 KB 13.8 MB/s eta 0:00:00
Requirement already satisfied: idna in /usr/local/lib/python3.10/dist-packages (from httpx<1,>=0.23.0->huggingface-hub>=0.20.0->sentence_transformers) (3.11)
Collecting h11>=0.16
  Downloading h11-0.16.0-py3-none-any.whl (37 kB)
Collecting mpmath<1.4,>=1.1.0
  Downloading mpmath-1.3.0-py3-none-any.whl (536 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 536.2/536.2 KB 18.3 MB/s eta 0:00:00
Collecting MarkupSafe>=2.0
  Downloading markupsafe-3.0.3-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (22 kB)
Requirement already satisfied: charset_normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests->transformers<5.0.0,>=4.41.0->sentence_transformers) (3.4.4)
Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests->transformers<5.0.0,>=4.41.0->sentence_transformers) (2.6.0)
Collecting click>=8.0.0
  Downloading click-8.3.1-py3-none-any.whl (108 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 108.3/108.3 KB 29.3 MB/s eta 0:00:00
Collecting exceptiongroup>=1.0.2
  Downloading exceptiongroup-1.3.1-py3-none-any.whl (16 kB)
ERROR: Exception:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/base_command.py", line 165, in exc_logging_wrapper
    status = run_func(*args)
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/req_command.py", line 205, in wrapper
    return func(self, options, args)
  File "/usr/lib/python3/dist-packages/pip/_internal/commands/install.py", line 389, in run
    to_install = resolver.get_installation_order(requirement_set)
  File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/resolver.py", line 188, in get_installation_order
    weights = get_topological_weights(
  File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/resolver.py", line 276, in get_topological_weights
    assert len(weights) == expected_node_count
AssertionError
flink@jobmanager:~$
e
this is an issue with pip itself, before pip install try to update to latest pip version
Copy code
python3 -m pip install --upgrade pip setuptools wheel
Since you are trying to install something ml related there’s high chance pip will try to build wheels from source, you will need also to install build tools before invoking pip
Copy code
RUN apt-get update \
      && apt-get install -y --no-install-recommends  clang git libssl-dev make pkg-config build-essential  \
      && apt-get clean \
      && rm -rf /var/lib/apt/lists/*
Alternatively, you can switch to a different Python package manager. For example, uv handles dependency resolution extremely well and feels almost instant in comparison. How do you normally manage your Python dependencies? Pip has a long history of struggling with complex dependency trees.
The build tools are needed no matter the python package manager you use
g
As the container itself is being dedicated to this lab, i'm not using environment managers, i'm root installing the packages, for local dev I use virtualenv below is my Dockerfile, removed sections below the last line as thats not relevant to this error, due to me running into error on sentence_transformer I'm installing that manually atm, until I can get it working, will then pull it into the Dockerfile
Copy code
FROM arm64v8/flink:1.20.2-scala_2.12-java17
SHELL ["/bin/bash", "-c"]

ENV FLINK_HOME=/opt/flink
ENV HIVE_HOME=$FLINK_HOME/conf/

WORKDIR $FLINK_HOME

RUN echo "--> Install some useful tools (openjdk-17-jdk-headless required on ARM platforms to enable installation of apache-flink)" \
    && build_deps="neovim tree lnav unzip gradle python3-pip python3.10-venv openjdk-17-jdk-headless" \
    && apt-get update \
    && apt-get install -y $build_deps

ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-arm64

# # https://github.com/apache/flink/tree/master/flink-python/pyflink/examples
RUN echo "--> Install apache-flink" \
    && /usr/bin/pip3 install apache-flink==1.20.2

RUN echo "--> Install PyFlink" \
    && /usr/bin/pip3 install pyflink

RUN echo "--> Cleanup time" \
    && apt-get remove -y openjdk-17-jdk-headless 

RUN echo "--> Purge apt artifacts" \
    && apt-get purge -y --auto-remove $build_deps \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# Take note of the below... otherwise your job will report a error saying there is no Python intepreter available.
RUN ln -s /usr/bin/python3 /usr/bin/python
RUN ldconfig /usr/lib


RUN echo "--> Setup Directory Structure" && \
    mkdir -p /opt/flink/conf/ && \
    mkdir -p /opt/flink/checkpoints && \
    mkdir -p /opt/flink/rocksdb
this fixed problem
Copy code
python3 -m pip install --upgrade pip setuptools wheel
I did get the following warnings should I be worried ?
Copy code
Downloading tqdm-4.67.1-py3-none-any.whl (78 kB)
Downloading filelock-3.20.0-py3-none-any.whl (16 kB)
Downloading jinja2-3.1.6-py3-none-any.whl (134 kB)
Downloading markupsafe-3.0.3-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (22 kB)
Downloading pillow-12.0.0-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (6.3 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.3/6.3 MB 23.5 MB/s  0:00:00
Downloading scikit_learn-1.7.2-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (9.5 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 9.5/9.5 MB 25.5 MB/s  0:00:00
Downloading joblib-1.5.2-py3-none-any.whl (308 kB)
Downloading scipy-1.15.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (35.5 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 35.5/35.5 MB 24.9 MB/s  0:00:01
Downloading threadpoolctl-3.6.0-py3-none-any.whl (18 kB)
Installing collected packages: mpmath, tqdm, threadpoolctl, sympy, scipy, safetensors, pyyaml, Pillow, packaging, networkx, MarkupSafe, joblib, hf-xet, fsspec, filelock, scikit-learn, jinja2, huggingface-hub, torch, tokenizers, transformers, sentence_transformers
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━  0/22 [mpmath]  WARNING: The script tqdm is installed in '/opt/flink/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
   ━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━  3/22 [sympy]  WARNING: The script isympy is installed in '/opt/flink/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╸━━━━━━━━━ 17/22 [huggingface-hub]  WARNING: The scripts hf, huggingface-cli and tiny-agents are installed in '/opt/flink/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╸━━━━━━━ 18/22 [torch]  WARNING: The scripts torchfrtrace and torchrun are installed in '/opt/flink/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━ 20/22 [transformers]  WARNING: The scripts transformers and transformers-cli are installed in '/opt/flink/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed MarkupSafe-3.0.3 Pillow-12.0.0 filelock-3.20.0 fsspec-2025.12.0 hf-xet-1.2.0 huggingface-hub-0.36.0 jinja2-3.1.6 joblib-1.5.2 mpmath-1.3.0 networkx-3.4.2 packaging-25.0 pyyaml-6.0.3 safetensors-0.7.0 scikit-learn-1.7.2 scipy-1.15.3 sentence_transformers-5.1.2 sympy-1.14.0 threadpoolctl-3.6.0 tokenizers-0.22.1 torch-2.9.1 tqdm-4.67.1 transformers-4.57.3
flink@jobmanager:~$
e
You can use a package manager without a Python virtual environment. The issue isn’t that it won’t work—it’s that on a typical Linux system, Python is tightly integrated with many system tools, so installing packages globally can easily break something. However, since you’re working inside a Docker image, this risk disappears. The environment is isolated and disposable, so it’s perfectly fine to rely on the system Python interpreter without creating a virtual environment. For example using uv
Copy code
FROM python:3.13.9-slim-bookworm AS base

ENV PYTHONUNBUFFERED=1 \
      PYTHONDONTWRITEBYTECODE=1 \
      PIP_NO_CACHE_DIR=off \
      PIP_DISABLE_PIP_VERSION_CHECK=on \
      PIP_DEFAULT_TIMEOUT=100 \
      PYSETUP_PATH="/opt/pysetup" \
      UV_LINK_MODE=copy \
      UV_PYTHON_DOWNLOADS=0 \
      BUILD_MODE="release" \
      CC="clang"
ENV PATH="/root/.local/bin:$PATH"

WORKDIR $PYSETUP_PATH

FROM base AS dev

RUN apt-get update \
      && apt-get install -y --no-install-recommends curl clang git libssl-dev make pkg-config build-essential  \
      && apt-get clean \
      && rm -rf /var/lib/apt/lists/*
Copy code
#Dockerfile

# Install UV python package manager
COPY uv-version ./
RUN UV_VERSION="$(cat uv-version)" && curl -LsSf "https://astral.sh/uv/$UV_VERSION/install.sh" | sh


WORKDIR $PYSETUP_PATH


# Install package requirements (split step and with --no-root to enable caching)
COPY uv.lock pyproject.toml ./

RUN --mount=type=cache,target=/root/.cache/uv  \
      uv sync --frozen --no-install-project  --no-dev --verbose
Warning are fine you can ignore those, if you want to invoke the python package you installed as cli then you can add it to $PATH,
also consider pinning the installed versions with pip to avoid future headaches
Copy code
pip freeze > requierments.txt
g
thanks...