davidADSP / Generative_Deep_Learning_2nd_Edition

The official code repository for the second edition of the O'Reilly book Generative Deep Learning: Teaching Machines to Paint, Write, Compose and Play.
https://www.oreilly.com/library/view/generative-deep-learning/9781098134174/
Apache License 2.0
990 stars 363 forks source link

"docker compose build" not working on Mac (M1 Max) #36

Open OneWind opened 3 months ago

OneWind commented 3 months ago

I constantly got this error, although I installed pkg-config, added /opt/homebrew and /opt/homebrew/bin to PATH, and I set up HDF5_DIR=/opt/homebrew/opt

46.21 Building h5py requires pkg-config unless the HDF5 path is explicitly specified using the environment variable HDF5_DIR. For more information and details, see https://docs.h5py.org/en/stable/build.html#custom-installation 46.21 error: pkg-config probably not installed: FileNotFoundError(2, 'No such file or directory') 46.21 [end of output] 46.21
46.21 note: This error originates from a subprocess, and is likely not a problem with pip. 46.21 ERROR: Failed building wheel for h5py

DucHUNG312 commented 3 months ago

I fixed it by adding pkg-config and libhdf5-dev to the RUN apt-get install line in the Dockerfile, and adding a line RUN pip install --no-binary=h5py h5py

Here is my Dockerfile

FROM ubuntu:20.04

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update
RUN apt-get install -y pkg-config libhdf5-dev unzip graphviz curl musescore3 python3-pip 

RUN pip install --upgrade pip
RUN pip install --no-binary=h5py h5py

WORKDIR /app

COPY ./requirements.txt /app
RUN pip install -r /app/requirements.txt
RUN pip install tensorflow-io
RUN pip uninstall -y tensorflow-io

COPY /notebooks/. /app/notebooks
COPY /scripts/. /app/scripts

ENV PYTHONPATH="${PYTHONPATH}:/app"
ethanwlx commented 1 month ago

Experiencing the same issue on Mac (M3 Max). @DucHUNG312’s solution works.

nileshmalpekar commented 1 month ago

I fixed it by adding pkg-config and libhdf5-dev to the RUN apt-get install line in the Dockerfile and nothing else was changed.

piovac commented 2 weeks ago

I have been able to make docker build and run the image properly just adding the line DOCKER_DEFAULT_PLATFORM=linux/amd64 to the .env file.

The issue I is the Jupyter kernel continuously die and restart when running some notebooks. For instance:

Kernel Restarting The kernel for notebooks/02_deeplearning/02_cnn/cnn.ipynb appears to have died. It will restart automatically.

THUrachel commented 1 week ago

@DucHUNG312 You may also need to add pip install --upgrade h5py to upgrade h5py to 3.11.0 Otherwise 2.10.0 h5py may conflict with default numpy version 1.24.4