1

new error messageI have updated the package spatstat, which is divided into various packages. All of them are updated except one, spatstat.data. I have tried install.packages("spatstat.data") and update.packages("spatstat.data")

Error Message

error message

My question is: is it possible to download the spatstat.data zip file from cran, unzip the folder, copy all the folders and paste them to the right library?

I have seen this option in another post, which I wonder if will work, install.packages("name of the package.zip", repos = NULL)

I am using windows 10 and R 4.0.3 (updated to 4.2.2). I am using QGIS.

Isaiah
  • 2,091
  • 3
  • 19
  • 28
david 007
  • 11
  • 3
  • From the error message the issue seems to be that an older version of `spatstat.utils`(2.3.0) is already loaded while `spatstat.data` requires `3.0.0`. Try with restarting your R session. Then try again. – stefan Dec 31 '22 at 09:50
  • @stefan I updated spatstat.utils yesterday, but apparently it hasn't been updated to the latest version 3.0.1, but rather to the version 2.3.0. Is there a way to tell R that I want to install the latest version of spatstat.utils? Many thanks – david 007 Dec 31 '22 at 10:20
  • Maybe something went wrong. `install.packages("spatstat.utils")` should give you the latest version, i.e. `3.0.1`. Just checked on my Mac. – stefan Dec 31 '22 at 10:24
  • @stefan I have just updated spatstat.utils again but I still got the version 2.3.0. I am using R version 4.0.3 and in the package description it says that it was Built: R 4.0.5. Could be here the problem? Thanks again – david 007 Dec 31 '22 at 10:39
  • Hm. The built version should not be an issue. Do you get any errors or messages when running `install.packages("spatstat.utils")`? And make sure to restart your R session. Especially on Windows. (; – stefan Dec 31 '22 at 10:42
  • @stefan I am running the script install.packages("spatstat.utils") in R console within QGIS, because in that way it updates my R library in QGIS, which is the one that my R scripts in QGIS use. Do you think that I could install spatstat.utils directly in R, and after copy the folder from R library and paste into QGIS R folder? Would it work? – david 007 Dec 31 '22 at 11:01
  • Worth a try. What does `.libPaths()` return? – Isaiah Jan 02 '23 at 03:27
  • @stefan the error message that I get when installing spatstat.utils is this: there is a binary version but the source version is later. I attach a screenshot with the error message – david 007 Jan 06 '23 at 09:00
  • On the cran page for [spatstat: Spatial Point Pattern Analysis, Model-Fitting, Simulation, Tests](https://cran.r-project.org/web/packages/spatstat/index.html), the required version of `spatstat.utils` is ≥ 3.0, but the binary version that you install is 2.3. So it looks like you will need to install the source version. This will mean compiling the source version, which requires `Rtools.` Your screen shot message says that `Rtools` is not installed, so you will need to install it. – Isaiah Jan 06 '23 at 09:41
  • In your first screen shot, in the first line after the red line, you can see a message about the same version issue. Personally, I would update to R 4.3 before I installed Rtools, as Rtools install is version specific [RTools: Toolchains for building R and R packages from source on Windows](https://cran.r-project.org/bin/windows/Rtools/) (I see you are using windows and R ver 4). – Isaiah Jan 06 '23 at 09:55
  • @Isaiah thanks. It seems that I need to update my R version, which is 4.0.3 in order to install Rtools and be able to install the latest version of the package. – david 007 Jan 06 '23 at 10:16
  • After you install `Rtools`, install `spatstat.utils` again, but this time, when you get asked "Do you want to install from sources the package which needs compilation? (Yes/no/cancel)" say Yes. – Isaiah Jan 06 '23 at 10:53
  • @Isaiah Thanks for your advice. I will do it like that – david 007 Jan 06 '23 at 17:51
  • @Isaiah quick question from me. Have you used the package installr to update R? Is it a good option for a not very experienced user? thanks for your help – david 007 Jan 07 '23 at 10:39
  • I do use it. Like it! – Isaiah Jan 07 '23 at 10:52
  • R 4.0 will work, if you are not comfortable with updating R. – Isaiah Jan 07 '23 at 11:58
  • @Isaiah many thanks. I will use the package installr to update my current version of R. – david 007 Jan 07 '23 at 18:01
  • @david007, how did this go? – Isaiah Jan 22 '23 at 11:23
  • @Isaiah thanks for asking. I have just installed rtools42, OS: Windows 10, but I believe I need to do a further step in order to be operative rtools, because it doesn't seen to be working. I have tried to install "spatstat.utils", type "source" and is not working. Do you know what step am I missing in the installation of rtools? Thanks again for your help – david 007 Feb 11 '23 at 12:54
  • Have you installed the devtools package? `install.packages("devtools")` Once devtools is installed, load it using library, then try `find_rtools()` – Isaiah Feb 11 '23 at 21:34
  • Also, can you please run `R.version`? – Isaiah Feb 11 '23 at 22:13
  • @Isaiah I haven't installed devtools. I will install it this morning. By the way, what do you mind by "can I run R.Version? – david 007 Feb 12 '23 at 08:47
  • @Isaiah I installed devtools. I have executed library() and I couldn't see Rtools, but there is a package called "tools Tools for Package Development" which I don't know if is actually Rtools. – david 007 Feb 12 '23 at 09:04
  • I run find_rtools() and I got [1] TRUE – david 007 Feb 12 '23 at 09:05
  • 1
    new R version, 4.2.2, OS windows 10 – david 007 Feb 12 '23 at 09:06
  • So my question is:If I want to install spatstat.data last version: install.packages("spatstat.data", type "source"), do I need to call first Rtools? – david 007 Feb 12 '23 at 09:26
  • This is the error message I get when trying to install spatstat.utils: Warning in system(cmd) : 'make' not found ERROR: compilation failed for package 'spatstat.utils'. I guess that "make" not found refers to Rtools, isn't it? – david 007 Feb 12 '23 at 09:33
  • 1
    OK, I know what the problem is. I am running the scrip in R within QGIS and it doesn't find rtools. I run Sys.which("make") in R and it finds the path to rtools, but I run it in R within QGIS and it doesn´t find the path to rtools. – david 007 Feb 12 '23 at 09:43
  • In the QGIS online manual, I found "R has to be installed on your computer and the PATH has to correctly set up. Moreover Processing just calls the external R packages, it is not able to install them. So be sure to install external packages directly in R. See the related chapter in the user manual." This makes me think you should be installing spatstat in R, outside of QGIS? Note, I have never used QGIS! Given you have Rtools successfully installed there, that would be good news! There is also a reference to making sure you PATH is set correctly – Isaiah Feb 12 '23 at 13:23
  • @Isaiah many thanks. You are actually right (I thought the same this morning). I am going to install spatstat directly in R library and I am going to set the path in QGIS directly to this library. I will do it along the week and will let you know the outcome. Thanks for your help once more time. – david 007 Feb 12 '23 at 18:39
  • `PATH` probably refers to the windows environment variable. You set it in windows [Adding a directory to the PATH environment variable in Windows](https://stackoverflow.com/questions/9546324/adding-a-directory-to-the-path-environment-variable-in-windows) – Isaiah Feb 13 '23 at 03:07

0 Answers0