dominikberse / homeassistant-bluetooth-mesh

Allows to use bluetooth mesh devices directly from homeassistant
61 stars 15 forks source link

docker-compose fails at PyYAML==6.0 #18

Open aebgit opened 9 months ago

aebgit commented 9 months ago

When installing i noticed two issues:

  1. docker compose build throws docker: 'compose' is not a docker command., so I assume you meant docker-compose build instead
  2. when running docker-compose build from inside ~/homeassistant-bluetooth-mesh/docker, this fails with the error below:
    Collecting PyYAML==6.0
    #0 76.92   Downloading PyYAML-6.0.tar.gz (124 kB)
    #0 76.96      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 125.0/125.0 kB 3.3 MB/s eta 0:00:00
    #0 77.43   Installing build dependencies: started
    #0 86.08   Installing build dependencies: finished with status 'done'
    #0 86.08   Getting requirements to build wheel: started
    #0 86.81   Getting requirements to build wheel: finished with status 'error'
    #0 86.84   error: subprocess-exited-with-error
    #0 86.84   
    #0 86.84   × Getting requirements to build wheel did not run successfully.

    I googled around and this seems to be a known problem with PyYAML==6.0. However I couldn't solve it by redirecting to another version, because it seems docker-compose uses the requirements.txt from your Github-repo and not my local file.

Looking forward for any advice!

BR Andreas

dominikberse commented 9 months ago

Hello Andreas,

thanks for the feedback. Regarding your first point, compose is being integrated into docker as a CLI plugin and therefore the command changed from docker-compose to docker compose (see for example https://stackoverflow.com/a/66516826/12661819).

I am not sure about the problem with PyYaML. I currently do not have the time to look into it, but I guess you can change the Dockerfile to copy the local files instead of cloning the repo (now that I see that, its weird that I did that in the first place).

Due to the current directory structure, I guess you have to add the context: prop under build: in docker-compose.yaml, so it would look something like this

   ...
    build:
      context: ../
      dockerfile: ./docker/Dockerfile
   ...

and then change all local paths in the Dockerfile accordingly. Then you should be able to change

RUN git clone https://github.com/dominikberse/homeassistant-bluetooth-mesh.git .
RUN git checkout master

to

COPY . .

which will copy your local files instead of cloning the repo.

You will probably have to adjust some of this, I just wrote it down here without further tests. But it's a good starting point hopefully.

Good luck, Dominik

rogierg commented 4 months ago

Hi there, I fixed this by changing the pip install line in the Dockerfile:

RUN pip3 install --upgrade pip && pip3 install "cython<3.0.0" wheel && pip install "pyyaml==6.0" --no-build-isolation && pip3 install -r requirements.txt

Then remove cython from the requirements.txt.