1

When I try to run the SEC caffe model on from here: https://github.com/kolesman/SEC

I geht the error: ImportError: No module named PyQt4

python demo.py --model SEC.caffemodel --image /data/out/dataset/center/1475186965759787059.jpg --smooth --output result.png
Traceback (most recent call last):
  File "demo.py", line 2, in <module>
    import pylab
  File "/home/ec2-user/anaconda2/lib/python2.7/site-packages/pylab.py", line 1, in <module>
    from matplotlib.pylab import *
  File "/home/ec2-user/anaconda2/lib/python2.7/site-packages/matplotlib/pylab.py", line 274, in <module>
    from matplotlib.pyplot import *
  File "/home/ec2-user/anaconda2/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/ec2-user/anaconda2/lib/python2.7/site-packages/matplotlib/backends/__init__.py", line 32, in pylab_setup
    globals(),locals(),[backend_name],0)
  File "/home/ec2-user/anaconda2/lib/python2.7/site-packages/matplotlib/backends/backend_qt5agg.py", line 16, in <module>
    from .backend_qt5 import QtCore
  File "/home/ec2-user/anaconda2/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/ec2-user/anaconda2/lib/python2.7/site-packages/matplotlib/backends/qt_compat.py", line 137, in <module>
    from PyQt4 import QtCore, QtGui
ImportError: No module named PyQt4

In this stackoverflow thread they just mention that you can run

conda install pyqt

which results in the following output:

conda install pyqt
Fetching package metadata .......
Solving package specifications: ..........

# All requested packages already installed.
# packages in environment at /home/ec2-user/anaconda2:
#
pyqt                      5.6.0                    py27_0 

Which indicates that I have version 5.6 and not version 4. But I could not find any solution how to downgrade to pyqt4.

Community
  • 1
  • 1
Orlando
  • 1,576
  • 2
  • 15
  • 20

2 Answers2

2

so you can Uninstall pyqt5 and download PyQt4 and installed manually The second option is to modify the code and replace PyQt4 by pyqt5 just pay attention to one thing that the classes in pyqt5 are the same but the irritation is bit different so you may get that specific model doesn't exist in this case check on manual of pyqt5 and fix it I hope my answer is clear

Ismail
  • 53
  • 9
2

It looks like the latest version of anaconda forces install of pyqt5.6 over any pyqt build, which will be fatal for your applications. In a terminal, Try:

conda install --channel https://conda.anaconda.org/conda-forge pyqt
conda install -c anaconda pyqt=4.11.4

It will prompt to downgrade conda client. After that, it should be good.

Alaaedeen
  • 390
  • 3
  • 7