UMEP-dev / UMEP

Urban Multi-scale Environmental Predictor
https://umep-docs.readthedocs.io/
59 stars 15 forks source link

Installing the UMEP plugin in QGIS for Linux #584

Closed kilsedar closed 6 months ago

kilsedar commented 6 months ago

Hello,

I would like to install the UMEP plugin in QGIS, and I believe the installation completes, but when I try to enable the plugin, the QGIS just shuts down after a few seconds. I tried the installation with QGIS versions 3.26 and 3.28 LTR. I installed the UMEP latest version 4.0.4 available in the repository and a few random previous versions using ZIP files; the result didn't change. The QGIS crash report says "Fatal Python error: Segmentation fault". I am working on Ubuntu 20.04. Exactly the same thing happens on another computer with the same setup. If you can guide me in the right direction, I would appreciate it. Thank you.

matthiasdemuzere commented 6 months ago

Mmm ... interesting. Just now I was also trying to install the plugin again. Installation works, but when trying to enable to plugin, QGIS just shuts down, without warning.

My system:

Ubuntu 22.04 Qgis 3.34 (from https://qgis.org/ubuntu) UMEP 4.0.4 Python version in console: 3.10.12

Any suggestions on how to go forward (or to further debug) or welcome!

j3r3m1 commented 6 months ago

It is definitely not a way to solve the issue but is the tool you need not available in the UMEP for processing version ?

kilsedar commented 6 months ago

The same thing happens with the "UMEP for processing" plugin, although I get the error "UMEP couldn't install Python packages! See 'General' tab in 'Log Messages' panel for details. Report any errors to https://github.com/UMEP-dev/UMEP-processing/issues" before the QGIS shuts down.

j3r3m1 commented 6 months ago

Weird, it seems to work well with:

Ubuntu 22.04 Qgis 3.28.3 UMEP 4.0.4 Python version in console: 3.10.9

matthiasdemuzere commented 6 months ago

For me, QGIS also shuts down when enabling the "UMEP for processing" plugin. Perhaps I can try with your system settings @j3r3m1 ...

j3r3m1 commented 6 months ago

The same thing happens with the "UMEP for processing" plugin, although I get the error "UMEP couldn't install Python packages! See 'General' tab in 'Log Messages' panel for details. Report any errors to https://github.com/UMEP-dev/UMEP-processing/issues" before the QGIS shuts down.

Do you use QGIS in a specific Python environment ? Did you try installing individual UMEP-req ? pip install numba pip install jaydebeapi==1.2.3 pip install netCDF4

j3r3m1 commented 6 months ago

For me, QGIS also shuts down when enabling the "UMEP for processing" plugin. Perhaps I can try with your system settings @j3r3m1 ...

Did you try the SNAPSHOT version downloading the zip and importing it in the "Manage and install plugin" window ?

biglimp commented 6 months ago

I saw some thread in qgis-developer@lists.osgeo.org that NetCDF4 could be problematic in the new version of QGIS. Maybe you should try to temporally remove that...

matthiasdemuzere commented 6 months ago

Do you use QGIS in a specific Python environment ?

When I was trying to fix this yesterday, I also tried to install QGIS in a dedicated python environment. But that did not work for me, as the console version in QGIS was different from the env in which I installed QGIS? So feel free to share any suggestions on how to do this properly ...

j3r3m1 commented 6 months ago

On Linux, I use to install QGIS using an anaconda environment. Once anaconda installed, I think something like that could work:

conda create --name your_conda_env
conda activate your_conda_env
conda config --add channels conda-forge
conda install gdal qgis=3.28.3 jaydebeapi=1.2.3 numba netCDF4
qgis

Then installing UMEP for processing within the QGIS window launched

j3r3m1 commented 6 months ago

I saw some thread in qgis-developer@lists.osgeo.org that NetCDF4 could be problematic in the new version of QGIS. Maybe you should try to temporally remove that...

Let's first see if the problem is raised when installing this specific library ? Otherwise an option would be to use only the xarray library without the netCDF4 library, even though it is recommended by the xarray package (https://docs.xarray.dev/en/stable/getting-started-guide/installing.html#for-netcdf-and-io). Here is a way to create the URock output netcdf without the netCDF4 library: https://towardsdatascience.com/how-to-create-xarray-datasets-cf1859c95921

kilsedar commented 6 months ago

On Linux, I use to install QGIS using an anaconda environment. Once anaconda installed, I think something like that could work:

conda create --name your_conda_env
conda activate your_conda_env
conda config --add channels conda-forge
conda install gdal qgis=3.28.3 jaydebeapi=1.2.3 numba netCDF4
qgis

Then installing UMEP for processing within the QGIS window launched

Following these steps, I could install the plugin! However, I had to install using conda several libraries manually: pandas, xlrd and xlwt. Thank you very much for the guidance.

j3r3m1 commented 6 months ago

Following these steps, I could install the plugin! However, I had to install using conda several libraries manually: pandas, xlrd and xlwt. Thank you very much fo

Thanks for your feedback

j3r3m1 commented 6 months ago

@matthiasdemuzere feel free to reopen if you still meet troubles

matthiasdemuzere commented 6 months ago

On Linux, I use to install QGIS using an anaconda environment. Once anaconda installed, I think something like that could work:

conda create --name your_conda_env
conda activate your_conda_env
conda config --add channels conda-forge
conda install gdal qgis=3.28.3 jaydebeapi=1.2.3 numba netCDF4
qgis

Then installing UMEP for processing within the QGIS window launched

Following these steps, I could install the plugin! However, I had to install using conda several libraries manually: pandas, xlrd and xlwt. Thank you very much for the guidance.

Thanks for these suggestions both. I have been following them, and installed QGIS in a conda environment. Yet when executing QGIS, I get to see the following:

(qgis) matthias@bkode:~$ qgis
Info: Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
Warning: Could not find the Qt platform plugin "wayland" in ""
Fatal: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, minimal, minimalegl, offscreen, vnc, webgl, xcb.

QGIS died on signal -1QGIS died on signal 11

It seems QT does not work well with Wayland. I have tried to QT_QPA_PLATFORM to any of the other, but that did not work.

@j3r3m1: since you also installed on 22.04, did you not bump into this issue?

j3r3m1 commented 6 months ago

No I have never faced such problem. In your "your_cond_env", can you try removing qgis and then install it but without any version conditionning ?

conda activate your_conda_env
conda remove qgis
conda install qgis

See if this solves the issue.

matthiasdemuzere commented 6 months ago

So, I first changed the XDG_SESSION_TYPE from wayland to xorg, system-wide, following these guidelines.

Now:

(qgis) matthias@bkode:~$ echo $XDG_SESSION_TYPE
x11

But I still got the wayland error when launching qgis. So, I freshly installed the environment and qgis. But still, I get the same error:

Warning: Could not find the Qt platform plugin "wayland" in ""
Fatal: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, minimal, minimalegl, offscreen, vnc, webgl, xcb.

QGIS died on signal -1QGIS died on signal 11

So, I then followed your last suggestion, removing qgis and installing without indicating a version. This is installing version qgis-3.30.1.

But ... unfortunately I still get the same error? Guess I'll have to keep trying ...

matthiasdemuzere commented 6 months ago

Ok, I think I got it to work. Here is what I did in addition, might be useful for others bumping into the same issue:

Installing:

sudo apt-get install python3-pyqt5
sudo apt install qtwayland5
sudo apt install qt6-wayland

Not sure though if any of these were required.

Then I also have to set: export QT_QPA_PLATFORM="xcb"

And then launching qgis. When I did, it also installed some other packages in the background. I actually had to launch qgis a number of times before that stopped.

But now QGIS runs, and UMEP is available.

The only thing I still see when launching qgis in the terminal is:

(PDAL Error) Can't load library /home/matthias/miniconda3/envs/qgis/lib/libpdal_plugin_reader_draco.so: Failed to load "/home/matthias/miniconda3/envs/qgis/lib/libpdal_plugin_reader_draco.so": libdraco.so.8: cannot open shared object file: No such file or directory(PDAL Error) Can't load library /home/matthias/miniconda3/envs/qgis/lib/libpdal_plugin_writer_draco.so: Failed to load "/home/matthias/miniconda3/envs/qgis/lib/libpdal_plugin_writer_draco.so": libdraco.so.8: cannot open shared object file: No such file or directory

I'll have to see if this will be a problem when actually working with any of the tools ...

Thanks for the support!

biglimp commented 6 months ago

pdal should not be required for any of the UMEP-tool. @matthiasdemuzere, can we migrate this issue over to discussions so that others easily might find it?

j3r3m1 commented 6 months ago

pdal should not be required for any of the UMEP-tool.

I suppose you mean gdal. gdal is used in many places of the UMEP code but called within the osgeo package (cf. example here. However, in anaconda, to install the osgeo package you need to download the gdal one (there is no package named osgeo).

matthiasdemuzere commented 6 months ago

I suppose you mean gdal. gdal is used in many places of the UMEP code but called within the osgeo package (cf. example here. However, in anaconda, to install the osgeo package you need to download the gdal one (there is no package named osgeo).

No, we were referring to PDAL ...