tproduit / pic2map

QGIS plugin for camera orientation and interaction between a picture and the map (monoplotting).
22 stars 5 forks source link

Error when I activate the plugin #28

Open L-I-S-T-A opened 3 months ago

L-I-S-T-A commented 3 months ago

When I install the plugin in QGIS 3.34, I receive this message: ImportError: cannot import name 'ImageQt' from 'PIL.ImageQt' (C:\PROGRA~1\QGIS33~1.4\apps\Python39\lib\site-packages\PIL\ImageQt.py) I don't know how I can do. Thanks for any suggestion.

thymaro commented 2 months ago

I have just the same issue. Here is the message displayed:

Couldn't load plugin 'Pic2Map' due to an error when calling its classFactory() method

ImportError: cannot import name 'ImageQt' from 'PIL.ImageQt' (C:\OSGeo4W\apps\Python39\lib\site-packages\PIL\ImageQt.py)

Traceback (most recent call last):
  File "C:\OSGeo4W/apps/qgis-ltr/./python\qgis\utils.py", line 423, in _startPlugin
    plugins[packageName] = package.classFactory(iface)
  File "C:\Users/username/AppData/Roaming/QGIS/QGIS3\profiles\username/python/plugins\Pic2Map\__init__.py", line 25, in classFactory
    from .pic2Map import Pic2Map
  File "C:\OSGeo4W/apps/qgis-ltr/./python\qgis\utils.py", line 892, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\Users/username/AppData/Roaming/QGIS/QGIS3\profiles\username/python/plugins\Pic2Map\pic2Map.py", line 24, in 
    from .getGCPMainWindow import GetGCPMainWindow
  File "C:\OSGeo4W/apps/qgis-ltr/./python\qgis\utils.py", line 892, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\Users/username/AppData/Roaming/QGIS/QGIS3\profiles\username/python/plugins\Pic2Map\getGCPMainWindow.py", line 38, in 
    from PIL.ImageQt import ImageQt
ImportError: cannot import name 'ImageQt' from 'PIL.ImageQt' (C:\OSGeo4W\apps\Python39\lib\site-packages\PIL\ImageQt.py)

Python version: 3.9.18 (heads/master:5eba59e, Feb 1 2024, 20:02:10) [MSC v.1929 64 bit (AMD64)] QGIS version: 3.34.5-Prizren Prizren, 4b308492

Python Path:

  • C:/OSGeo4W/apps/qgis-ltr/./python
  • C:/Users/username/AppData/Roaming/QGIS/QGIS3\profiles\beku/python
  • C:/Users/username/AppData/Roaming/QGIS/QGIS3\profiles\beku/python/plugins
  • C:/OSGeo4W/apps/qgis-ltr/./python/plugins
  • C:\OSGeo4W\apps\grass\grass83\etc\python
  • C:\somepath
  • C:\OSGeo4W\bin\python39.zip
  • C:\OSGeo4W\apps\Python39\DLLs
  • C:\OSGeo4W\apps\Python39\lib
  • C:\OSGeo4W\bin
  • C:\OSGeo4W\apps\Python39
  • C:\OSGeo4W\apps\Python39\lib\site-packages
  • C:\OSGeo4W\apps\Python39\lib\site-packages\win32
  • C:\OSGeo4W\apps\Python39\lib\site-packages\win32\lib
  • C:\OSGeo4W\apps\Python39\lib\site-packages\Pythonwin
  • C:/Users/username/AppData/Roaming/QGIS/QGIS3\profiles\username/python
  • C:\Users\username\AppData\Roaming\QGIS\QGIS3\profiles\username\python\plugins\mmqgis/forms
  • C:\Users\username\AppData\Roaming\QGIS\QGIS3\profiles\username\python\plugins\qfieldsync\libqfieldsync.whl
  • C:/somepath

I opened osgeo4w shell and checked PyQt5, which is satisfied. I then also tried with installing PySide2, which did not resolve the issue. I am uncertain what else I can do.

L-I-S-T-A commented 2 months ago

Hi, I resolved it this way:

I hope it works! GP


Dott. Giulio F. Pappafico https://www.uniurb.it/persone/giulio-pappafico LISTA https://listauniurb.jimdo.com/ - DiSPeA https://www.uniurb.it/it/portale/dispea.php?&lang=IT&tipo=DISPEA&page=02958

Campus scientifico 'Enrico Mattei' https://goo.gl/maps/yjgUs1afNEs Università degli Studi di Urbino 'Carlo Bo' https://www.uniurb.it/, via Ca' Le Suore, 61029 Urbino (PU), Italy

https://www.uniurb.it/

Il giorno gio 18 apr 2024 alle ore 06:14 Furao Sentu < @.***> ha scritto:

I have just the same issue. Here is the message displayed:

Couldn't load plugin 'Pic2Map' due to an error when calling its classFactory() method

ImportError: cannot import name 'ImageQt' from 'PIL.ImageQt' (C:\OSGeo4W\apps\Python39\lib\site-packages\PIL\ImageQt.py)

Traceback (most recent call last): File "C:\OSGeo4W/apps/qgis-ltr/./python\qgis\utils.py", line 423, in _startPlugin plugins[packageName] = package.classFactory(iface) File "C:\Users/username/AppData/Roaming/QGIS/QGIS3\profiles\username/python/plugins\Pic2Map__init__.py", line 25, in classFactory from .pic2Map import Pic2Map File "C:\OSGeo4W/apps/qgis-ltr/./python\qgis\utils.py", line 892, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:\Users/username/AppData/Roaming/QGIS/QGIS3\profiles\username/python/plugins\Pic2Map\pic2Map.py", line 24, in from .getGCPMainWindow import GetGCPMainWindow File "C:\OSGeo4W/apps/qgis-ltr/./python\qgis\utils.py", line 892, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:\Users/username/AppData/Roaming/QGIS/QGIS3\profiles\username/python/plugins\Pic2Map\getGCPMainWindow.py", line 38, in from PIL.ImageQt import ImageQt ImportError: cannot import name 'ImageQt' from 'PIL.ImageQt' (C:\OSGeo4W\apps\Python39\lib\site-packages\PIL\ImageQt.py)

Python version: 3.9.18 (heads/master:5eba59e, Feb 1 2024, 20:02:10) [MSC v.1929 64 bit (AMD64)] QGIS version: 3.34.5-Prizren Prizren, 4b308492

Python Path:

  • C:/OSGeo4W/apps/qgis-ltr/./python
  • C:/Users/username/AppData/Roaming/QGIS/QGIS3\profiles\beku/python
  • C:/Users/username/AppData/Roaming/QGIS/QGIS3\profiles\beku/python/plugins

  • C:/OSGeo4W/apps/qgis-ltr/./python/plugins
  • C:\OSGeo4W\apps\grass\grass83\etc\python
  • C:\somepath
  • C:\OSGeo4W\bin\python39.zip
  • C:\OSGeo4W\apps\Python39\DLLs
  • C:\OSGeo4W\apps\Python39\lib
  • C:\OSGeo4W\bin
  • C:\OSGeo4W\apps\Python39
  • C:\OSGeo4W\apps\Python39\lib\site-packages
  • C:\OSGeo4W\apps\Python39\lib\site-packages\win32
  • C:\OSGeo4W\apps\Python39\lib\site-packages\win32\lib
  • C:\OSGeo4W\apps\Python39\lib\site-packages\Pythonwin
  • C:/Users/username/AppData/Roaming/QGIS/QGIS3\profiles\username/python
  • C:\Users\username\AppData\Roaming\QGIS\QGIS3\profiles\username\python\plugins\mmqgis/forms

  • C:\Users\username\AppData\Roaming\QGIS\QGIS3\profiles\username\python\plugins\qfieldsync\libqfieldsync.whl

  • C:/somepath

I opened osgeo4w shell and checked PyQt5, which is satisfied. I then also tried with installing PySide2, which did not resolve the issue. I am uncertain what else I can do.

— Reply to this email directly, view it on GitHub https://github.com/tproduit/pic2map/issues/28#issuecomment-2062956561, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB2GWXH2GKSIF47YTPLQPLDY55CCDAVCNFSM6AAAAABETSJX3OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRSHE2TMNJWGE . You are receiving this because you authored the thread.Message ID: @.***>

thymaro commented 2 months ago

Editing the Python file worked by changing line 38 from

from PIL.ImageQt import ImageQt

to

from PIL import ImageQt

even though it's weird that it works like that, but who am I to judge.

After that, I can load in a picture and a DEM and choose GCPs. Generating a 3D view doesn't work (the 3D view window stays white with no content) and running the monoplotter is not an option, as the “play” button is gray and stays gray, unconditional of my actions.