Generative_Deep_Learning_2nd_Edition icon indicating copy to clipboard operation
Generative_Deep_Learning_2nd_Edition copied to clipboard

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

Open OneWind opened this issue 1 year ago • 6 comments

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

OneWind avatar Apr 19 '24 09:04 OneWind

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"

DucHUNG312 avatar Apr 20 '24 18:04 DucHUNG312

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

ethanwlx avatar Jun 04 '24 22:06 ethanwlx

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.

nileshmalpekar avatar Jun 15 '24 20:06 nileshmalpekar

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.

piovac avatar Jul 12 '24 13:07 piovac

@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

THUrachel avatar Jul 23 '24 05:07 THUrachel