blei-lab / edward

A probabilistic programming language in TensorFlow. Deep generative models, variational inference.
http://edwardlib.org
Other
4.83k stars 760 forks source link

Dockerfile builds, but gives errors when importing TF #832

Open garyfeng opened 6 years ago

garyfeng commented 6 years ago

I built a docker image based on the current /docker/Dockerfile (CPU version), which can run (on Windows using Docker for Windows) and show the Jupyter notebook. But when I run the following in the notebook:

import tensorflow as tf

I receive the following error before the Jupyter kernel restarts.

RuntimeErrorTraceback (most recent call last)
RuntimeError: module compiled against API version 0xb but this version of numpy is 0xa
dustinvtran commented 6 years ago

Thanks for the report. Unfortunately I don't know enough about docker files to give any suggestions. There are no hard-coded versions for numpy and tensorflow in the docker file. And it looks like a TensorFlow issue being incompatible with numpy?

garyfeng commented 6 years ago

Turns out the numpy installed by the Dockerfile is 1.10.x. The following fixed the issue:

conda update conda
conda update -all

Versions of the packages to be updated:

he following packages will be UPDATED:

    fontconfig:     2.12.1-3              --> 2.12.4-h88586e7_1
    freetype:       2.5.5-2               --> 2.8-hab7d2ae_1
    icu:            54.1-0                --> 58.2-h9c2bf20_1
    libiconv:       1.14-0                --> 1.15-h63c8f33_5
    libxml2:        2.9.4-0               --> 2.9.7-h26e45fe_0
    matplotlib:     1.5.1-np110py35_0     --> 2.1.2-py35h0e671d2_0
    numpy:          1.10.2-py35_0         --> 1.14.0-py35h3dfced4_1
    openblas:       0.2.14-4              --> 0.2.20-4
    pandas:         0.21.1-py35h20b78c2_0 --> 0.22.0-py35hf484d3e_0
    pillow:         4.2.1-py35_0          --> 5.0.0-py35h3deb7b8_0
    pyqt:           4.11.4-py35_4         --> 5.6.0-py35h0e41ada_5
    python:         3.5.3-1               --> 3.5.4-h417fded_24
    qt:             4.8.7-3               --> 5.6.2-h974d657_12
    readline:       6.2-2                 --> 7.0-ha6073c6_4
    sip:            4.18-py35_0           --> 4.18.1-py35h9eaea60_2
    sqlite:         3.13.0-0              --> 3.21.0-h1bed415_0
    tk:             8.5.18-0              --> 8.6.7-hc745277_3
dustinvtran commented 6 years ago

Great! Does that require anything for the dockerfile?

garyfeng commented 6 years ago

@dustinvtran ... my dockerhub autobuild is giving me error messages. Let me investigate a little bit before you approve the PR.

garyfeng commented 6 years ago

Turns out I missed a "-" in "--all". My bad. But question: is there a reason to keep qt version to 4? Here's the problem I found.

While watching the build log, it looks like conda originally had numpy 1.13, but then it's downgraded to 1.10, which caused the problem. I suspect it has to do with the line conda install -y pyqt=${python_qt_version} && \. The log:

## Package Plan ##

  environment location: /opt/conda

  added / updated specs:
    - pyqt=4

The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    qt-4.8.7                   |                3        34.1 MB
    sip-4.18                   |           py35_0         240 KB
    openblas-0.2.14            |                4         3.6 MB
    libgfortran-3.0.0          |                1         281 KB
    pyqt-4.11.4                |           py35_4         3.3 MB
    numpy-1.10.2               |           py35_0         5.8 MB
    matplotlib-1.5.1           |      np110py35_0         8.5 MB
    pandas-0.21.1              |   py35h20b78c2_0        10.6 MB
    ------------------------------------------------------------
                                           Total:        66.4 MB

The following NEW packages will be INSTALLED:

    libgfortran: 3.0.0-1
    openblas:    0.2.14-4

The following packages will be DOWNGRADED:

    matplotlib:  2.0.2-np113py35_0     --> 1.5.1-np110py35_0
    numpy:       1.13.3-py35h3dfced4_2 --> 1.10.2-py35_0
    pandas:      0.22.0-py35hf484d3e_0 --> 0.21.1-py35h20b78c2_0
    pyqt:        5.6.0-py35h0e41ada_5  --> 4.11.4-py35_4
    qt:          5.6.2-5               --> 4.8.7-3
    sip:         4.18.1-py35h9eaea60_2 --> 4.18-py35_0

Downloading and Extracting Packages
Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done

What I did with conda update --all upgrade things to the most current version (Numpy = 1.14 among others). The a few notebook I tested seem to run ok after this fix, but I don't know whether it will create issues with other libraries. Versions after update --all.

The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    libopenblas-0.2.20         |       h9ac9557_4         8.7 MB
    qt-5.6.2                   |      h974d657_12        44.5 MB
    sqlite-3.21.0              |       h1bed415_2         1.5 MB
    fontconfig-2.12.4          |       h88586e7_1         282 KB
    icu-58.2                   |       h9c2bf20_1        22.5 MB
    numpy-1.14.0               |   py35h3dfced4_1         4.0 MB
    openblas-devel-0.2.20      |                4          58 KB
    pillow-5.0.0               |   py35h3deb7b8_0         561 KB
    libiconv-1.15              |       h63c8f33_5         2.0 MB
    libxml2-2.9.7              |       h26e45fe_0         2.0 MB
    matplotlib-2.1.2           |   py35h0e671d2_0         6.7 MB
    freetype-2.8               |       hab7d2ae_1         804 KB
    openblas-0.2.20            |                4           5 KB
    python-3.5.4               |      h417fded_24        28.3 MB
    ------------------------------------------------------------
                                           Total:       121.8 MB

The following NEW packages will be INSTALLED:

    libopenblas:    0.2.20-h9ac9557_4
    openblas-devel: 0.2.20-4

The following packages will be UPDATED:

    fontconfig:     2.12.1-3              --> 2.12.4-h88586e7_1
    freetype:       2.5.5-2               --> 2.8-hab7d2ae_1
    icu:            54.1-0                --> 58.2-h9c2bf20_1
    libiconv:       1.14-0                --> 1.15-h63c8f33_5
    libxml2:        2.9.4-0               --> 2.9.7-h26e45fe_0
    matplotlib:     1.5.1-np110py35_0     --> 2.1.2-py35h0e671d2_0
    numpy:          1.10.2-py35_0         --> 1.14.0-py35h3dfced4_1
    openblas:       0.2.14-4              --> 0.2.20-4
    pandas:         0.21.1-py35h20b78c2_0 --> 0.22.0-py35hf484d3e_0
    pillow:         4.2.1-py35_0          --> 5.0.0-py35h3deb7b8_0
    pyqt:           4.11.4-py35_4         --> 5.6.0-py35h0e41ada_5
    python:         3.5.3-1               --> 3.5.4-h417fded_24
    qt:             4.8.7-3               --> 5.6.2-h974d657_12
    readline:       6.2-2                 --> 7.0-ha6073c6_4
    sip:            4.18-py35_0           --> 4.18.1-py35h9eaea60_2
    sqlite:         3.13.0-0              --> 3.21.0-h1bed415_2
    tk:             8.5.18-0              --> 8.6.7-hc745277_3
dustinvtran commented 6 years ago

No I think that req can be dropped.