semiautomaticgit / SemiAutomaticClassificationPlugin

https://fromgistors.blogspot.com/p/semi-automatic-classification-plugin.html
Other
136 stars 50 forks source link

Plugin Crashes Q when attempting to save ROI to training input, opens multiple new Q windows #149

Closed macromicrobe closed 9 months ago

macromicrobe commented 3 years ago

I apologize if this is a resolved issue, but I am a relatively new user of Q from the field of microbiology.

Whenever I go to save a temporary ROI to training input, Q attempts to open 3 new windows that give these warnings/errors in the log messages panel:


2021-01-09T13:40:48 WARNING Plugin processing : This plugin is disabled because it previously crashed QGIS. 2021-01-09T13:40:50 CRITICAL Invalid Data Source : /-c is not a valid or recognized data source. 2021-01-09T13:40:50 CRITICAL Invalid Data Source : /from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=57, pipe_handle=59) is not a valid or recognized data source. 2021-01-09T13:40:50 CRITICAL Invalid Data Source : /--multiprocessing-fork is not a valid or recognized data source.


Here is the Python error I get:


An error has occurred while executing Python code:

ValueError: need at least one array to stack Traceback (most recent call last): File "/Users/cissell/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/SemiAutomaticClassificationPlugin/dock/scpdock.py", line 2036, in saveROItoShapefile cfg.utls.calculateSignature(cfg.shpLay, cfg.bandSetsList[bandSetNumber][8], [self.ROILastID], cfg.ROIMacroID, cfg.ROIMacroClassInfo, cfg.ROIID, cfg.ROIInfo, 50, 40, 'No', 'No', UID, bandSetNumber = bandSetNumber) File "/Users/cissell/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/SemiAutomaticClassificationPlugin/core/utils.py", line 1591, in calculateSignature covMat = cfg.utls.calculateCovMatrix(ROIArray) File "/Users/cissell/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/SemiAutomaticClassificationPlugin/core/utils.py", line 825, in calculateCovMatrix matrix = cfg.np.stack(arrayList) File "", line 6, in stack File "/Applications/QGIS.app/Contents/MacOS/lib/python3.7/site-packages/numpy-1.19.1-py3.7-macosx-10.13.0-x86_64.egg/numpy/core/shape_base.py", line 423, in stack raise ValueError('need at least one array to stack') ValueError: need at least one array to stack

Python version: 3.7.7 (default, Sep 22 2020, 10:25:18) [Clang 12.0.0 (clang-1200.0.32.2)] QGIS version: 3.16.2-Hannover Hannover, c6ac5a6052


And it just remains at 80% completion indefinitely on "creating ROI".

I have attached the log file from attempting this action ("save_ROI_error_log.txt").

I also have log file when I click the "Check Dependencies" button ("check_dependencies_error_log.txt"). Clicking this button triggers the same effect as I have described above. Please find the log file attached.

I am using SCP Version 7.3.7 with Q Version 3.16.2 on a MacBook Pro (BigSur).

I tried reinstalling Q and reinstalling the plugin. I tried this on a different computer with an entirely fresh install of Q, with the same error.

Any help is greatly appreciated. save_ROI_error_log.txt check_dependencies_error_log.txt

semiautomaticgit commented 3 years ago

Hello @macromicrobe , I think it is related to this issue https://github.com/semiautomaticgit/SemiAutomaticClassificationPlugin/issues/144

Please update to the latest version 7.4.0, click the button "Test dependencies" and report the log file.

macromicrobe commented 3 years ago

Hello @semiautomaticgit , Many thanks for your reply. I have updated to the latest version, and have attached the log file.

It no longer attempts to open multiple new instances of Q, but still throws a Python error and cannot save the ROI. Please find below the Python errors for both attempting to save an ROI, and from the "Test dependencies" run.

2021-01-10T13:44:52 WARNING Traceback (most recent call last): File "/Users/cissell/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/SemiAutomaticClassificationPlugin/dock/scpdock.py", line 2036, in saveROItoShapefile cfg.utls.calculateSignature(cfg.shpLay, cfg.bandSetsList[bandSetNumber][8], [self.ROILastID], cfg.ROIMacroID, cfg.ROIMacroClassInfo, cfg.ROIID, cfg.ROIInfo, 50, 40, 'No', 'No', UID, bandSetNumber = bandSetNumber) File "/Users/cissell/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/SemiAutomaticClassificationPlugin/core/utils.py", line 1591, in calculateSignature covMat = cfg.utls.calculateCovMatrix(ROIArray) File "/Users/cissell/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/SemiAutomaticClassificationPlugin/core/utils.py", line 825, in calculateCovMatrix matrix = cfg.np.stack(arrayList) File "", line 6, in stack File "/Applications/QGIS.app/Contents/MacOS/lib/python3.7/site-packages/numpy-1.19.1-py3.7-macosx-10.13.0-x86_64.egg/numpy/core/shape_base.py", line 423, in stack raise ValueError('need at least one array to stack') ValueError: need at least one array to stack

2021-01-10T13:45:14 WARNING Traceback (most recent call last): File "/Users/cissell/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/SemiAutomaticClassificationPlugin/maininterface/settings.py", line 262, in testDependencies testMultiprocess = self.testMultiprocess() File "/Users/cissell/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/SemiAutomaticClassificationPlugin/maininterface/settings.py", line 307, in testMultiprocess mp.set_executable(flPrefPy) NameError: name 'mp' is not defined

test_dependencies_7.4.txt

semiautomaticgit commented 3 years ago

Hello @macromicrobe , please update again to version 7.4.2

macromicrobe commented 3 years ago

Hello @semiautomaticgit ,

Many thanks for your continued help.

Apologies for not updating to the most recent version. I am now at 7.4.2, and have attached the log.

test_dependencies_7_4_2.txt

semiautomaticgit commented 3 years ago

Thank you.

Please open the tab Processing setting and try to enter in Python executable path: /usr/bin/python3

Also, in GDAL directory you should enter the path to the directory containing tools such as gdal_translate and gdalwarp

macromicrobe commented 3 years ago

Hello @semiautomaticgit ,

I have now added the Python path, and the path to GDAL directory, in Processing settings. Here is the log file from "test dependencies" after adding these paths and restarting.

test.txt

semiautomaticgit commented 3 years ago

Thank you, I think we are getting closer to finding the cause of the issue. Please update to version 7.4.3 and copy the log file again.

macromicrobe commented 3 years ago

Hello @semiautomaticgit ,

Thank you for your continued help! I have updated to 7.4.3, and attached the log file.

test.txt

semiautomaticgit commented 3 years ago

Thank you very much. Please update to version 7.4.4. It shouldn't solve the issue, but should provide information about the cause of the issue.

macromicrobe commented 3 years ago

Thank you, @semiautomaticgit .

I have now updated. Please find attached the new log. log.txt

semiautomaticgit commented 3 years ago

The good thing is that GDAL was correctly found. Please update again to version 7.4.5, hopefully this will provide information about Python multiprocessing.

macromicrobe commented 3 years ago

@semiautomaticgit ,

The "Test dependencies" now fails with a Python error:

2021-01-10T17:44:44 WARNING Traceback (most recent call last): File "/Users/cissell/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/SemiAutomaticClassificationPlugin/maininterface/settings.py", line 262, in testDependencies testMultiprocess = self.testMultiprocess() File "/Users/cissell/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/SemiAutomaticClassificationPlugin/maininterface/settings.py", line 334, in testMultiprocess dPref = [cfg.ui.python_path_lineEdit.text()].rstrip('python3') AttributeError: 'list' object has no attribute 'rstrip'

2021-01-10T17:45:02 WARNING Traceback (most recent call last): File "/Users/cissell/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/SemiAutomaticClassificationPlugin/maininterface/settings.py", line 262, in testDependencies testMultiprocess = self.testMultiprocess() File "/Users/cissell/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/SemiAutomaticClassificationPlugin/maininterface/settings.py", line 334, in testMultiprocess dPref = [cfg.ui.python_path_lineEdit.text()].rstrip('python3') AttributeError: 'list' object has no attribute 'rstrip'

semiautomaticgit commented 3 years ago

sorry, that was my fault, please update to version 7.4.6

macromicrobe commented 3 years ago

My apologies for posting this reply on the wrong issue. I will repost it here for continuity on this specific issue.

Clicking the "Test dependencies" button now causes Q to not respond, and will not generate a log file or errors. I have attempted 10 times now, all with the same result.

Thank you again for your support.

semiautomaticgit commented 3 years ago

Thank you, please try version 7.4.7

macromicrobe commented 3 years ago

Unfortunately, I am still encountering the same issue with version 7.4.7 where Q stops responding and I am unable to generate a log or receive errors.

semiautomaticgit commented 3 years ago

Thank you for your cooperation. Please try version 7.4.8

macromicrobe commented 3 years ago

@semiautomaticgit ,

Thank you for your continued effort! Please find attached the log from 7.4.8.

log_7_4_8.txt

macromicrobe commented 3 years ago

Just a note - when I restarted Q, I encounter the previous crashing issue when attempting to check dependencies.

semiautomaticgit commented 3 years ago

Thank you. Did you set also the Python path?

macromicrobe commented 3 years ago

I did. Currently it is set as /usr/bin/python3 under the Python executable path in Processing setting.

semiautomaticgit commented 3 years ago

OK, maybe you can check if there are other directories containing python3 However I think it is an installation issue. Other users reported that SCP works with KyngChaos package QGIS 3.16.2-2, maybe you can try this

macromicrobe commented 3 years ago

I will try this. Many thanks for all of your help, @semiautomaticgit !

semiautomaticgit commented 3 years ago

Hello, it seems that /usr/local is not created by default. A possible solution from https://www.facebook.com/groups/SemiAutomaticClassificationPlugin/permalink/3722826171146887/?comment_id=3740311452731692 In a Terminal: (if you have a libcrypto and libssl in /usr/local/lib this will overwrite them) sudo ln -sf /Library/Frameworks/Python.framework/Versions/3.9/lib/libssl.dylib /usr/local/lib/libssl.dylib sudo ln -sf /Library/Frameworks/Python.framework/Versions/3.9/lib/libcrypto.dylib /usr/local/lib/libcrypto.dylib If usr/local doesn't exist, though it should, even if it's empty. Try: sudo mkdir -p /usr/local/lib Then, the ln commands and try to do processing on QGIS.

semiautomaticgit commented 9 months ago

I'm closing this because of the new version 8 of SCP. Please reopen it if it is still relevant in the new version. Thank you!