Skip to main content
Tweeted twitter.com/StackGIS/status/1569928952134746114
edited tags; edited title; edited tags
Link
PolyGeo
  • 65.5k
  • 29
  • 115
  • 353

How can I fix Fixing "ImportError: No module named qgis.core"?

edited title
Link
underdark
  • 85k
  • 22
  • 238
  • 419

QGIS and Python (API) How can I fix "ImportError: No module named qgis.core"?

added 3 characters in body
Source Link
Chad Cooper
  • 12.8k
  • 4
  • 48
  • 88

First of all, I'm using Python 2.7.3, QGIS 1.8 (Lisboa) on Windows 7 pro 64 bits. Now let's go to the actual question:

I have written some code (Python) that works well within the QGIS built in Python console, but now I need to run it from outside QGIS (it is too much to ask for the final user to open QGIS, then the python console and to copy and paste the code). 

I have written some code (Python) that works well within the QGIS built in Python console, but now I need to run it from outside QGIS (it is too much to ask for the final user to open QGIS, then the python console and to copy and paste the code).

I have been trying to access the QGIS API, but it is missing from my PYTHONPATH. I've tried whatever is on the instructions, plus a bunch of paths like: C:\Program Files(x86)\QGIS\apps\qgis\python\qgis and C:\Program Files(x86)\QGIS\apps\qgis\python. My My result so far is always the same:

import qgis.core ImportError: No module named qgis.core

import qgis.core ImportError: No module named qgis.core 

Any ideas?

First of all, I'm using Python 2.7.3, QGIS 1.8 (Lisboa) on Windows 7 pro 64 bits. Now let's go to the actual question:

I have written some code (Python) that works well within the QGIS built in Python console, but now I need to run it from outside QGIS (it is too much to ask for the final user to open QGIS, then the python console and to copy and paste the code). 

I have been trying to access the QGIS API, but it is missing from my PYTHONPATH. I've tried whatever is on the instructions, plus a bunch of paths like: C:\Program Files(x86)\QGIS\apps\qgis\python\qgis and C:\Program Files(x86)\QGIS\apps\qgis\python. My result so far is always the same:

import qgis.core ImportError: No module named qgis.core

Any ideas?

First of all, I'm using Python 2.7.3, QGIS 1.8 (Lisboa) on Windows 7 pro 64 bits. Now let's go to the actual question:

I have written some code (Python) that works well within the QGIS built in Python console, but now I need to run it from outside QGIS (it is too much to ask for the final user to open QGIS, then the python console and to copy and paste the code).

I have been trying to access the QGIS API, but it is missing from my PYTHONPATH. I've tried whatever is on the instructions, plus a bunch of paths like: C:\Program Files(x86)\QGIS\apps\qgis\python\qgis and C:\Program Files(x86)\QGIS\apps\qgis\python. My result so far is always the same:

import qgis.core ImportError: No module named qgis.core 

Any ideas?

Source Link
Pedro Camargo
  • 111
  • 1
  • 1
  • 3
Loading