anaconda / docker-images

Repository of Docker images created by Anaconda
https://hub.docker.com/u/continuumio/
832 stars 281 forks source link

add libgl to Anaconda docker images #49

Open nicolashery opened 7 years ago

nicolashery commented 7 years ago

I'm not sure if this is related to the Docker image, conda, or PyQt5, but here is the repro:

docker run -it continuumio/miniconda bash

root@486a15ca93d5:/# conda install pyqt

root@486a15ca93d5:/# python -c "from PyQt5 import QtGui"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: libGL.so.1: cannot open shared object file: No such file or directory

root@486a15ca93d5:/# conda list
# packages in environment at /opt/conda:
#
cffi                      1.9.1                    py27_0
conda                     4.3.8                    py27_0
conda-env                 2.6.0                         0
cryptography              1.7.1                    py27_0
dbus                      1.10.10                       0
enum34                    1.1.6                    py27_0
expat                     2.1.0                         0
fontconfig                2.12.1                        2
freetype                  2.5.5                         2
glib                      2.50.2                        1
gst-plugins-base          1.8.0                         0
gstreamer                 1.8.0                         0
icu                       54.1                          0
idna                      2.2                      py27_0
ipaddress                 1.0.18                   py27_0
jpeg                      9b                            0
libffi                    3.2.1                         1
libgcc                    5.2.0                         0
libiconv                  1.14                          0
libpng                    1.6.27                        0
libxcb                    1.12                          1
libxml2                   2.9.4                         0
openssl                   1.0.2h                        1
pcre                      8.39                          1
pip                       8.1.2                    py27_0
pyasn1                    0.1.9                    py27_0
pycosat                   0.6.1                    py27_1
pycparser                 2.17                     py27_0
pycrypto                  2.6.1                    py27_4
pyopenssl                 16.2.0                   py27_0
pyqt                      5.6.0                    py27_2
python                    2.7.12                        1
pyyaml                    3.11                     py27_4
qt                        5.6.2                         3
readline                  6.2                           2
requests                  2.12.4                   py27_0
ruamel_yaml               0.11.14                  py27_0
setuptools                23.0.0                   py27_0
sip                       4.18                     py27_0
six                       1.10.0                   py27_0
sqlite                    3.13.0                        0
tk                        8.5.18                        0
wheel                     0.29.0                   py27_0
yaml                      0.1.6                         0
zlib                      1.2.8                         3

If I downgrade to PyQt4 however, things seem to work:

root@486a15ca93d5:/# conda install pyqt=4
root@486a15ca93d5:/# python -c "from PyQt4 import QtGui"
nicolashery commented 7 years ago

I've tried using another miniconda Docker image, and I'm getting the same error. So this might not be an issue with the image. Do let me know if you have any ideas though.

docker run -it show0k/alpine-miniconda bash

bash-4.3$ conda install pyqt

bash-4.3$ python -c "from PyQt5 import QtGui"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
piec commented 7 years ago

Just install mesa's libgl apt update apt install libgl1-mesa-swx11

mribbons commented 7 years ago

for me

$ sudo apt install libgl1-mesa-glx

was the solution.

$ conda list | grep qt
pyqt                      5.6.0                    py27_2
qt                        5.6.2                         4
qtawesome                 0.4.4                    py27_0
qtpy                      1.2.1                    py27_0

Ubuntu 16.04.2

djfang commented 7 years ago

For those using yum, it is: sudo yum install mesa-libGL.x86_64

drcrook1 commented 7 years ago

I am using python 3 and none of these solutions appear to work. I have a dependency on matplotlib.pyplot and am using a container that is hidden from me that I believe is based on one of these.

keisuke-nakata commented 7 years ago

I have the same problem.

docker run -it continuumio/anaconda3:5.0.0 /bin/bash
> python -c "import matplotlib.pyplot as plt; fig=plt.Figure(); fig.savefig('foo.png')"

just throws error:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/conda/lib/python3.6/site-packages/matplotlib/pyplot.py", line 115, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "/opt/conda/lib/python3.6/site-packages/matplotlib/backends/__init__.py", line 32, in pylab_setup
    globals(),locals(),[backend_name],0)
  File "/opt/conda/lib/python3.6/site-packages/matplotlib/backends/backend_qt5agg.py", line 16, in <module>
    from .backend_qt5 import QtCore
  File "/opt/conda/lib/python3.6/site-packages/matplotlib/backends/backend_qt5.py", line 26, in <module>
    import matplotlib.backends.qt_editor.figureoptions as figureoptions
  File "/opt/conda/lib/python3.6/site-packages/matplotlib/backends/qt_editor/figureoptions.py", line 20, in <module>
    import matplotlib.backends.qt_editor.formlayout as formlayout
  File "/opt/conda/lib/python3.6/site-packages/matplotlib/backends/qt_editor/formlayout.py", line 56, in <module>
    from matplotlib.backends.qt_compat import QtGui, QtWidgets, QtCore
  File "/opt/conda/lib/python3.6/site-packages/matplotlib/backends/qt_compat.py", line 128, in <module>
    from PyQt5 import QtCore, QtGui, QtWidgets
ImportError: libGL.so.1: cannot open shared object file: No such file or directory

And

docker run -it continuumio/anaconda3:5.0.0 /bin/bash
> python -c "import matplotlib as mpl; mpl.use('Agg'); import matplotlib.pyplot as plt; fig=plt.Figure(); fig.savefig('foo.png')"

throws error:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/conda/lib/python3.6/site-packages/matplotlib/figure.py", line 1573, in savefig
    self.canvas.print_figure(*args, **kwargs)
AttributeError: 'NoneType' object has no attribute 'print_figure'

It seems that the anaconda3:5.0.0 docker container misses matplotlib support.

jennirinker commented 6 years ago

This workaround (which was mentioned above) worked for me today on the latest anaconda3 docker image. These are the lines I added near the top of my dockerfile.

RUN apt-get update && \
    apt-get install libgl1-mesa-glx -y
kalefranz commented 6 years ago

@mingwandroid Do you think it makes sense to include libgl in these Docker images? I'm thinking the extra weight makes sense for the Anaconda images, but not for Miniconda.

mingwandroid commented 6 years ago

Yes. Sounds fine to me.

mingwandroid commented 6 years ago

We should also add: libgl1-mesa-glx mesa-libGL libXcomposite libXcursor libXi libXtst libXScrnSaver libXrandr alsa-lib mesa-libEGL (or the debian equivalents, though we should use RHEL6/CentOS6 as the base IMHO).

kalefranz commented 6 years ago

though we should use RHEL6/CentOS6 as the base IMHO

Why? Not disagreeing. Just curious what the rational is.

mingwandroid commented 6 years ago

Because that it the base OS level that we target.

mbargull commented 6 years ago

@mingwandroid, is there some kind of official document stating all base requirements for anaconda? https://docs.anaconda.com/anaconda/install/#system-requirements only gives

Linux, including Ubuntu, RedHat, CentOS 6+, and others

without stating any additional libraries.

mingwandroid commented 6 years ago

It's always been an implicit requirement that a Linux system requires the 'normal' desktop stack to run Anaconda (but not Miniconda).

Qt 5.9 brings in a lot more of these due to chromium. Yes, we need to make that explicit though and provide better instructions for the most common distros, perhaps even checking in the AD install script (for now?). Ping @csoja and @nehaljwani.

Also now that we have identified CDT packages in our recipes we should be able to have conda recommend what system packages to install and how to install them when it finds them missing. The CDT packages are not known to the solver though but we could have conda look at the rendered recipe for this, perhaps? You'd need a mapping from the CentOS6 packages names to other distro packages names somewhere too.

nehaljwani commented 6 years ago

I second @mingwandroid and yes, it would be nice to have the docs mention the low level system deps for popular distros for being able to use all the conda packages provided in the anaconda installer.

hungdev commented 5 years ago

thanks, @djfang. it worked for me.