Martin-Jung / LecoS

LecoS QGis Plugin - Contains several analytical functions for land cover analysis
GNU General Public License v3.0
21 stars 19 forks source link

lecos cant find python libraries with QGIS 3.4.5 #18

Closed darrennorris closed 5 years ago

darrennorris commented 5 years ago

This is a QGIS standalone issue. I added here: https://issues.qgis.org/issues/21593

Not a Lecos issue. I have retained here just for reference. Windows 10 - Lecos 3.0.0 cant find PIL with QGIS 3.4.5 standalone (traceback below). Appears that in the case of the standalone installed QGIS that the python library path used by lecos is mis-specified (1.4 when should be 3.4). PIL is installed via the standalone ........

Impossível carregar complemento 'LecoS' Devido a um erro ao chamar o método Class Factory().

SystemExit: 0

Traceback (most recent call last): File "C:/Users/Darren/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\LecoS\landscape_polygonoverlay.py", line 58, in import Image, ImageDraw File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python\qgis\utils.py", line 672, in _import mod = _builtin_import(name, globals, locals, fromlist, level) ModuleNotFoundError: No module named 'Image'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:/Users/Darren/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\LecoS\landscape_polygonoverlay.py", line 60, in from PIL import Image, ImageDraw File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python\qgis\utils.py", line 672, in _import mod = _builtin_import(name, globals, locals, fromlist, level) ModuleNotFoundError: No module named 'PIL'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python\qgis\utils.py", line 335, in startPlugin plugins[packageName] = package.classFactory(iface) File "C:/Users/Darren/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\LecoS__init__.py", line 36, in classFactory from .lecos_main import LecoS File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python\qgis\utils.py", line 672, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:/Users/Darren/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\LecoS\lecos_main.py", line 31, in from .lecos_sextanteprov import LecoSAlgorithmsProv File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python\qgis\utils.py", line 672, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:/Users/Darren/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\LecoS\lecos_sextanteprov.py", line 30, in from .lecos_sextantealgorithms import * File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python\qgis\utils.py", line 672, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:/Users/Darren/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\LecoS\lecos_sextantealgorithms.py", line 760, in from . import landscape_polygonoverlay as pov File "C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python\qgis\utils.py", line 672, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:/Users/Darren/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\LecoS\landscape_polygonoverlay.py", line 63, in sys.exit(0) SystemExit: 0

Versão do Python: 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] Versão do QGIS: 3.4.5-Madeira Madeira, 89ee6f6e23

Caminho do Python:

C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python
C:/Users/Darren/AppData/Roaming/QGIS/QGIS3\profiles\default/python
C:/Users/Darren/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins
C:/PROGRA~1/QGIS3~1.4/apps/qgis-ltr/./python/plugins
C:\Program Files\QGIS 3.4\bin\python37.zip
C:\PROGRA~1\QGIS3~1.4\apps\Python37\DLLs
C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib
C:\Program Files\QGIS 3.4\bin
C:\PROGRA~1\QGIS3~1.4\apps\Python37
C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib\site-packages
C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib\site-packages\win32
C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib\site-packages\win32\lib
C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib\site-packages\Pythonwin
C:/Users/Darren/AppData/Roaming/QGIS/QGIS3\profiles\default/python
darrennorris commented 5 years ago

Update. Not a lecos issue! Sorry. QGIS issue opened here: https://issues.qgis.org/issues/21593

It appears that the QGIS standalone installer cannot find the PIL library. Following help from @Martin-Jung , I used the python console and found that PIL cannot be found by QGIS. This same error occurs with both standalone versions of QGIS 3.4.5 and 3.6.0 . It is QGIS that is mis-specifying the PIL library path.

import PIL Traceback (most recent call last): File "C:\PROGRA~1\QGIS3~1.6\apps\Python37\lib\code.py", line 90, in runcode exec(code, self.locals) File "", line 1, in File "C:/PROGRA~1/QGIS3~1.6/apps/qgis/./python\qgis\utils.py", line 672, in _import mod = _builtin_import(name, globals, locals, fromlist, level) ModuleNotFoundError: No module named 'PIL'