numpyro icon indicating copy to clipboard operation
numpyro copied to clipboard

Build Docker Image from Mac M1 machine

Open gfonseca92 opened this issue 2 years ago • 6 comments

Hello, I am trying to build a Docker image from a model that I created using Numpyro.

However, when I try to build the Dockerfile given here I get the error message: "No matching distribution found for jaxlib>=0.4.14 (from numpyro[cuda])"

I am using my Mac M1 to build this image. Is it related to this? How can I solve this?

Tks in advance!

gfonseca92 avatar Aug 28 '23 13:08 gfonseca92

I think you might need to update the dockerfile to

RUN pip3 install --user numpyro

fehiepsi avatar Aug 28 '23 14:08 fehiepsi

Thanks! Just to make sure, my Dockerfile looks like:

# Experimental Dockerfile for CUDA-enabled numpyro
# This image should be suitable for developers on top of numpyro, or for end-users
# who wish to hit the ground running with CUDA+numpyro.
# Author/Maintainer: AndrewCSQ (web_enquiry at andrewchia dot tech)

FROM nvidia/cuda:11.2.2-cudnn8-devel-ubuntu20.04

# declare the image name
# note that this image uses Python 3.8
ENV IMG_NAME=11.2.2-cudnn8-devel-ubuntu20.04

# install python3 and pip on top of the base Ubuntu image
RUN apt update && \
    apt install python3-dev python3-pip -y

# add .local/bin to PATH for tqdm and f2py
ENV PATH=/root/.local/bin:$PATH

# # install python packages via pip
# RUN pip3 install --user \
#     # we pull wheels from google's api as per https://github.com/google/jax#installation
#     # the pre-compiled wheels that google provides work for now. This may change in the future (and necessitate building from source)
#     numpyro[cuda] -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html

RUN pip3 install --user numpyro

And I still get:

Collecting numpyro Downloading numpyro-0.13.0-py3-none-any.whl (312 kB) Collecting tqdm Downloading tqdm-4.66.1-py3-none-any.whl (78 kB) ERROR: Could not find a version that satisfies the requirement jaxlib>=0.4.14 (from numpyro) (from versions: none) ERROR: No matching distribution found for jaxlib>=0.4.14 (from numpyro)

gfonseca92 avatar Aug 28 '23 14:08 gfonseca92

Oh, I see. We no longer support python 3.8 in the last release. Could you try to find another image that includes python 3.9?

Alternatively, you can do

RUN pip3 install --user "numpyro<0.13"

fehiepsi avatar Aug 28 '23 14:08 fehiepsi

Did not work downgrading numpyro to <0.13

Collecting numpyro<0.13 Downloading numpyro-0.12.1-py3-none-any.whl (304 kB) Collecting numpy Downloading numpy-1.24.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (14.0 MB) ERROR: Could not find a version that satisfies the requirement jaxlib>=0.4.7 (from numpyro<0.13) (from versions: none) ERROR: No matching distribution found for jaxlib>=0.4.7 (from numpyro<0.13)

gfonseca92 avatar Aug 28 '23 14:08 gfonseca92

Neither this way:

FROM --platform=linux ubuntu:20.04
FROM python:3.9

# install python3 and pip on top of the base Ubuntu image
RUN apt update && \
    apt install python3-dev python3-pip -y

# add .local/bin to PATH for tqdm and f2py
ENV PATH=/root/.local/bin:$PATH

RUN pip3 install --user numpyro

As I get:

6.154 numpyro 0.3.0 depends on jaxlib==0.1.51 6.154 numpyro 0.2.4 depends on jaxlib==0.1.37 6.154 numpyro 0.2.3 depends on jaxlib==0.1.36 6.154 numpyro 0.2.2 depends on jaxlib==0.1.36 6.154 numpyro 0.2.1 depends on jaxlib==0.1.32 6.154 numpyro 0.2.0 depends on jaxlib==0.1.27 6.154 numpyro 0.1.0 depends on jaxlib>=0.1.14 6.154 6.154 To fix this you could try to: 6.154 1. loosen the range of package versions you've specified 6.154 2. remove package versions to allow pip attempt to solve the dependency conflict 6.154 6.155 ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

gfonseca92 avatar Aug 28 '23 17:08 gfonseca92

Interesting! It looks like docker tried to install very old numpyro versions. I'm not sure why.

fehiepsi avatar Aug 28 '23 22:08 fehiepsi