Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I installed OSGeo4W. I have no other Python version on my computer. I can import osgeo. But when I try to import qgis.core I am getting the error:

>>> import qgis.core
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named qgis.core

What could be the reason for that?

share|improve this question
Are you running this in QGIS python console? – underdark Mar 8 '13 at 6:25
No, I am not. I am running it in the command line. Can I use QGIS only in the QIS python console? – ustroetz Mar 8 '13 at 17:30
up vote 1 down vote accepted

This error means that the qgis.core module is not in your PYTHONPATH.

See the instructions in the PyQGIS cookbook on how to use the QGIS API from a python script running outside of QGIS:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.