north-road / qgis-processing-r

QGIS Processing R Provider Plugin
https://north-road.github.io/qgis-processing-r/
GNU General Public License v3.0
63 stars 14 forks source link

Unable to run R script on Ubuntu #93

Closed careyshan closed 2 years ago

careyshan commented 3 years ago

Hey, I installed the Processing R Provider plugin and set up my paths. I then try and run the sample script Min_Max and it tries to install a lot of R packages - however it fails saying it cannot configure properly. It appears that the problem package is 'sf'. Has anyone else had a similar issue and if so, how do you fix it?

Thanks

gavg712 commented 3 years ago

Hi @careyshan.

If I understand correctly, you are wanting to use the system R libraries and not the qgis user libraries. For that, you must disable the one that says "Use user library folder instead of system libraries". This will make Processing R provider use the libraries installed through the R console or Rstudio.

image

careyshan commented 3 years ago

Hey @gavg712,

I tried that but it doesn't seem to make any difference for me.

Cheers

gavg712 commented 2 years ago

It is not easy for me to imagine what the issue might be. Could you share more details about the problem?

Cheers

careyshan commented 2 years ago

Fair point. When I try to run it, it gives me this: min_max And it just hangs there forever without an error

QGIS 3.20 R version 3.6.3 Ubuntu 20.04

gavg712 commented 2 years ago

Two reasons can trigger the installation of packages in the Processing R provider.

In Ubuntu most of the packages are installed from source code. That may explain the excessive time spent when running a rscript from processing (maybe more than half an hour, depending on the computer). Although this will be done only once and they will be installed in the new library configured inside the ~/.local/share/QGIS/QGIS3/profiles/default/processing/rlibs directory by default. So if everything goes well the first time, the following times will be faster running.

The last recommendation is to update R to the latest version (4.1.1) to take advantage of the many improvements it brings. Perhaps also some packages may depend on newer versions of R.

careyshan commented 2 years ago

Ok so I update to the latest R version and let it run. This is the error I get: error

gavg712 commented 2 years ago

Some packages require system libraries in order to be compiled from source code. For example sf requires libudunits2-dev, libgdal-dev, etc... etc. These must be installed separately from the Ubuntu package manager (apt, aptidude, etc) before installing the packages. Not all packages depend on these libraries and they are not always the same libraries. It is therefore recommended to install from an R or Rstudio session in order to see which dependency each package requires.

For a reference of what I mean you can watch this video (sorry, in spanish) on how to solve dependency issues in Linux: https://youtu.be/8Dx40TlF4fk?t=1212

gavg712 commented 2 years ago

If it helps, here is a list of dependencies for some R packages: https://packagemanager.rstudio.com/client/#/repos/1/overview

Make sure you select the correct Linux version (Ubuntu 20.04 in your case).

careyshan commented 2 years ago

Thanks @gavg712 - sf is the problem package and when I follow that youtube clip, I get an error saying fix held broken packages. I'll try figure that out and hopefully that should sort it - thanks for all your help. Cheers

careyshan commented 2 years ago

Hey @gavg712 - your video helped great - I got it working in the end thanks to your help. That's super - cheers

gavg712 commented 2 years ago

It is a pleasure. When you are ready you could close the issue.

CC: @nyalldawson

careyshan commented 2 years ago

Thanks for the great work