Exposing site-packages in docker-compose

I help maintain a custom_component and I’d like to make the site-package it installs available outside the container (volume mount) to make local code changes and test them.

My docker-compose is as follows at the moment:

version: '3'
services:
  homeassistant:
    container_name: homeassistant
    image: "ghcr.io/home-assistant/home-assistant:stable"
    volumes:
      - /volume2/docker/home-assistant:/config
      - /etc/localtime:/etc/localtime:ro
      - /volume2/docker/home-assistant/python-hilo/pyhilo:/usr/local/lib/python3.12/site-packages/pyhilo

    restart: no
    privileged: true
    network_mode: host
    environment:
      - TZ=Canada/Eastern

And this yields the following error:

Logger: homeassistant.util.package
Source: util/package.py:150
First occurred: 6:57:29 PM (3 occurrences)
Last logged: 6:57:35 PM

Unable to install package python-hilo>=2024.6.1: error: Failed to install: python_hilo-2024.10.2-py3-none-any.whl (python-hilo==2024.10.2) Caused by: failed to rename file from /usr/local/lib/python3.12/site-packages/.tmpRPMlyk/__init__.py to /usr/local/lib/python3.12/site-packages/pyhilo/__init__.py Caused by: Cross-device link (os error 18)
Unable to install package python-hilo>=2024.6.1: error: Failed to install: python_hilo-2024.10.2-py3-none-any.whl (python-hilo==2024.10.2) Caused by: failed to rename file from /usr/local/lib/python3.12/site-packages/.tmpo10XDD/__init__.py to /usr/local/lib/python3.12/site-packages/pyhilo/__init__.py Caused by: Cross-device link (os error 18)
Unable to install package python-hilo>=2024.6.1: error: Failed to install: python_hilo-2024.10.2-py3-none-any.whl (python-hilo==2024.10.2) Caused by: failed to rename file from /usr/local/lib/python3.12/site-packages/.tmp6h1qoS/__init__.py to /usr/local/lib/python3.12/site-packages/pyhilo/__init__.py Caused by: Cross-device link (os error 18)

The files are already present in the volume mount so I’m unsure why it’s even trying to download overtop of them.

Any help would be appreciated, this used to work before and it no longer does.