PyQT4 error when running Moving Pictures tutorial

I installed a new instance of Qiime2 (2017.4) within a Docker image with this definition:

###########
## Qiime ##

# Dependency: miniconda
RUN wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
RUN bash Miniconda3-latest-Linux-x86_64.sh -b -p /opt/miniconda
ENV PATH $PATH:/opt/miniconda/bin
RUN rm Miniconda3-latest-Linux-x86_64.sh

# Attempt to resolve python Click library errors
ENV LC_ALL C.UTF-8
ENV LANG C.UTF-8

# Primary: Qiime2-2017.2
RUN conda create -n qiime2-2017.4 --file https://data.qiime2.org/distro/core/qiime2-2017.4-conda-linux-64.txt

This worked without error. But I get a PyQt4 error when I run through the tutorial.

source activate qiime2-2017.4

mkdir qiime2-moving-pictures-tutorial
cd qiime2-moving-pictures-tutorial
wget -O "sample-metadata.tsv" "https://data.qiime2.org/2017.4/tutorials/moving-pictures/sample_metadata.tsv"
mkdir emp-single-end-sequences
wget -O "emp-single-end-sequences/barcodes.fastq.gz" "https://data.qiime2.org/2017.4/tutorials/moving-pictures/emp-single-end-sequences/barcodes.fastq.gz"
wget -O "emp-single-end-sequences/sequences.fastq.gz" "https://data.qiime2.org/2017.4/tutorials/moving-pictures/emp-single-end-sequences/sequences.fastq.gz"

(qiime2-2017.4) root@8ed7c1cdb0b5:/qiime2-moving-pictures-tutorial# qiime tools import --type EMPSingleEndSequences --input-path emp-single-end-sequences --output-path emp-single-end-sequences.qza
Traceback (most recent call last):
  File "/opt/miniconda/envs/qiime2-2017.4/bin/qiime", line 6, in <module>
    sys.exit(q2cli.__main__.qiime())
  File "/opt/miniconda/envs/qiime2-2017.4/lib/python3.5/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/opt/miniconda/envs/qiime2-2017.4/lib/python3.5/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/opt/miniconda/envs/qiime2-2017.4/lib/python3.5/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/miniconda/envs/qiime2-2017.4/lib/python3.5/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/miniconda/envs/qiime2-2017.4/lib/python3.5/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/miniconda/envs/qiime2-2017.4/lib/python3.5/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/opt/miniconda/envs/qiime2-2017.4/lib/python3.5/site-packages/q2cli/tools.py", line 62, in import_data
    view_type=source_format)
  File "/opt/miniconda/envs/qiime2-2017.4/lib/python3.5/site-packages/qiime2/sdk/result.py", line 155, in import_data
    type_ = qiime2.sdk.parse_type(type_)
  File "/opt/miniconda/envs/qiime2-2017.4/lib/python3.5/site-packages/qiime2/sdk/util.py", line 57, in parse_type
    pm = qiime2.sdk.PluginManager()
  File "/opt/miniconda/envs/qiime2-2017.4/lib/python3.5/site-packages/qiime2/sdk/plugin_manager.py", line 44, in __new__
    self._init()
  File "/opt/miniconda/envs/qiime2-2017.4/lib/python3.5/site-packages/qiime2/sdk/plugin_manager.py", line 58, in _init
    plugin = entry_point.load()
  File "/opt/miniconda/envs/qiime2-2017.4/lib/python3.5/site-packages/setuptools-27.2.0-py3.5.egg/pkg_resources/__init__.py", line 2258, in load
  File "/opt/miniconda/envs/qiime2-2017.4/lib/python3.5/site-packages/setuptools-27.2.0-py3.5.egg/pkg_resources/__init__.py", line 2264, in resolve
  File "/opt/miniconda/envs/qiime2-2017.4/lib/python3.5/site-packages/q2_diversity/__init__.py", line 9, in <module>
    from ._alpha import (alpha, alpha_phylogenetic, alpha_group_significance,
  File "/opt/miniconda/envs/qiime2-2017.4/lib/python3.5/site-packages/q2_diversity/_alpha/__init__.py", line 10, in <module>
    from ._method import (alpha, alpha_phylogenetic, phylogenetic_metrics,
  File "/opt/miniconda/envs/qiime2-2017.4/lib/python3.5/site-packages/q2_diversity/_alpha/_method.py", line 11, in <module>
    import skbio.diversity
  File "/opt/miniconda/envs/qiime2-2017.4/lib/python3.5/site-packages/skbio/__init__.py", line 13, in <module>
    import skbio.io  # noqa
  File "/opt/miniconda/envs/qiime2-2017.4/lib/python3.5/site-packages/skbio/io/__init__.py", line 238, in <module>
    import_module('skbio.io.format.lsmat')
  File "/opt/miniconda/envs/qiime2-2017.4/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/opt/miniconda/envs/qiime2-2017.4/lib/python3.5/site-packages/skbio/io/format/lsmat.py", line 77, in <module>
    from skbio.stats.distance import DissimilarityMatrix, DistanceMatrix
  File "/opt/miniconda/envs/qiime2-2017.4/lib/python3.5/site-packages/skbio/stats/distance/__init__.py", line 192, in <module>
    from ._base import (DissimilarityMatrixError, DistanceMatrixError,
  File "/opt/miniconda/envs/qiime2-2017.4/lib/python3.5/site-packages/skbio/stats/distance/_base.py", line 12, in <module>
    import matplotlib.pyplot as plt
  File "/opt/miniconda/envs/qiime2-2017.4/lib/python3.5/site-packages/matplotlib/pyplot.py", line 115, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "/opt/miniconda/envs/qiime2-2017.4/lib/python3.5/site-packages/matplotlib/backends/__init__.py", line 32, in pylab_setup
    globals(),locals(),[backend_name],0)
  File "/opt/miniconda/envs/qiime2-2017.4/lib/python3.5/site-packages/matplotlib/backends/backend_qt5agg.py", line 16, in <module>
    from .backend_qt5 import QtCore
  File "/opt/miniconda/envs/qiime2-2017.4/lib/python3.5/site-packages/matplotlib/backends/backend_qt5.py", line 26, in <module>
    import matplotlib.backends.qt_editor.figureoptions as figureoptions
  File "/opt/miniconda/envs/qiime2-2017.4/lib/python3.5/site-packages/matplotlib/backends/qt_editor/figureoptions.py", line 20, in <module>
    import matplotlib.backends.qt_editor.formlayout as formlayout
  File "/opt/miniconda/envs/qiime2-2017.4/lib/python3.5/site-packages/matplotlib/backends/qt_editor/formlayout.py", line 56, in <module>
    from matplotlib.backends.qt_compat import QtGui, QtWidgets, QtCore
  File "/opt/miniconda/envs/qiime2-2017.4/lib/python3.5/site-packages/matplotlib/backends/qt_compat.py", line 137, in <module>
    from PyQt4 import QtCore, QtGui
ImportError: No module named 'PyQt4'

Hi @jorvis

We have an official Docker image, I would suggest starting there! We have done all the necessary configuration to get it up and running in a container format for you!

To comment on your specific error, because Docker is running in a headless environment (e.g. Docker), you have to configure your Matplotlib Backend as such. Moving forward though I would recommend our official QIIME 2 Docker image! Thanks!

1 Like

@jorvis, I should note, you can still create a custom image based on the official one, since Docker supports inheritance:

FROM qiime2/core:2017.4

RUN some_custom_script.sh

Good luck!

I’ll work on the reconfiguration of matplotlib, as you suggested. For technical reasons, I’m not sure the custom qiime2 docker image is an option.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.