icarda-git / QBMS

R package to query Breeding Management System (BMS) database
https://icarda-git.github.io/QBMS/
GNU General Public License v3.0
8 stars 6 forks source link

Error in brapi_get_call() -- namespace issue? #15

Closed jmh579 closed 10 months ago

jmh579 commented 11 months ago

I'm using QBMS v0.9.1. Following the Breedbase vignette, I get the following error after list_crops():

Error: 'synchronise' is not an exported object from 'namespace:async'

This happens with other QBMS functions too, not just list_crops() -- async::synchronise() is called in the brapi_get_call() function in qbms.R (lines 444 and 450). From what I can tell, synchronise is not a function exported by the CRAN package async, which is why it's throwing an error.

This is my first time trying out QBMS, so entirely possible I'm missing something. Thanks in advance for your help!

khaled-alshamaa commented 11 months ago

Most probably it is regarding the async R package that our QBMS uses internally (more details here). It is different from the other async package published on the CRAN repository.

To fix this issue, uninstall your async package and then install the one suggested by QBMS from the GitHub repository using the following remotes package functionality:

remotes::install_github("r-lib/async")

That should resolve the problem that you had.

jmh579 commented 11 months ago

Thanks, @khaled-alshamaa!

I've followed your instructions and should now have your suggested async package installed, but I am now getting a different error:

Error in async::async({ : 
  unused arguments (local = FALSE, split_pipes = TRUE, compileLevel = 0, debugR = FALSE, debugInternal = FALSE, trace = FALSE)

Any ideas for what might be causing this?

khaled-alshamaa commented 11 months ago

Dear @jmh579,

This is exactly what I am trying to say! You have installed the wrong async package (look to the function parameters in your error message): https://crowding.github.io/async/reference/async.html

Therefore, please try the following code snippet to fix this issue:

remove.packages("async")
if("package:async" %in% search()) detach("package:async", unload = TRUE)
remotes::install_github("r-lib/async")

Are you using MacOS?

jmh579 commented 11 months ago

Even though I have the r-lib/async package loaded (not the CRAN version), when I run QBMS, it is still throwing this error: Screenshot 2023-12-13 at 10 48 59 AM

The CRAN version must still be lurking around somewhere in my files. I'll try to track it down.

I really appreciate you looking into this with me, @khaled-alshamaa -- I know this async vs async thing isn't something you have control over, but I think it's worth figuring out what's wrong in case other users run into it too. I found your issue on the r-lib/async repo about changing the name to avoid this confusion. Hoping it gets addressed soon!

khaled-alshamaa commented 10 months ago

@AparicioJohan, I recall you dealt with a similar issue in the past. Could you please provide @jmh579 with any best practices or lessons learned? Thanks!

AparicioJohan commented 10 months ago

Hi @khaled-alshamaa and @jmh579,

A couple of colleagues mentioned that they've encountered this issue as well (on mac). Oddly enough, we found that simply restarting the PC and uninstalling and reinstalling the packages resolved the problem.

jmh579 commented 10 months ago

That worked for me! I guess I need to get in the habit of restarting my computer more often.

Thank you, @AparicioJohan and @khaled-alshamaa!!

tyrwh commented 7 months ago

@AparicioJohan @khaled-alshamaa I was getting the same error as @jmh579 but had to follow a specific install order to get the library to function. Commenting here in case others encounter this issue in the future--

I had the other version of async installed previously, presumably as a dependency for some other library.

The steps that worked for me were to uninstall QBMS and async, restart, install async via remotes::install_github("r-lib/async"), then install QBMS via remotes::install_github("r-lib/async")

Using the CRAN version of QBMS or installing QBMS prior to async did not seem to work for me, unsure why.

Here is what I tried before finding the order that worked-

  1. Uninstall async (first time around this was the other one from CRAN), reinstall via remotes::install_github("r-lib/async")
  2. Restart, uninstall async, reinstall async with remotes
  3. Restart, uninstall QBMS and async, reinstall QBMS from CRAN and async via remotes
  4. Restart, uninstall QBMS and async, reinstall QBMS via remotes and then async via remotes
  5. Uninstall QBMS and async, restart, reinstall QBMS via remotes and then async via remotes

On Mac, R 4.2.2