ibab / tensorflow-wavenet

A TensorFlow implementation of DeepMind's WaveNet paper
MIT License
5.41k stars 1.29k forks source link

ImportError: No module named PyQt4 #154

Closed kaihuchen closed 8 years ago

kaihuchen commented 8 years ago

I just installed WaveNet on my Google Cloud instance and trying to make it run for the first time, but I am getting the error message 'ImportError: No module named PyQt4' when I execute 'python train.py --help'. The full traceback looks like this:

Traceback (most recent call last):
  File "train.py", line 20, in <module>
    from wavenet import WaveNetModel, AudioReader, optimizer_factory
  File "/home/kaihuchen01/tests/wavenet/wavenet/__init__.py", line 2, in <module>
    from .audio_reader import AudioReader
  File "/home/kaihuchen01/tests/wavenet/wavenet/audio_reader.py", line 6, in <module>
    import librosa
  File "/home/kaihuchen01/anaconda2/envs/cloudml/lib/python2.7/site-packages/librosa/__init__.py", line 18, in <module>
    from . import display
  File "/home/kaihuchen01/anaconda2/envs/cloudml/lib/python2.7/site-packages/librosa/display.py", line 21, in <module>
    import matplotlib.pyplot as plt
  File "/home/kaihuchen01/anaconda2/envs/cloudml/lib/python2.7/site-packages/matplotlib/pyplot.py", line 114, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "/home/kaihuchen01/anaconda2/envs/cloudml/lib/python2.7/site-packages/matplotlib/backends/__init__.py", line 32, in pylab_setup
    globals(),locals(),[backend_name],0)
  File "/home/kaihuchen01/anaconda2/envs/cloudml/lib/python2.7/site-packages/matplotlib/backends/backend_qt5agg.py", line 16, in <module>
    from .backend_qt5 import QtCore
  File "/home/kaihuchen01/anaconda2/envs/cloudml/lib/python2.7/site-packages/matplotlib/backends/backend_qt5.py", line 31, in <module>
    from .qt_compat import QtCore, QtGui, QtWidgets, _getSaveFileName, __version__
  File "/home/kaihuchen01/anaconda2/envs/cloudml/lib/python2.7/site-packages/matplotlib/backends/qt_compat.py", line 137, in <module>
    from PyQt4 import QtCore, QtGui
ImportError: No module named PyQt4

Any advice how I can fix this problem? Note that I have no problem running other implementation derived from WaveNet, such as this one https://github.com/Zeta36/tensorflow-tex-wavenet

ibab commented 8 years ago

The reason that the other implementation doesn't throw the same error is that it doesn't import librosa, as it doesn't need to do audio processing. Can you try creating a matplotlibrc file containing

backend : pdf

in the directory that you run the training script from?

wuaalb commented 8 years ago

The dev version of librosa no longer auto-imports librosa.display, might also be an option..

kaihuchen commented 8 years ago

@ibab Your solution does work so WaveNet runs correctly for me now. Thank you so much for your help!