ropensci / nlrx

nlrx NetLogo R
https://docs.ropensci.org/nlrx
GNU General Public License v3.0
77 stars 12 forks source link

Issues in Setting up Sample Experiment on Manjaro Linux #39

Closed gaianoseworthy closed 4 years ago

gaianoseworthy commented 4 years ago

See end for version numbers of everything and the input code.

I am attempting to set up an initial demo experiment (the one provided in the documentation), and am running into the following error when attempting to get the result:

"cp: cannot stat '~/.netlogo/NetLogo 6.1.1/netlogo-headless.sh': No such file or directory
sed: can't read /tmp/RtmpcV04os/netlogo-headless36d4c209e3dbf.sh: No such file or directory
sed: can't read /tmp/RtmpcV04os/netlogo-headless36d4c209e3dbf.sh: No such file or directory
sh: /tmp/RtmpcV04os/netlogo-headless36d4c209e3dbf.sh: No such file or directory
Error in util_gather_results(nl, outfile, seed, siminputrow) : 
  Temporary output file /tmp/RtmpcV04os/nlrx5493_136d4c7ab3eec4.csvnot found. On unix systems this can happen if the default system temp folder is used.
                Try reassigning the default temp folder for this R session (unixtools package).
In addition: Warning message:
In system(NLcall, wait = TRUE) : error in running command"

Given that I am running R 4.0.0, I cannot us Unixtools to fix the temp path. For note, if I copy-paste the path for netlogo-headless.sh into my file manager, it works perfectly. I have attempted this with NetLogo 6.0.4, 6.1.1, and 5.3.1, and none of them seem to work. Is there anything recommended that I can do?


Input Code:

library(nlrx)

netlogopath <- file.path("~/.netlogo/NetLogo 6.1.1")
modelpath <- file.path(netlogopath, "app/models/Sample Models/Biology/Wolf Sheep Predation.nlogo")
outpath <- file.path("/home/out")
nl <- nl(nlversion = "6.0.3",
         nlpath = netlogopath,
         modelpath = modelpath,
         jvmmem = 1024)
nl@experiment <- experiment(expname="wolf-sheep",
                            outpath=outpath,
                            repetition=1,
                            tickmetrics="true",
                            idsetup="setup",
                            idgo="go",
                            runtime=50,
                            evalticks=seq(40,50),
                            metrics=c("count sheep", "count wolves", "count patches with [pcolor = green]"),
                            variables = list('initial-number-sheep' = list(min=50, max=150, qfun="qunif"),
                                             'initial-number-wolves' = list(min=50, max=150, qfun="qunif")),
                            constants = list("model-version" = "\"sheep-wolves-grass\"",
                                             "grass-regrowth-time" = 30,
                                             "sheep-gain-from-food" = 4,
                                             "wolf-gain-from-food" = 20,
                                             "sheep-reproduce" = 4,
                                             "wolf-reproduce" = 5,
                                             "show-energy?" = "false"))
nl@simdesign <- simdesign_lhs(nl=nl,
                              samples=100,
                              nseeds=3,
                              precision=3)
results <- run_nl_all(nl = nl)

OS: DISTRIB_ID=ManjaroLinux DISTRIB_RELEASE=20.0 DISTRIB_CODENAME=Lysia DISTRIB_DESCRIPTION="Manjaro Linux"

R Version: platform x86_64-pc-linux-gnu
arch x86_64
os linux-gnu
system x86_64, linux-gnu
status
major 4
minor 0.0
year 2020
month 04
day 24
svn rev 78286
language R
version.string R version 4.0.0 (2020-04-24) nickname Arbor Day

nldoc commented 4 years ago

The first error message you receive is the real problem here:

"cp: cannot stat '~/.netlogo/NetLogo 6.1.1/netlogo-headless.sh': No such file or directory

This says, that the netlogo-hedless.sh file was not found at the specified location and could thus not be copied. So this is not a problem related to the temporary folder even though the suggestion pops up. There are several things I would like you to check:

  1. Check that you have Netlogo installed on your system, check the exact path and check if the "netlogo-headless.sh" file is located in the top level directory of your netlogo installation.
  2. Make sure to define the same NetLogo version in your nl object (nlversion) as the one you use for your nlpath (currently, in your example above you have two different versions: 6.1.1 vs 6.0.3)
  3. After you have setup your nl object (after adding the simdesgin) you can execute print(nl). This will show you a summary of the content and a checklist at the end of the report. In this checklist you will find the item nlpath exists on local system: and modelpath exists on local system: - both should be signed with a checkmark ✓
  4. Finally, one thing you could try is to remove the empty space in your NetLogo path (the space between NetLogo and the version number). I never ran into problems here, but maybe this is different for different Linux systems.

If you checked these points and everything looks fine and you still encounter problems, please do not hesitate to write again. We can then see what else we can do to identify the problem. Cheers, nldoc

gaianoseworthy commented 4 years ago

@nldoc Okay I think I managed to get it fixed. For some unknown reason, it seems I need to run nlrx in R with root privileges, or else it isn't allowed to copy "netlogo-headless.sh" to the temp directory (which is what I think it was doing). This seems odd, since it was fully able to create files in both directories, download new source code, and do pretty much anything else.

Either way, I also ran into the JAVA_HOME problem, though the fix from the issue presented before (https://github.com/ropensci/nlrx/issues/32) worked perfectly as well.

Seeing that all seems to be in order, if I finish this test run without issue, I will close this issue!