nlmixrdevelopment / nlmixr

nlmixr: an R package for population PKPD modeling
https://nlmixrdevelopment.github.io/nlmixr/
GNU General Public License v2.0
115 stars 45 forks source link

Windows 10 installation issues #114

Closed OlaCaster closed 5 years ago

OlaCaster commented 5 years ago

After installation, I have some weird errors. Using both rxTest() and nlmixrValidate(), I get:

Error in setwd(path) : cannot change working directory

This happened even when I ran the custom installer, and used the designated R version that comes with it. Looking at the code for rxTest(), I figured it needed a sub-directory /tests/testthat under the RxODE directory, which there wasn't any.

Further, when I have tried to run some existing models, I get these kinds of errors with saem:

Compiling RxODE equations...done.
PKG_CXXFLAGS=-IC:/Users/OlaC/R/WIN-LI~1/3.5/nlmixr/include -IC:/Users/OlaC/R/WIN-LI~1/3.5/STANHE~1/include -IC:/Users/OlaC/R/WIN-LI~1/3.5/Rcpp/include -IC:/Users/OlaC/R/WIN-LI~1/3.5/RCPPAR~1/include -IC:/Users/OlaC/R/WIN-LI~1/3.5/RCPPEI~1/include -IC:/Users/OlaC/R/WIN-LI~1/3.5/BH/include
PKG_LIBS= $(BLAS_LIBS) $(LAPACK_LIBS)
C:/R/NLMIXR~1.0-7/rtools/mingw_64/bin/g++  -I"C:/PROGRA~1/R/R-35~1.1/include" -DNDEBUG       -IC:/Users/OlaC/R/WIN-LI~1/3.5/nlmixr/include -IC:/Users/OlaC/R/WIN-LI~1/3.5/STANHE~1/include -IC:/Users/OlaC/R/WIN-LI~1/3.5/Rcpp/include -IC:/Users/OlaC/R/WIN-LI~1/3.5/RCPPAR~1/include -IC:/Users/OlaC/R/WIN-LI~1/3.5/RCPPEI~1/include -IC:/Users/OlaC/R/WIN-LI~1/3.5/BH/include   -O3 -Wno-unused-variable -Wno-unused-function -c saem2eb831384445x64.cpp -o saem2eb831384445x64.o
C:/R/NLMIXR~1.0-7/rtools/mingw_64/bin/g++ -shared -s -static-libgcc -o saem2eb831384445x64.dll tmp.def saem2eb831384445x64.o -LC:/PROGRA~1/R/R-35~1.1/bin/x64 -lRblas -LC:/PROGRA~1/R/R-35~1.1/bin/x64 -lRlapack -LC:/PROGRA~1/R/R-35~1.1/bin/x64 -lR
done.
Error in cur.fn(a) : 
  function 'rx_180f4f10b1e9676b9a4ce3b61f7545a6_x64_ode_solver' not provided by package 'rx_180f4f10b1e9676b9a4ce3b61f7545a6_x64'

Does this tell you anything at all about my possible issues? Many thanks in advance.

OlaCaster commented 5 years ago

For information, the close/reopen was just because of me having some problems with GitHub itself.

OlaCaster commented 5 years ago

Weirdly enough, I have the exact same problems after going through the trouble of installing nlmixr in an Ubuntu 18 environment inside my Windows machine as well.

mattfidler commented 5 years ago

This has to do with how you installed it; If you don't install it in a specific way, the rxTest and nlmixrValidate doesn't work.

Kyle pointed out that if you are using the CRAN versions, you would have to install the tests by:

install.packages("RxODE", INSTALL_opts="--install-tests", type = "source")
install.packages("nlmixr", INSTALL_opts="--install-tests", type = "source")

See the link below https://github.com/nlmixrdevelopment/RxODE/issues/39#issuecomment-386733164

In the CRAN release there is a bug that has been fixed that you are experiencing. As a work-around you can issue the command:

library(RxODE)
rxClean()

before nlmixr runs. This should fix it.

OlaCaster commented 5 years ago

To clarify, I haven't installed from CRAN. I have installed in three different ways:

1) from github / nlmixrdevelopment on Win 10 2) from github / nlmixrdevelopment on Ubuntu 18 3) using latest Windows installer

In all cases, the tests fail and the cur.fn() error comes using SAEM. I will delete and try the above CRAN option and see if it helps. Thanks for your support.

OlaCaster commented 5 years ago

Installing from CRAN like this and adding the rxClean() does seem to work, as you suggested. I still don't quite understand these earlier issues, but nevermind. Many thanks.

mattfidler commented 5 years ago

I'm glad it is working for you.

I can't remember what the fix for the issue you described was.... In the next release you will not have to use rxClean any longer.

samfux84 commented 4 years ago

Same issue here. I did an RxODE installation with the command

install_github("nlmixrdevelopment/RxODE")

And when running rxTest() I get the same error as described above:

[sfux@lo-login-01 ~]$ R

R version 3.6.1 (2019-07-05) -- "Action of the Toes"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

[Previously saved workspace restored]

> library(SnakeCharmR)
SnakeCharmR 1.0.7 - R and Python Integration
Contribute and submit issues at https://github.com/asieira/SnakeCharmR

Python version 3.7.4 (default, Oct 17 2019, 10:29:48)
[GCC 6.3.0]
> library(RxODE); rxTest();
Error in setwd(path) : cannot change working directory
>

Is the github version broken? I would prefer to install the github version instead of the CRAN release.

mattfidler commented 4 years ago

If you install with CRAN the tests are removed by default.

The github version isn't broken for RxODE. You should be able to install by:

devtools::install_github("nlmixrdevelopment/RxODE", INSTALL_opts="--install-tests")

This way you can test RxODE if you wish. Note you can also install from CRAN the same way:

install.packages("RxODE", INSTALL_opts="--install-tests", type="source")
samfux84 commented 4 years ago

@mattfidler Thank you for your feedback.

Could you then please update the installation instructions in the readme file on github, because this is was people are following when installing nlmixr.

Best regards

mattfidler commented 4 years ago

Hm. It was updated. Perhaps I missed a platform? Which platform are you using?

On Tue, Apr 21, 2020 at 1:22 AM Samuel Fux notifications@github.com wrote:

@mattfidler https://github.com/mattfidler Thank you for your feedback.

Could you then please update the installation instructions in the readme file on github, because this is was people are following when installing nlmixr.

Best regards

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nlmixrdevelopment/nlmixr/issues/114#issuecomment-616977921, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAD5VWX45673KUENVB3P3RLRNU3T5ANCNFSM4GMLMX4Q .

mattfidler commented 4 years ago

It is listed on the windows installation.

samfux84 commented 4 years ago

https://github.com/nlmixrdevelopment/nlmixr

For the Linux installation, the installation instructions still state:

Install RxODE.

    Currently the new version of RxODE is in the process of being uploaded to CRAN. nlmixr needs this newer version of RxODE to function correctly. To install this version, use the command: install_github("nlmixrdevelopment/RxODE").
    Install SnakeCharmR using install_github("nlmixrdevelopment/SnakeCharmR").
    Restart your R session.
    As a quick test, you can make sure that R and Python can communicate by typing the command library(SnakeCharmR).
    To validate or test the installation of RxODE completely, you can type the following library(RxODE); rxTest(); and it will run all of the unit tests in RxODE to make sure it is running correctly on your system. (Note that the testthat package is required for this, and it will take a long time.)

Then it continues with the nlmixr installation

samfux84 commented 4 years ago

I did the installation with enabling tests, and now the RxODE testsuite runs fine. After installing nlmixr, I tried running the test_install.R script. Most of it was running fine, but towards the end, I got several hundred lines of messages like the following:

unhandled error message: EE:[lsoda] trouble from intdy, itask = 1, tout = 24.08
 @(lsoda.c:679
intdy -- t = 0.25 illegal. t not in interval tcur - _C(hu) to tcur
intdy -- t = 0.5 illegal. t not in interval tcur - _C(hu) to tcur
intdy -- t = 1 illegal. t not in interval tcur - _C(hu) to tcur
intdy -- t = 2 illegal. t not in interval tcur - _C(hu) to tcur
intdy -- t = 3.52 illegal. t not in interval tcur - _C(hu) to tcur
intdy -- t = 5.07 illegal. t not in interval tcur - _C(hu) to tcur
intdy -- t = 7.07 illegal. t not in interval tcur - _C(hu) to tcur
intdy -- t = 9.03 illegal. t not in interval tcur - _C(hu) to tcur
intdy -- t = 12.05 illegal. t not in interval tcur - _C(hu) to tcur
intdy -- t = 24.15 illegal. t not in interval tcur - _C(hu) to tcur
unhandled error message: EE:[lsoda] trouble from intdy, itask = 1, tout = 24.15
 @(lsoda.c:679
Error in .fitFun(.ret) :
  Evaluation error: On initial gradient evaluation, one or more parameters have a zero gradient
Change model, try different initial estimates or use outerOpt="bobyqa").
Error in .fitFun(.ret) :
  Not compatible with requested type: [type=list; target=double].
Error in .fitFun(.ret) :
  Not compatible with requested type: [type=list; target=double].
Error in (function (data, inits, PKpars, model = NULL, pred = NULL, err = NULL,  :
  Could not fit data.
>

Is this a known problem?

mattfidler commented 4 years ago

Yes. But I have fixed it; If you run it again with the new script it should work.

SnakeCharmR is no longer required for linux, though it is suggested for windows.

mattfidler commented 4 years ago

I'll assume this worked for you @samfux84

samfux84 commented 4 years ago

@mattfidler Thank you for fixing the script. It now works like a charm


> source("test_install.R")
Correct R version: Yes, R version 3.6.1 (2019-07-05)
RxODE installed: Yes
Python installed: Yes, Python 3.7.4
sympy installed: Yes
devtools package installed: Yes
RxODE package installed: Yes
Rtools installed or not needed: Yes
SnakeCharmR package installed: Yes
units package installed: Yes
nlmixr package installed: Yes
xpose.nlmixr package installed: Yes
shinyMixR package installed: Yes
Running nlme
Running saem
Running focei
nlmixr run under nlme: Yes
nlmixr run under saem: Yes
nlmixr run under focei: Yes
---- Installation test finished! ----
Begin Session Info:
R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /cluster/spack/apps/linux-centos7-x86_64/gcc-6.3.0/openblas-0.2.19-jusdys62qhv52qjbsoewvthriekuaynw/lib/libopenblas_haswellp-r0.2.19.so

Random number generation:
 RNG:     Mersenne-Twister
 Normal:  Inversion
 Sample:  Rounding

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] nlmixr_1.1.1-7 RxODE_0.9.2-0

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.3                pillar_1.4.3
 [3] compiler_3.6.1            sys_3.3
 [5] PreciseSums_0.3           tools_3.6.1
 [7] mvnfast_0.2.5             digest_0.6.25
 [9] jsonlite_1.6.1            lattice_0.20-41
[11] nlme_3.1-147              huxtable_4.7.1
[13] memoise_1.1.0             lifecycle_0.2.0
[15] tibble_3.0.0              gtable_0.3.0
[17] pkgconfig_2.0.3           rlang_0.4.5
[19] Matrix_1.2-17             rex_1.1.2
[21] cli_2.0.2                 parallel_3.6.1
[23] xfun_0.13                 RcppArmadillo_0.9.860.2.0
[25] n1qn1_6.0.1-7             stringr_1.4.0
[27] dplyr_0.8.5               knitr_1.28
[29] generics_0.0.2            vctrs_0.2.4
[31] grid_3.6.1                tidyselect_1.0.0
[33] glue_1.4.0                data.table_1.12.8
[35] R6_2.4.1                  fansi_0.4.1
[37] SnakeCharmR_1.0.7         dparser_0.1.8
[39] ggplot2_3.3.0             purrr_0.3.3
[41] magrittr_1.5              vpc_1.1.0
[43] scales_1.1.0              ellipsis_0.3.0
[45] units_0.6-6               assertthat_0.2.1
[47] colorspace_1.4-1          brew_1.0-6
[49] stringi_1.4.6             lotri_0.2.1
[51] lazyeval_0.2.2            munsell_0.5.0
[53] crayon_1.3.4

>
mattfidler commented 4 years ago

Glad to hear it!