femiguez / apsimx

R package for APSIM-X

Home Page:https://femiguez.github.io/apsimx-docs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add run command when using Linux

luanabeckerdaluz opened this issue · comments

Bug description

I am using apsimx package in a Linux Mint environment. I installed apsim both by building from source code with dotnet and by downloading and install the .deb from the apsim download website. In both cases, two files were generated in the apsim folder. (1) The apsim file which is the executable and need to be run using apsim run <simulation_name> and (2) the ApsimNG file which is the executable to the interface. I used the function apsimx_options() to set the exe.path, but I am not able to run the apsim() function because if I set the ApsimNG as executable, it opens the interface with the simulation, and if I set the apsim as executable, the command "apsim <simulation_name>" is invalid because the "run" string is missing.
I used the command dpkg --listfiles apsim to discover the path where apsim was installed. In my case it is in the /usr/local/lib/apsim/2023.7.7283.0/bin/ folder where the files apsim and ApsimNG are located.

Suggestion

The apsim.R code should add the run string between the ada and the simulation name, or create a new condition. When forking and doing this, the function apsim() ran perfectly.

  if(isFALSE(dotnet.flag) && isFALSE(mono.flag)){
    run.strng <- paste(ada, "run", file.name.path) 
  }

My Setup

  • OS:
    • Linux Mint 21.2 Cinnamon Kernel 5.15.0-78-generic
  • Version(s):
    • apsimx = 2.4.6

@leobeckerdaluz This looks good! I'm on vacation now, but I will test this and get back to you when I get back. Thanks!

@luanabeckerdaluz Sorry it took me so long, but I've been too busy to test this on Linux. I'm running APSIM Next Gen version 2023.12.7350.0 and Ubuntu with dotnet runtime 6.0 and I do not need the addition of 'run' to make the code work. I did not install APSIM Next Gen from source. Also, in the package I have a function which tries to find where APSIM NG is installed

apsimx:::auto_detect_apsimx()
[1] "/usr/local/lib/apsim/2023.12.7350.0/bin/Models"

If for some Linux systems the command needs to be different, I could add that as an option. At this point, I can't accept this pull request, but let me know if I'm missing something.

Closing this. Please submit a new issue if needed

Hi @femiguez! Sorry for the delay replying here, I didn't have time to test this issue. I have been using Apsim installed from a deb file and it works perfectly without the extension. When I opened the issue, I was using Apsim built from source using dotnet, so I was not running Apsim using Models executable as I am using now. Next time when I have the opportunity to install Apsim from source I will try again and check if the command fails, then I can open a new issue or comment here.

Thank you so much for your attention, I really appreciate!