CSIRO-Precision-Agriculture / PAT_QGIS_Plugin

PAT is a QGIS plugin containing a collection of tools for processing precision agriculture data.
Other
25 stars 8 forks source link

2021-08-03T14:33:14 WARNING Python error : Couldn't load plugin 'pat' due to an error when calling its classFactory() method See message log (Python Error) for more details. #59

Closed JRichetti closed 1 year ago

JRichetti commented 2 years ago

Can't load PAT on QGIS 3.20

2021-08-03T14:33:14     CRITICAL    Traceback (most recent call last):
              File "C:\Users/ric375/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\pat\util\check_dependencies.py", line 420, in check_python_dependencies
              create_link(shortcutPath, install_file, "Install setup for QGIS PAT Plugin",
              File "C:\Users/ric375/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\pat\util\check_dependencies.py", line 519, in create_link
              file_link.Save(link_path, 0)
             pywintypes.com_error: (-2147024893, 'The system cannot find the path specified.', None, None)

             During handling of the above exception, another exception occurred:

             Traceback (most recent call last):
              File "C:\PROGRA~1/QGIS32~1.1/apps/qgis/./python\qgis\utils.py", line 335, in _startPlugin
              plugins[packageName] = package.classFactory(iface)
              File "C:\Users/ric375/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\pat\__init__.py", line 128, in classFactory
              check_py = check_python_dependencies(PLUGIN_DIR, iface)
              File "C:\Users/ric375/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\pat\util\check_dependencies.py", line 472, in check_python_dependencies
              setup = get_plugin_state()
              File "C:\Users/ric375/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\pat\util\check_dependencies.py", line 550, in get_plugin_state
              plug_state += ' {:20}\t{}\n'.format('pyPrecAg :', get_distribution('pyprecag').version)
              File "C:\PROGRA~1\QGIS32~1.1\apps\Python39\lib\site-packages\pkg_resources\__init__.py", line 466, in get_distribution
              dist = get_provider(dist)
              File "C:\PROGRA~1\QGIS32~1.1\apps\Python39\lib\site-packages\pkg_resources\__init__.py", line 342, in get_provider
              return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
              File "C:\PROGRA~1\QGIS32~1.1\apps\Python39\lib\site-packages\pkg_resources\__init__.py", line 886, in require
              needed = self.resolve(parse_requirements(requirements))
              File "C:\PROGRA~1\QGIS32~1.1\apps\Python39\lib\site-packages\pkg_resources\__init__.py", line 772, in resolve
              raise DistributionNotFound(req, requirers)
             pkg_resources.DistributionNotFound: The 'pyprecag' distribution was not found and is required by the application
cratcliff commented 2 years ago

Currently there is a compatibility issue with the newer versions of PAT. Until this is resolved please install the QGIS Standalone Standalone installer for long term release with continued dependencies from old OSGeo4W - QGIS Standalone Installer Version 3.16 (64 bit) image

JRichetti commented 2 years ago

Still unable to load PAT on 3.16 :(

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

pkg_resources.DistributionNotFound: The 'pyprecag' distribution was not found and is required by the application 
Traceback (most recent call last):
  File "C:/Users/ric375/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\pat\util\check_dependencies.py", line 421, in check_python_dependencies
    user_path, True)
  File "C:/Users/ric375/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\pat\util\check_dependencies.py", line 519, in create_link
    file_link.Save(link_path, 0)
pywintypes.com_error: (-2147024893, 'The system cannot find the path specified.', None, None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/PROGRA~1/QGIS3~1.16/apps/qgis-ltr/./python\qgis\utils.py", line 334, in _startPlugin
    plugins[packageName] = package.classFactory(iface)
  File "C:/Users/ric375/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\pat\__init__.py", line 128, in classFactory
    check_py = check_python_dependencies(PLUGIN_DIR, iface)
  File "C:/Users/ric375/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\pat\util\check_dependencies.py", line 472, in check_python_dependencies
    setup = get_plugin_state()
  File "C:/Users/ric375/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\pat\util\check_dependencies.py", line 550, in get_plugin_state
    plug_state += '    {:20}\t{}\n'.format('pyPrecAg :', get_distribution('pyprecag').version)
  File "C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\site-packages\pkg_resources\__init__.py", line 482, in get_distribution
    dist = get_provider(dist)
  File "C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\site-packages\pkg_resources\__init__.py", line 358, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  File "C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\site-packages\pkg_resources\__init__.py", line 901, in require
    needed = self.resolve(parse_requirements(requirements))
  File "C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\site-packages\pkg_resources\__init__.py", line 787, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pyprecag' distribution was not found and is required by the application

Python version: 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] QGIS version: 3.16.9-Hannover Hannover, 9f8d2f7942

Python Path:
C:/PROGRA~1/QGIS3~1.16/apps/qgis-ltr/./python
C:/Users/ric375/AppData/Roaming/QGIS/QGIS3\profiles\default/python
C:/Users/ric375/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins
C:/PROGRA~1/QGIS3~1.16/apps/qgis-ltr/./python/plugins
C:\PROGRA~1\QGIS3~1.16\apps\Python37
C:\PROGRA~1\QGIS3~1.16\apps\Python37\Scripts
C:\Program Files\QGIS 3.16\bin\python37.zip
C:\PROGRA~1\QGIS3~1.16\apps\Python37\DLLs
C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib
C:\Program Files\QGIS 3.16\bin
C:\Users\ric375\AppData\Roaming\Python\Python37\site-packages
C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\site-packages
C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\site-packages\win32
C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\site-packages\win32\lib
C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\site-packages\Pythonwin
C:/Users/ric375/AppData/Roaming/QGIS/QGIS3\profiles\default/python
cratcliff commented 2 years ago

@JRichetti I have had a more in-depth look at your issue. It is caused by the desktop folder being located on OneDrive.

Until the fix is released follow the Running batch file as administrator instructions in the manual.

andre5620 commented 2 years ago

The file .bat doesn't work.

install Python 3 extras to support PAT.

for 3.16.9-Hannover C:\Program Files\QGIS 3.16

install dependencies for QGIS PAT Plugin.... Please Wait Dependencies Log: C:\Users\dedeh\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\pat\install_files\dependency_2022-06-11.log ERROR: Command errored out with exit status 1: command: 'C:\PROGRA~1\QGIS3~1.16\apps\Python37\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\dedeh\AppData\Local\Temp\pip-install-bdogsofp\fiona\setup.py'"'"'; file='"'"'C:\Users\dedeh\AppData\Local\Temp\pip-install-bdogsofp\fiona\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\dedeh\AppData\Local\Temp\pip-pip-egg-info-lqvs8g6h' cwd: C:\Users\dedeh\AppData\Local\Temp\pip-install-bdogsofp\fiona\ Complete output (1 lines): A GDAL API version must be specified. Provide a path to gdal-config using a GDAL_CONFIG environment variable or use a GDAL_VERSION environment variable.

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. Running "C:\Program Files\QGIS 3.16\bin\o4w_env.bat" Running "C:\PROGRA~1\QGIS3~1.16\bin\py3_env.bat"

There is any soluiton for this ?

cratcliff commented 1 year ago

@andre5620 Try the version I have just released in the QGIS plugins manager.

JRichetti commented 1 year ago

Looks like the new update fixed it! :)