Bug report #14656

ImportError: No module named PyQt

Added by dr - over 8 years ago. Updated over 8 years ago.

Status:Rejected
Priority:Normal
Assignee:-
Category:Python plugins
Affected QGIS version:master Regression?:No
Operating System:Ubuntu Easy fix?:No
Pull Request or Patch supplied:No Resolution:worksforme
Crashes QGIS or corrupts data:No Copied to github as #:22620

Description

Latest Master.

$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import qgis
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/qgis/__init__.py", line 26, in <module>
    from PyQt import QtCore
ImportError: No module named PyQ

History

#1 Updated by Alexander Bruy over 8 years ago

  • Resolution set to worksforme
  • Status changed from Open to Rejected

Works fine under Windows and Linux with latest master f04de1ba97.

$ python
Python 2.7.9 (default, Mar  1 2015, 12:57:24) 
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import qgis
>>> from qgis.core import QGis
>>> QGis.QGIS_VERSION_INT
21500
>>> QGis.QGIS_DEV_VERSION
'f04de1b'
>>>

#2 Updated by dr - over 8 years ago

There is no PyQt package in system:

$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyQt4
>>> import PyQt
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named PyQt

#3 Updated by Alexander Bruy over 8 years ago

This is internal QGIS thing. And of course you can import this package.

$ python
Python 2.7.9 (default, Mar  1 2015, 12:57:24) 
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyQt
>>> import PyQt4
>>> import qgis
>>> import qgis.core
>>> import qgis.gui
>>> from qgis.core import QGis
>>> QGis.QGIS_VERSION_INT
21500
>>> QGis.QGIS_DEV_VERSION
'f04de1b'
>>> 

Seems you system is messed up

#4 Updated by dr - over 8 years ago

There is no PyQt directory in /usr/lib/python2.7/dist-packages/qgis. I've tried to reinstall python-qgis package but no success.

#5 Updated by dr - over 8 years ago

It seems now for using qgis package I have to specify PYTHONPATH:

export PYTHONPATH="${PYTHONPATH}:/usr/share/qgis/python" 
$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import qgis
>>>

But before it worked without it. Is it expected behavior?

Also available in: Atom PDF