CornellLabofOrnithology / auk

Working with eBird data in R
https://CornellLabofOrnithology.github.io/auk/
GNU General Public License v3.0
136 stars 20 forks source link

auk_filter can not find AWK #37

Closed ormaillet closed 4 years ago

ormaillet commented 4 years ago

I'm trying to filter a custom download using auk_filter but when I run it this error message appears:

Error in auk_filter.auk_ebd(ebd_filters, file = f_ebd, file_sampling = f_sampling) : auk_filter() requires a valid AWK install, unless execute = FALSE.

I've tried setting the path to AWK manually as it was not finding it, using a method in a previous post:

auk_set_awk_path("C:/cygwin64/bin/gawk.exe/bin/gawk.exe",overwrite=TRUE

this worked (ie. the path was "set"), but then returns "NA" when I try to check if it is installed. I'm not sure if my computer (Windows 10) isn't capable of doing this or if I am missing another component.

mstrimas commented 4 years ago

you have auk_set_awk_path("C:/cygwin64/bin/gawk.exe/bin/gawk.exe",overwrite=TRUE), are you sure it shouldn't be auk_set_awk_path("C:/cygwin64/bin/gawk.exe", overwrite=TRUE)?

ormaillet commented 4 years ago

I initially had it set that way, but it returned the same error as someone had previously (ie. R could not find any AWK executables), so I changed it to auk_set_awk_path("C:/cygwin64/bin/gawk.exe/bin/gawk.exe",overwrite=TRUE), because it references the gawk.exe file instead of the file that it is in, and it allowed me to set it, but still returned "NA" when I tried to check it. So I'm not sure if that even worked.

I'm wondering if it's an issue with the Cygwin I downloaded? I've installed and uninstalled it twice now, but nothing has changed.

ormaillet commented 4 years ago

It just allowed me to set the auk path properly out of the blue, not sure if the restart of R and my computer solved that problem. However, it still isn't working with AWK. The new error message when I run

if (!file.exists(f_ebd)) { auk_filter(ebd_filters, file = f_ebd, file_sampling = f_sampling) }

is

Error in auk_filter.auk_ebd(ebd_filters, file = f_ebd, file_sampling = f_sampling, : Error running AWK command.

mstrimas commented 4 years ago

Sorry for the slow response, been a busy couple weeks! Tough to say what's going on here. Seems like it's more of an AWK issue than an auk issue, and likely very dependent on your system configuration, so I don't know how much help I can provide. I'd start by seeing if AWK works from the command line, e.g. you could try running something like ls -l | awk '{print $1}' in the terminal.

ormaillet commented 4 years ago

Thanks for the reply! It ended up working after I left my computer asleep for the weekend - not sure what the problem was. I have not had any issues running AWK since.

kaeli-mueller commented 3 years ago

I am having a similar issue, I am trying your solutions but not sure if I'm doing it right. When you use the auk_set_awk_path("C:/cygwin64/bin/gawk.exe", overwrite=TRUE) in your code, do you run that as it's own line or as part of more code?

mstrimas commented 3 years ago

You should only have to run that once, but you will need to restart R after you run it. Also, all this assumes that you have installed Cygwin previously.