This is an archive of the discontinued LLVM Phabricator instance.

Install Numpy in the MLIR Docker image, this is required for the python bindings
ClosedPublic

Authored by mehdi_amini on Dec 31 2020, 5:56 PM.

Diff Detail

Event Timeline

mehdi_amini created this revision.Dec 31 2020, 5:56 PM
mehdi_amini requested review of this revision.Dec 31 2020, 5:56 PM

You are going to also want the pybind11 package. That will be the next error after the numpy error :)

mehdi_amini added inline comments.Dec 31 2020, 6:00 PM
buildbot/google/docker/buildbot-mlir-nvidia/Dockerfile
21

pybind11-dev is installed here, isn't it enough?

buildbot/google/docker/buildbot-mlir-nvidia/Dockerfile
21

Probably not because that is going to be the system pybind11 package, which for this OS, is quite old. The version we require is from 2020. We can just remove the install of the system version and switch to pip install, which is the most reliable way to stay current (we upped the min version after the above change was made). The cmake scripts will autodetect and use a pip version -- and this is how I've set everything else up.

Use pip to install pybind11

mehdi_amini added inline comments.Dec 31 2020, 11:14 PM
buildbot/google/docker/buildbot-mlir-nvidia/Dockerfile
30

I suspect we should pin exact versions if we want reproducibility of the Docker image build, WDYT?

tschuett added inline comments.
buildbot/google/docker/buildbot-mlir-nvidia/Dockerfile
18

Why do you use apt-get update, if you are interested in reproducibility? It actually hurts for non-pinned packages.

mehdi_amini added inline comments.Jan 1 2021, 4:49 PM
buildbot/google/docker/buildbot-mlir-nvidia/Dockerfile
18

That a good point as well, I was hoping that Ubuntu packages without experimental / PPA are fairly stable and should get only bug fixes?
The problem I had in the past with pinning on exact package version was that they wouldn't stay available forever.

18

That a good point as well, I was hoping that Ubuntu packages without experimental / PPA are fairly stable and should get only bug fixes?

I'm contrasting with python pip which is always pulling recent versions independently of the OS version.

stellaraccident added inline comments.Jan 1 2021, 8:03 PM
buildbot/google/docker/buildbot-mlir-nvidia/Dockerfile
30

Let's change it to:

pip install numpy==1.19.3 pybind11==2.6.0

The pybind11 version is our minimum required in the cmake, and that specific numpy version avoids some incompatibilities on Windows that affect head versions on some patch levels. I verified that both work on Windows 10.

Pin pip-install package versions

tschuett added inline comments.Jan 2 2021, 12:34 AM
buildbot/google/docker/buildbot-mlir-nvidia/Dockerfile
18

You pinned the base image. So you should be fine.

stellaraccident accepted this revision.Jan 2 2021, 12:41 AM
This revision is now accepted and ready to land.Jan 2 2021, 12:41 AM
kuhnel added a subscriber: kuhnel.Jan 5 2021, 12:16 PM
kuhnel added inline comments.
buildbot/google/docker/buildbot-mlir-nvidia/Dockerfile
18

Why do you use apt-get update, if you are interested in reproducibility? It actually hurts for non-pinned packages.

AFAIK we need to run an apt-update before we can install packages. Otherwise apt will not find them.