metrumresearchgroup / bbr

R interface for model and project management
https://metrumresearchgroup.github.io/bbr/
Other
23 stars 2 forks source link

Error assigning nm version #596

Closed ldbro0 closed 1 year ago

ldbro0 commented 1 year ago

Hi

I'm trying to get bbr and bbi working and I'm getting the following error

> bbi_init(.dir = "nonmem/study_id/poppk", .nonmem_dir = "/gstore/scratch/u/id_12345/7.5.0-foss-2017a", .nonmem_version = "nmfe75")

Error in bbi_init(.dir = "nonmem/study_id/poppk", .nonmem_dir = "/gstore/scratch/u/id_12345/7.5.0-foss-2017a",  : 
  Must specify a valid `.nonmem_version` for bbi_init(). nonmem/study_id/poppk/bbi.yaml contains the following options: ``

I'm also have difficulties getting this to work in an .Rmd document w/ really odd relative paths. For example if I do the follow in .Rmd based on the ACOP demo


MODEL_DIR <- here("nonmem/study_id/poppk")

print(bbi_version())

bbi_init(.dir = MODEL_DIR,
         .nonmem_dir = "/gstore/scratch/u/brooksl2/7.5.0-foss-2017a", 
         .nonmem_version = "nmfe75")

I get the following error where there seems to be a call to a working directory overriding the here() call?

[1] "3.2.2"
Error: Cannot find id_12345/project/r_code/nonmem//id_12345/project/nonmem/study_id/poppk Make sure you are in the correct working directory and have passed the correct path to bbi_init(.dir)
kyleam commented 1 year ago

bbi_init(.dir = "nonmem/study_id/poppk", .nonmem_dir = "/gstore/scratch/u/id_12345/7.5.0-foss-2017a", .nonmem_version = "nmfe75") [...] Must specify a valid .nonmem_version for bbi_init(). nonmem/study_id/poppk/bbi.yaml contains the following options: ``

Underneath, bbi init looks through .nonmem_dir and tries to detect subdirectories for different NONMEM versions (code). Under each of those subdirectories, it looks for things like expected subdirectories, a license file, and an NONMEM executable.

As an example, on Metworx .nonmem_dir is /opt/NONMEM/. Here's how that looks:

$ ls -1 /opt/NONMEM | grep nm
nm73gf
nm73gf_nmfe
nm74gf
nm74gf_nmfe
nm75

$ fd -t f 'nmfe[0-9]+$' /opt/NONMEM
/opt/NONMEM/nm73gf/run/nmfe73
/opt/NONMEM/nm73gf/util/nmfe73
/opt/NONMEM/nm73gf_nmfe/run/nmfe73
/opt/NONMEM/nm73gf_nmfe/util/nmfe73
/opt/NONMEM/nm74gf/run/nmfe74
/opt/NONMEM/nm74gf/util/nmfe74
/opt/NONMEM/nm74gf_nmfe/run/nmfe74
/opt/NONMEM/nm74gf_nmfe/util/nmfe74
/opt/NONMEM/nm75/run/nmfe75
/opt/NONMEM/nm75/util/nmfe75

Based on the error message, it looks like bbi init isn't finding anything. What's the structure of /gstore/scratch/u/id_12345/7.5.0-foss-2017a/? Perhaps you need to remove the rightmost directory level.

Error: Cannot find id_12345/project/r_code/nonmem//id_12345/project/nonmem/study_id/poppk Make sure you are in the correct working directory and have passed the correct path to bbi_init(.dir)

That error message should be improved to not unconditionally append getwd():

https://github.com/metrumresearchgroup/bbr/blob/dbc3fb3bf2b96f891cbb602582eead10caf92326/R/bbr.R#L342-L350

However, putting aside the confusing message, that still means that you're passing a .dir value that doesn't point to an existing directory. Have you checked that here("nonmem/study_id/poppk") is returning the path that you expect?

ldbro0 commented 1 year ago

Yeah it's an odd folder structure as it's on an HPC system I doctored the files around a bit but it still doesn't work

fd -t f 'nmfe[0-9]+$' /gstore/scratch/u/id_12345/7.5.0-foss-2017a

/gstore/scratch/u/id_12345/7.5.0-foss-2017a/util/nmfe75
/gstore/scratch/u/id_12345/7.5.0-foss-2017a/run/nmfe75
/gstore/scratch/u/id_12345/7.5.0-foss-2017a/nm75/util/nmfe75
/gstore/scratch/u/id_12345/7.5.0-foss-2017a/nm75/run/nmfe75

same error:

 bbi_init(.dir = "nonmem/study_id/poppk",
          .nonmem_dir = "/gstore/scratch/u/id_12345/7.5.0-foss-2017a",
          .nonmem_version = "nm75")

Error in bbi_init(.dir = "nonmem/study_id/poppk", .nonmem_dir = "/gstore/scratch/u/id_12345/7.5.0-foss-2017a",  : 
  Must specify a valid `.nonmem_version` for bbi_init(). nonmem/study_id/poppk/bbi.yaml contains the following options: ``
kyleam commented 1 year ago

I doctored the files around a bit but it still doesn't work

Sorry for not being clear. I wasn't suggesting that you modify the layout on disk. I was suggesting that you adjust the path you specify as .nonmem_dir (in particular that you pass the parent directory of what you're currently passing).

For example, assuming 7.5.0-foss-2017a is the installation directory for a particular NONMEM version (like, say, the nm75 directory in my example), then you should pass the parent directory as .nonmem_dir, because bbi init looks underneath this directory for NONMEM installations.

Does this work?

bbi_init(.dir = "nonmem/study_id/poppk",
         .nonmem_dir = "/gstore/scratch/u/id_12345",
         .nonmem_version = "7.5.0-foss-2017a")
ldbro0 commented 1 year ago

No luck with this either

bbi_init(.dir = "nonmem/study_id/poppk",
         .nonmem_dir = "/gstore/scratch/u/id_12345",
         .nonmem_version = "7.5.0-foss-2017a")
OmarAshkar commented 1 year ago

@kyleam I also have this problem. My executable location is "/apps/nonmem/7.4.4/run/nmfe74"

kyleam commented 1 year ago

@OmarAshkar

I also have this problem. My executable location is "/apps/nonmem/7.4.4/run/nmfe74"

In your case, it looks like your .nonmem_dir is /apps/nonmem/ and the NONMEM subdirectory for the 7.4 installation is 7.4.4. That directory having a period in its name throws off bbi init. The unreleased version of bbi recently got a fix: https://github.com/metrumresearchgroup/bbi/pull/304

(Note: based an an offline troubleshooting with Logan, that period issue was one of the problems he was running into, and that prompted metrumresearchgroup/bbi#304. However, there is also at least one remaining unresolved issue that seems likely to be specific to his setup. If your problem continues even after bbi 304, please open a dedicated issue in the bbi repo with more details.)

OmarAshkar commented 1 year ago

@kyleam I will wait for the next release. Thanks!

OmarAshkar commented 1 year ago

Hi @kyleam. Is there is a way to build the 304 fix? I cannot find any instruction to build it.

kyleam commented 1 year ago

Is there is a way to build the 304 fix?

If you have go installed on your system, you can run make from the top-level directory of the repository https://github.com/metrumresearchgroup/bbi. Make sure the main branch is up to date so that it includes the merge of pr 304.

make will build bbi and install it to ~/go/bin/bbi.

To use the dev version from bbr, you'll need to point bbr to it and tell it to not check the bbi version:

options(
  "bbr.bbi_exe_path" = "~/go/bin/bbi",
  "bbr.DEV_no_min_version" = TRUE
)

You could also test bbi directly from the command line with

~/go/bin/bbi init --dir /apps/nonmem/

We're planning to cut a bbi release in the next week or two. We can consider tagging a pre-release if you have trouble getting the above steps to work; with a pre-release, you could then do bbr::use_bbi(..., .version = "NNN").

OmarAshkar commented 1 year ago

@kyleam This solution works for me. Thanks!

kyleam commented 1 year ago

@OmarAshkar bbi v3.2.3 is now released. Calling bbr::use_bbi() without a version will pull that in. You can also download it from https://github.com/metrumresearchgroup/bbi/releases/tag/v3.2.3.

@ldbro0 With that release, I'm going to close this bbr issue. From our debugging session, I know that the "directory with period in its name" problem was only one of the issues you were hitting. However, let's follow up with a dedicated issue in the bbi repo once we have something actionable to go on. Thanks.