ryanpmcg / WEPPCLIFF

An R-based command line tool designed to prepare climate inputs for WEPP, which has been extended to perform other general functions such as quality checking, gap filling, and erosion index calculations (climate inputs for USLE family models).
GNU Affero General Public License v3.0
12 stars 5 forks source link

Installation recommendations #2

Closed kbarnhart closed 4 years ago

kbarnhart commented 4 years ago

@ryanpmcg this is the first of my review issues for your joss submission. openjournals/joss-reviews/issues/2029

I was able to install WEPPCLIFF based on the instructions, but have two recommendations:

  1. As I mentioned in this comment I would recommend that installation is separate from running tutorials.

I wouldn't recommend installing dependencies as part of the tutorials (though I think that checking for the dependencies) makes sense.

I'd also recommend putting installation instructions in the Readme so they are easy to find. If I understand correctly this would just mean putting instructions to navigate to the main directory and execute:

Rscript --vanilla WEPPCLIFF.R --args -fr t

  1. Based on starting through the tutorials and documentation, it seems that it is necessary to run WEPPCLIFF from the directory that WEPPCLIFF.R is located in (please correct me if I'm mistaken). If I were to use WEPPCLIFF on multiple projects this would mean that I'd need to move the file around (which would be non ideal). I'd recommend making an alias for Rscript --vanilla $WEPP_PATH/WEPPCLIFF.R so that anywhere on a machine with a successful installation one might execute WEPPCLIFF.
ryanpmcg commented 4 years ago

I have updated the installation procedure as you recommended. However, I have not implemented aliases before. Do you have a recommendation for how to do this that works for UNIX and Windows systems similarly?

kbarnhart commented 4 years ago

I can't speak directly to working with Windows machines (I presently work on a Mac, a linux, box and a shared HPC platform), but I tried out doing this on a Mac and was successful. I needed to make a few tweaks to the source code (these are on PR #8, you can take or leave them). The key issue that I faced was that I needed to add the main weppcliff directory LIBRARY folder to the R library path (since you've specified the install to put dependencies there and not in the default R location).

I edited my .zshrc file (now that the default OS X shell is zsh instead of bash) to include:

WEPPCLIFF_DIR=/pathto/your/directory
alias weppcliff='Rscript --vanilla $WEPPCLIFF_DIR/WEPPCLIFF.R'

Once I did that, I was able to copy the input directory into a totally different directory and run tutorial examples. For example:

weppcliff --args -f ASOS_BPT_KMQE.csv -la y
baharmon commented 4 years ago

I have some additional comments regarding installation. I think the installation process and instructions could be better designed as per @kbarnhart suggestions for example. I did a fresh installation of R on Windows and followed your installation instructions, but had some issues with the path and environment variables. I had to install R to the C drive rather than Program Files and use complete file paths to get it to run from C:\WEPPCLIFF.

cd C:/WEPPCLIFF
C:/R/R-3.6.3/bin/x64/Rscript --vanilla WEPPCLIFF.R --args -fr t

The current installation instructions in the tutorial are only for Windows. Please make a complete UNIX installation guide and tutorial.

I also wanted to note the WEPPCLIFF does not seem to work on Windows Subsystem for Linux.

Error in FUN(X[[i]], ...) :
  type 'binary' is not supported on this platform
Calls: main -> install_dependencies -> lapply -> FUN
marianadobre commented 4 years ago

I was also not able to install WEPPCLIFF on my machine.

image

image

I am using version R-3.6.3, which I already had installed on my computer in Program Files and Windows 10.

@baharmon suggested installing R in C and then using complete path

But is an alternative? Can I still run WEPPCLIFF from the Program Files?

ryanpmcg commented 4 years ago

Can you run Rscript at all (navigate to it’s directory and try to run it; include the full path including the .exe and enclose it all in double quotes because of the space between “Program Files”). If you can’t do that, there is a Windows or R issue that I am not sure I understand.

ryanpmcg commented 4 years ago

@baharmon may be right about that. I might need to change the recommendation to also install R directly on the C drive. Let me know if that works and I will be happy to change it. Also thank you for reviewing the software. I am happy to hear any of your suggestions too.

ryanpmcg commented 4 years ago

@marianadobre I have one last suggestion. Can you try running the AutoTutorial.bat script? It attempts to complete installation automatically for the user. You may have the same issue as before, but maybe not? Will you post the results here if it doesn’t work?

marianadobre commented 4 years ago

@ryanpmcg It looks like I can run R.exe but not Rscript.exe. See below:

image

image

It doesn't work even when I try to lunch the .exe directly (double click on the file) from the /bin directory. I have three versions of R installed on my computer and this is similar for all three of them. R.exe works but not the Rscript.exe.

Should I next try to install R directly in C?

Also, my pleasure to review the tool. I think it will be quite useful.

marianadobre commented 4 years ago

Also, how do I run the AutoTutorial.bat? If I try to save it on my computer it ads .html at the end of file and then takes me to its location in github. And if I delete the .html to have just AutoTutorial.bat, and try to run it, it doesn't execute.

ryanpmcg commented 4 years ago

@marianadobre, actually that message means that Rscript.exe is working. If it did not work it would say command not found or something similar. I do not think you 'need' to install it in the C drive, but that is an option for later.

For now, I would like for you to just navigate to the WEPPCLIFF directory with: cd C:/WEPPCLIFF

then run the AutoTutorial with: C:/WEPPCLIFF/TUTORIAL/AutoTutorial.bat

then just share the results with me

marianadobre commented 4 years ago

Here it is:

image

I do have the WEPPCLIFF.R in the folder as you can see in the attached image.

ryanpmcg commented 4 years ago

OK, from the same directory try this: "C:\Program Files\R\R-3.6.3\bin\Rscript.exe" --vanilla C:\WEPPCLIFF\WEPPCLIFF.R --args -fr t

marianadobre commented 4 years ago

Great! Now it worked:

image

Thank you!

ryanpmcg commented 4 years ago

Can you close and restart your command prompt then type: Rscript

If that doesn't work try: Rscript.exe

ryanpmcg commented 4 years ago

Just curious to see if the PATH variable has the information and just needed to be reset with the new cmd instance.

marianadobre commented 4 years ago

It doesn't work.

image

ryanpmcg commented 4 years ago

OK, that means that the path to Rscript is not being saved for some reason. I do not know how to help with that. I just updated the AutoTutorial which now searches for and provides the absolute path for Rscript and the root WEPPCLIFF directory. I do not know if anyone else has suggestions about how to improve installation. I can make an Install.bat script if necessary?

kbarnhart commented 4 years ago

This sounds like a windows path issue to me. I don't know whether it is a default part of the R installation on Windows to add the R path to $PATH.

My experience with Windows paths is (very limited as I just started using Windows for work last week) but what I know is that:

@ryanpmcg you might consider adding a layer to your install instructions to have a user verify that they can run Rscript before they start trying to use WEPPCLIFF.

Alternatively, (once an appropriate way to set persistent paths in windows that doesn't depend on being an admin and works for both Powershell and command prompt is identified) you might just do something like (for linux/osx)

alias weppcliff='$RPATH/Rscript --vanilla $WEPPCLIFF_DIR/WEPPCLIFF.R'

I think the windows equivalent is to create a permanent doskey (https://superuser.com/questions/1134368/create-permanent-doskey-in-windows-cmd) I'll try that in the next few days and report back here and/or on PR #8)

ryanpmcg commented 4 years ago

If you read back a bit, setx is used in my tutorial.txt. @marianadobre added the path for Rscript under the incorrect directory first, then she added it for the correct directory. I am wondering if the incorrect addition is what caused her first installation attempt not to work.

The AutoTutorial script for Windows provides absolute paths every time for this reason.

@kbarnhart I do want to keep installation as simple as possible. I am convinced that I need to have an automated install procedure that just requires double clicking a .bat script. If you or I figure out the alias for Windows I will have the install procedure set that up automatically, too (for both OS systems).

ryanpmcg commented 4 years ago

@kbarnhart, @baharmon, and @marianadobre, I believe I have resolved all the issues in this issue. Will you guys respond here if there are any installation issues remaining?

kbarnhart commented 4 years ago

@ryanpmcg my issues are resolved.

baharmon commented 4 years ago

@ryanpmcg my issues are resolved too.

ryanpmcg commented 4 years ago

Since I personally helped solve Mariana’s issues and there are none left, I am closing this issue.