I\'ve reïnstalled my ssh server, so I also need to reïnstall my Python packages.
I did that, but I still get the error:
ImportError: No module named PyQt
Try this command to solve your problem.
sudo apt install build-essential python3-dev libqt4-dev
This works for me in python3.
I had the same issue when uninstalled my Python27 and re-installed it.
I downloaded the sip-4.15.5 and PyQt-win-gpl-4.10.4 and installed/configured both of them. it still gives 'ImportError: No module named PyQt4.QtCore'. I tried to move the files/folders in Lib to make it looked 'have' but not working.
in fact, jut download the Windows 64 bit installer for a suitable Python version (my case) from http://www.riverbankcomputing.co.uk/software/pyqt/download and installed it, will do the job.
* March 2017 update *
The given link says, Binary installers for Windows are no longer provided.
See cgohlke's answer at, PyQt4 and 64-bit python.
You don't have g++ installed, simple way to have all the needed build tools is to install the package build-essential:
sudo apt-get install build-essential
, or just the g++ package:
sudo apt-get install g++
I had the "No module named PyQt4.QtCore" error and installing the python-qt4 package fixed it only partially: I could run
from PyQt4.QtCore import SIGNAL
from a python interpreter but only without activating my virtualenv.
The only solution I've found till now to use a virtualenv is to copy the PyQt4 folder and the sip.so file into my virtualenv as explained here: Is it possible to add PyQt4/PySide packages on a Virtualenv sandbox?
As mentioned in the comments, you need to install the python-qt4
package - no need to recompile it yourself.
sudo apt-get install python-qt4
I got the same error, when I was trying to import matplotlib.pyplot
In [1]: import matplotlib.pyplot as plt
...
...
ImportError: No module named PyQt4.QtCore
But in my case the problem was due to a missing linux library libGL.so.1
OS : Cent OS 64 bit
Python version : 3.5.2
$> locate libGL.so.1
If this command returns a value, your problem could be different, so please ignore my answer. If it does not return any value and your environment is same as mine, below steps would fix your problem.
$> yum install mesa-libGL.x86_64
This installs the necessary OpenGL libraries for 64 bit Cent OS.
$> locate libGL.so.1
/usr/lib/libGL.so.1
Now go back to iPython and try to import
In [1]: import matplotlib.pyplot as plt
This time it imported successfully.