Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pixel Profile: Spectral Library Viewer does not open #488

Closed
tramsauer opened this issue May 23, 2023 · 14 comments
Closed

Pixel Profile: Spectral Library Viewer does not open #488

tramsauer opened this issue May 23, 2023 · 14 comments
Assignees
Labels
bug Something isn't working upstream Needs changes in an upstream library not developed by EnMAP-Box team (like Qt, Proj, GDAL, ...)
Milestone

Comments

@tramsauer
Copy link

Clicking the Pixel Profile button throws a python error TypeError: QgsSingleSymbolRenderer(): not enough arguments and the Spectral Library Viewer does not show up.

Steps to reproduce:

  • Install EnMAP Box via
    conda env create -n enmapbox_full_3.28 -f https://raw.githubusercontent.com/EnMAP-Box/enmap-box/main/.conda/enmapbox_full_3.28.yml --> Version 3.12.1 Code d96477c01d1
  • Add example data via menu
  • Click Identify pixel profile..
  • System: Ubuntu 22.04

--

Stacktrace
TypeError: QgsSingleSymbolRenderer(): not enough arguments 
Traceback (most recent call last):
  File "/home/ramsauer/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/gui/enmapboxgui.py", line 1438, in 
    lambda crs, pt, c=canvas: self.setCurrentLocation(SpatialPoint(crs, pt), canvas)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ramsauer/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/gui/enmapboxgui.py", line 1893, in setCurrentLocation
    self.loadCurrentMapSpectra(spatialPoint, mapCanvas)
  File "/home/ramsauer/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/gui/enmapboxgui.py", line 1489, in loadCurrentMapSpectra
    dock = self.createDock(SpectralLibraryDock)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ramsauer/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/gui/enmapboxgui.py", line 1961, in createDock
    return self.mDockManager.createDock(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ramsauer/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/gui/dataviews/dockmanager.py", line 746, in createDock
    dock = SpectralLibraryDock(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ramsauer/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/gui/dataviews/docks.py", line 816, in __init__
    self.mSpeclibWidget: SpectralLibraryWidget = SpectralLibraryWidget(parent=self, speclib=speclib)
                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ramsauer/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/qgispluginsupport/qps/speclib/gui/spectrallibrarywidget.py", line 66, in __init__
    self.mSpeclibPlotWidget: SpectralLibraryPlotWidget = SpectralLibraryPlotWidget()
                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ramsauer/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/qgispluginsupport/qps/speclib/gui/spectrallibraryplotwidget.py", line 1436, in __init__
    self.mPlotControlModel = SpectralProfilePlotModel()
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ramsauer/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/qgispluginsupport/qps/speclib/gui/spectrallibraryplotwidget.py", line 184, in __init__
    self.mDefaultSymbolRenderer = QgsSingleSymbolRenderer(symbol)
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: QgsSingleSymbolRenderer(): not enough arguments


Python-Version: 3.11.3 | packaged by conda-forge | (main, Apr  6 2023, 09:14:54) [GCC 11.3.0] 
QGIS-Version: 3.28.6-Firenze Firenze, exported 

Python-Pfad:
/home/ramsauer/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/apps/ensomap
/home/ramsauer/bin/anaconda3/envs/enmapbox_full_3.28/share/qgis/python
/home/ramsauer/.local/share/QGIS/QGIS3/profiles/default/python
/home/ramsauer/.local/share/QGIS/QGIS3/profiles/default/python/plugins
/home/ramsauer/bin/anaconda3/envs/enmapbox_full_3.28/share/qgis/python/plugins
/home/ramsauer/bin/anaconda3/envs/enmapbox_full_3.28/share/qgis/python/plugins
/home/ramsauer/bin/anaconda3/envs/enmapbox_full_3.28/share/qgis/python
/home/ramsauer/.local/share/QGIS/QGIS3/profiles/default
/home/ramsauer/bin/anaconda3/envs/enmapbox_full_3.28/lib/python311.zip
/home/ramsauer/bin/anaconda3/envs/enmapbox_full_3.28/lib/python3.11
/home/ramsauer/bin/anaconda3/envs/enmapbox_full_3.28/lib/python3.11/lib-dynload
/home/ramsauer/bin/anaconda3/envs/enmapbox_full_3.28/lib/python3.11/site-packages
/home/ramsauer/.local/share/QGIS/QGIS3/profiles/default/python
/home/ramsauer/.local/share/QGIS/QGIS3/profiles/default/python/plugins/ee_plugin/extlibs_linux
/home/ramsauer/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/site-packages
/home/ramsauer/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin
/home/ramsauer/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/qgispluginsupport/qps/pyqtgraph
/home/ramsauer/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/site-packages
/home/ramsauer/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/apps
/home/ramsauer/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/coreapps
/home/ramsauer/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/eo4qapps
.
/home/ramsauer/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapbox/apps/lmuapps
@janzandr janzandr added bug Something isn't working upstream Needs changes in an upstream library not developed by EnMAP-Box team (like Qt, Proj, GDAL, ...) labels May 23, 2023
@janzandr janzandr added this to the 3.12.2 milestone May 23, 2023
@jakimowb
Copy link
Contributor

jakimowb commented Jun 5, 2023

I can reproduce it

@danschef
Copy link
Contributor

@jakimowb I also just ran into this with QGIS 3.30, Python 3.11, EnMAP-Box 3.130-alpha-0, and Windows 11.

@jakimowb
Copy link
Contributor

jakimowb commented Jun 28, 2023

The problem can be reduced to:

from qgis.core import QgsMarkerSymbol, QgsSingleSymbolRenderer, QgsFeatureRenderer
symbol = QgsMarkerSymbol.createSimple({'name': 'square', 'color': 'white'})
renderer = QgsSingleSymbolRenderer(symbol)
assert isinstance(renderer, QgsFeatureRenderer)

Maybe this is a problem of the conda QGIS / python version?

jakimowb added a commit that referenced this issue Jun 28, 2023
Signed-off-by: jakimowb <[email protected]>
@danschef
Copy link
Contributor

danschef commented Jun 28, 2023

The problem can be reduced to:

from qgis.core import QgsMarkerSymbol, QgsSingleSymbolRenderer, QgsFeatureRenderer
symbol = QgsMarkerSymbol.createSimple({'name': 'square', 'color': 'white'})
renderer = QgsSingleSymbolRenderer(symbol)
assert isinstance(renderer, QgsFeatureRenderer)

Maybe this is a problem of the conda QGIS / python version?

I reproduced this with different QGIS versions installed frm conda-forge (mamba create -n qgis "qgis=3.xx.x):

  • 3.32.0: fails
  • 3.30.3: fails
  • 3.30.2: fails
  • 3.30.1: fails
  • 3.30.0: works
  • 3.28.8: fails

So it looks like a quick-fix would be to pin QGIS to 3.30.0 for now.

The question is only if this comes from qgis itself or from the conda-forge packaging.

@jakimowb
Copy link
Contributor

jakimowb commented Jun 28, 2023

@danschef maybee it is caused by the python version? Here are my OSGeo results:

import sys
from qgis.core import Qgis, QgsMarkerSymbol, QgsSingleSymbolRenderer
print(sys.version)
print(Qgis.versionInt())
symbol = QgsMarkerSymbol.createSimple({'name': 'square', 'color': 'white'})
renderer = QgsSingleSymbolRenderer(symbol)
QGIS Python Distribution Fail?
3.32.0 mamba fail
3.30.3 mamba fail
3.30.0 mamba works
3.28.8 mamba fail
3.33.0 3.9.5 OSGeo works
3.32.0 3.9.5 OSGeo works
3.28.8 3.9.5 OSGeo works

@danschef
Copy link
Contributor

No, I guess it is a packaging issue with the conda-forge builds. QGIS 3.28.8 + Python 3.9.16 from conda-forge also fails.

@danschef
Copy link
Contributor

Lets see is anyone from the qgis-feedstock maintainers has an idea.

@danschef
Copy link
Contributor

@jakimowb
According to conda-forge/qgis-feedstock#346 (comment), it might make sense to temporarily implement a try/except clause to make the Spectral Library Viewer work for now.

jakimowb added a commit that referenced this issue Jun 30, 2023
added conda recipes

Signed-off-by: jakimowb <[email protected]>
@jakimowb
Copy link
Contributor

jakimowb commented Jul 2, 2023

@danschef there are probably many more cases where the conda build fail: conda-forge/qgis-feedstock#346 (comment)

@jakimowb
Copy link
Contributor

jakimowb commented Jul 2, 2023

So far I found these examples

from qgis.core import *
from qgis.gui import *

QgsFillSymbol()
QgsMarkerSymbol()
QgsFillSymbol()
QgsLineSymbol()
QgsExpressionContext([]) 
QgsRendererCategory(1, QgsFillSymbol(), 'name', render=False)

jakimowb added a commit to EnMAP-Box/qgispluginsupport that referenced this issue Jul 2, 2023
@danschef
Copy link
Contributor

danschef commented Aug 7, 2023

@jakimowb @janzandr

I tested the fixed conda-forge build of QGIS 3.32.1 on Windows and Linux and I can confirm that it fixes this issue here (see conda-forge/qgis-feedstock#346). Version 3.28.9 (should be the stable release) was tested by @SrNetoChan.

So, I think we can close this.

@danschef
Copy link
Contributor

danschef commented Aug 7, 2023

However, it might make sense to update your conda environment files to make sure the right builds are picked.

@SrNetoChan
Copy link

For updating qgis ltr, you may need to search for all builds for 3.28.9

conda search qgis=3.28.9 -c conda-forge

Choose the one that match your env pinned python (bellow is 3.11) and with a build number 1 suffix (_1) and do something like

conda install qgis=3.28.9=py311hf5818de_1

@jakimowb
Copy link
Contributor

closed by #613 (updated conda environments in ./conda

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working upstream Needs changes in an upstream library not developed by EnMAP-Box team (like Qt, Proj, GDAL, ...)
Projects
None yet
Development

No branches or pull requests

5 participants