metrumresearchgroup / Torsten

library of C++ functions that support applications of Stan in Pharmacometrics
BSD 3-Clause "New" or "Revised" License
52 stars 11 forks source link

Error in Instalation #18

Closed AK-qwe closed 4 years ago

AK-qwe commented 4 years ago

I tried to install Torsten. Then I download Git by zipn file from https://github.com/metrumresearchgroup/Torsten.git. and unfreeze by Lhaplus. After unfreezing, I excused following code on Rstudio.

devtools::load_all('Torsten_master/TorstenHeaders')

but next error come out

" Error in utils::unzip(file.path(td, "math.zip"), exdir = td) : cannot open file 'C:/Users/kano/AppData/Local/Temp/RtmpSqZq6g/torsten/math-157f5f950191216a860817b5fa5696c54288c14d/lib/boost_1.69.0/doc/html/boost_asio/reference/async_result_ltstdpackaged_task_lt__Result_lp_Args_ellipsisrpgtcommaSignature_gt/completion_handler_type.html': No such file or directory

  1. utils::unzip(file.path(td, "math.zip"), exdir = td) at zzz.R#35
  2. nsenv[[f_name]](dirname(ns_path), package)
  3. run_pkg_hook(package, "load")
  4. pkgload::load_all(path = path, reset = reset, recompile = recompile, export_all = export_all, helpers = helpers, quiet = quiet, ...)
  5. devtools::load_all("Torsten_master/TorstenHeaders") "

Actually, I cant find "completion_handler_type.html" in the folder but find "async_result.html" in that folder.

What can I do to install torsten?

I use windows10, gcc 4.9.3, rstan 2.19.2, R x64 3.5.3 and Rstudio1.1.453

thank you.

yizhang-yiz commented 4 years ago

It's likely caused by Windows' limit on max number of characters in path, as the file path that causes grief is > 260 characters. If that's the case, use set.tempdir to change R's temp path to a different location could resolve it.

Another possible solution is to use external unzip program instead of R's internal implementation. That requires specifying unzip option in unzip calls in https://github.com/metrumresearchgroup/Torsten/blob/master/TorstenHeaders/R/zzz.R

See also https://www.rdocumentation.org/packages/utils/versions/3.6.1/topics/unzip

AK-qwe commented 4 years ago

Dear Mr. yizhang-yiz, Thank you for your fast suggestion.

I tyied to use set.tempdir, so I installed unixtools library, but could not installed.

Thas, I made a file named Renviron.site, by reference to https://stackoverflow.com/questions/38364431/changing-temporary-directory-in-r?rq=1

As a result, I could change R's temp path.

SO, next I run devtools::load_all("Torsten_master/TorstenHeaders")

but both in Rstudio and R console, R session aborted and stop installing.

Therefore, I run zzz.R file then did " devtools::load_all('Torsten_master/TorstenHeaders') ". As a result, R session aborted in this case. How can I use external unzip program appropriately?

Thank you

yizhang-yiz commented 4 years ago

You can install unzip package such as 7-zip and point to it in R's unzip command using

unzip(zipfile, ...., unzip = "path/to/your/own/unzip/file",....)
AK-qwe commented 4 years ago

Dear Mr. yizhang-yiz,

I removed the file named Renviron.site, and then tyied devtools::load_all("Torsten_master/TorstenHeaders") As a result, the same error occurred.

Thus, I ran unzip(zipfile = '~/Torstenmaster.zip', unzip = "~/TorstenHeaders/R/zzz.R") but Rstudio said Warning message: In system2(unzip, args, stdout = NULL, stderr = NULL, invisible = TRUE) : '"~/TorstenHeaders/R/zzz.R"' not found

The same error occurs after update of R 3.6.1. I also confirmed Makevar.win and g++.

What should I do?

Thank you

AK

yizhang-yiz commented 4 years ago

Sorry for being confusing, I meant to say that you can

  1. Install an unzip library such as 7-zip in your Windows system
  2. Replace utils::unzip(...) command in zzz.R file with utils::unzip(..., unzip="path/to/your/unzip/software")
  3. try to install Torsten again.

You can also choose not to use R interface. Instead, cmdstan interface is included in Torsten package and you can  simply follow the cmdstan user-guide to compile and run Stan/Torsten models.

AK-qwe commented 4 years ago

Dear Mr. yizhang-yiz,

thank you verry much. I could unzip the zipfile by utils::unzip(zipfile = '~/Torstenmaster.zip', unzip = "C:/Program Files (x86)/Lhaplus/Lhaplus.exe") and utils::unzip(zipfile = '~/Torstenmaster.zip', unzip = "C:/Program Files (x86)/Lhaz/Lhaz.exe") or using 7-zip without R, naming the unziped folder as 'Torsten-master'.

Then I tried to install torsten by devtools::load_all("Torsten-master/TorstenHeaders") As a result, the same error as the first question came up. Error in utils::unzip(file.path(td, "math.zip"), exdir = td) : .........

what is the problem? AK

AK-qwe commented 4 years ago

In addition, if I changed the current directory by making a file named named Renviron.site, by reference to https://stackoverflow.com/questions/38364431/changing-temporary-directory-in-r?rq=1 , the Rstudio was stopped like previous Comment.

AK-qwe commented 4 years ago

Dear Mr. yizhang-yiz,

I downloaded the latest version of Torstern-Header. Finally, I understood how to rewrite 'unzip'. Therefore I could run "devtools::load_all("TorstenHeaders-master")"

But still Rstudio claimed error saying "cant install rstan and cant find path of math" Thus, I removed rstan library, downloaded "math" file and moved math folder in TorstenHeader.

Even then, R claimed that "C:\PROGRA~1\Git\cmd\git.exe" clone --depth 1 --no-hardlinks --recurse-submodules --branch develop https://github.com/stan-dev/stan.git C:\Users\username\AppData\Local\Temp\Rtmpae79qN\remotes169c5b4d4fb2/metrumresearchgroup-rstan-3364006/rstan/rstan/../../StanHeaders/inst/include/upstream Error: Failed to install 'rstan' from GitHub: Command failed (128) In addition: Warning messages: 1: In utils::untar(tarfile, ...) : ‘tar.exe -xf "C:\Users\username\AppData\Local\Temp\Rtmpae79qN\file169c547e6450.tar.gz" -C "C:/Users/username/AppData/Local/Temp/Rtmpae79qN/remotes169c5b4d4fb2"’ returned error code 1 2: In system(full, intern = TRUE, ignore.stderr = quiet) : What should I do? AK

AK-qwe commented 4 years ago

P.S. I use windows10, gcc 4.9.3, rstan 2.19.3, R x64 3.6.2 and Rstudio1.2.5033, StanHeaders2.21.0-1. Shall I downgrade some packages?

yizhang-yiz commented 4 years ago

Apologies for not replying sooner. I'm not able to diagnose base on the above error msg. However, we're working on using cmdstanr as Torsten's R interface. If you'd like to give it a try, please install cmdstanr before downloading the develop branch of Torsten. A demo using cmdstanr to fit two compartment model can be found at

https://github.com/metrumresearchgroup/Torsten/tree/develop/example-models/pk2cpt

See https://github.com/metrumresearchgroup/Torsten/blob/develop/example-models/pk2cpt/run.R in that directory for details.

AK-qwe commented 4 years ago

Dear Mr. yizhang-yiz,

Thank you for your suggestion. Then I will try cmdstanr next.

Thank you. AK