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

installation issue #36

Closed snailittle closed 2 years ago

snailittle commented 3 years ago

My Rtools40 is missing mingw32-make. I tried to run the following check_cmdstan commands and it didn't work.

check_cmdstan_toolchain() Error: RTools installation found but PATH was not properly set. Run check_cmdstan_toolchain(fix = TRUE) to fix the issue. check_cmdstan_toolchain(fix = TRUE) Installing mingw32-make and writing RTools path to ~/.Renviron ... Error in processx::run("pacman", args = c("-Syu", "mingw-w64-x86_64-make", : System command 'pacman' failed, exit status: 1, stderr (last 10 lines): E> error: failed to update mingw32 (download library error) E> error: failed retrieving file 'mingw64.db' from cloud.r-project.org : SSL certificate problem: unable to get local issuer certificate E> error: failed retrieving file 'mingw64.db' from cran.r-project.org : SSL certificate problem: unable to get local issuer certificate E> error: failed retrieving file 'mingw64.db' from r-windows.github.io : SSL certificate problem: unable to get local issuer certificate E> error: failed to update mingw64 (download library error) E> error: failed retrieving file 'ucrt64.db' from cloud.r-project.org : SSL certificate problem: unable to get local issuer certificate E> error: failed retrieving file 'ucrt64.db' from cran.r-project.org : SSL certificate problem: unable to get local issuer certificate E> error: failed retrieving file 'ucrt64.db' from r-windo

I realized it may be due to the computer being company restricted. Therefore I called IT and asked them to sign in as admin. As R-studio was installed under my account and wouldn't run in admin account, I used Rtools bash to run the following command to install mingw32-make

pacman -Syu mingw-w64-X86_64-make.

It seems to be installing all right, all process reporting 100% installation. However after IT logged off, I came back to my own account, the same issue persisted. and I couldn't find where the ingw32-make was installed.

I tried the following command which showed that it still can't find mingw32-make. Now what should I do? Should I ask IT to log in as admin, reinstall Rtools40 and Rstudio as admin then set up the toolchain using "check_cmdstan_toolchain(fix = TRUE)" in R?
Is there a quick fix to find out why the installation for mingw32-make under admin didn't work when I logged back into my account? Many thanks.

Sys.which("make") make "C:\Users\zhup3107\DOCUME~1\rtools40\rtools40\usr\bin\make.exe" system('mingw32-make -v') [1] 127 system('g++ -v') Using built-in specs. COLLECT_GCC=C:\Users\zhup3107\DOCUME~1\rtools40\rtools40\mingw64\bin\G__~1.EXE COLLECT_LTO_WRAPPER=C:/Users/zhup3107/DOCUME~1/rtools40/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/lto-wrapper.exe Target: x86_64-w64-mingw32 Configured with: ../gcc-8.3.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --enable-bootstrap --with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,fortran --disable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts=yes --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Built by Jeroen for the R-project' --with-bugurl=https://github.com/r-windows --with-gnu-as --with-gnu-ld Thread model: posix gcc version 8.3.0 (Built by Jeroen for the R-project) [1] 0

yizhang-yiz commented 3 years ago

First, the general instruction for windows users can be found here https://mc-stan.org/docs/2_27/cmdstan-guide/cmdstan-installation.html#windows-make.

On your account, you might want to check the path C:\Users\zhup3107\DOCUME1\rtools40\rtools40\mingw64\bin and C:\Users\zhup3107\DOCUME1\rtools40\rtools40\usr\bin for mingw32-make. If it's located, you can add these paths to your environment variables.

snailittle commented 2 years ago

I can't seem to find mingw32-make in these folders. It seems the admin account is a separate account on the company computer. and whatever installed there may not translate into the user account.

yizhang-yiz commented 2 years ago

When a user has only limited access to the machine it's not easy to determine if Torsten has installation issue or something went wrong during the process. Any chance you can try it on a PC with full access?

snailittle commented 2 years ago

I was able to get past that step by copying a working rtoos40 from another computer. but I do run into issue when compiling models. Not sure what it means by " can't find files for the given patterns".

model <- cmdstan_model(stanfile) Compiling Stan program... INFO: Could not find files for the given pattern(s). % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 curl: (60) SSL certificate problem: unable to get local issuer certificate More details here: https://curl.haxx.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not establish a secure connection to it. To learn more about this situation and how to fix it, please visit the web page mentioned above. mingw32-make.exe: *** [make/stanc:70: bin/stanc.exe] Error 60 Error: An error occured during compilation! See the message above for more information.

yizhang-yiz commented 2 years ago

This indicates an issue of out-of-date certificate. It's better to enlist help from IT. On the other hand, since the issue happened when downloading stanc binary, you can try to do it manually. For example, for Torsten, you can download the windows binary at

https://github.com/metrumresearchgroup/stanc3/releases/download/torsten_v0.89rc2/windows-stanc

and copy the downloaded to Torsten/cmdstan/bin/stanc.exe, then retry building the model.

snailittle commented 2 years ago

Hi Yi. Many thanks for the instruction. I will try it  Per the instruction for installation of cmdstanr and CmdStan, (https://mc-stan.org/cmdstanr/articles/cmdstanr.html) I think for Torsten we don't need to install CmdStan because the folder is already in the torsten zip files.  I can just set the path and start using it.  am I correct?  or do we need to follow the instruction in the link to install cmdstan into another location and not use the same named folder torsten zip files folder?  or should I install cmdstan again into the torsten cmdstan folder?  Many thanks. Penny On Friday, September 10, 2021, 11:19:40 PM EDT, Yi Zhang @.***> wrote:

This indicates an issue of out-of-date certificate. It's better to enlist help from IT. On the other hand, since the issue happened when downloading stanc binary, you can try to do it manually. For example, for Torsten, you can download the windows binary at

https://github.com/metrumresearchgroup/stanc3/releases/download/torsten_v0.89rc2/windows-stanc

and copy the downloaded to Torsten/cmdstan/bin/stanc.exe, then retry building the model.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

snailittle commented 2 years ago

Many thanks for the instruction. I will try it
Per the instruction for installation of cmdstanr and CmdStan, (https://mc-stan.org/cmdstanr/articles/cmdstanr.html) I think for Torsten we don't need to install CmdStan because the folder is already in the torsten zip files. I can just set the path and start using it. am I correct? or do we need to follow the instruction in the link to install cmdstan into another location and not use the same named folder torsten zip files folder? or should I install cmdstan again into the torsten cmdstan folder?
Many thanks.

snailittle commented 2 years ago

tried to download the file via link https://github.com/metrumresearchgroup/stanc3/releases/download/torsten_v0.89rc2/windows-stanc and saved the file into torsten/cmdstan/bin folder and renamed to stanc.exe.

Tried to compile the model and still get an error. Maybe I did something wrong?

library(cmdstanr) setwd("C:/Users/zhup3107/Documents/Ranalysis/") set_cmdstan_path("C:/Users/zhup3107/Documents/Ranalysis/Torsten/cmdstan") file.dir <- file.path("Torsten", "example-models", "pk2cpt") stanfile <- file.path(file.dir, "pk2cpt.stan")

model <- cmdstan_model(stanfile) Compiling Stan program... Error: An error occured during compilation! See the message above for more information.

yizhang-yiz commented 2 years ago

Error: An error occured during compilation! See the message above for more information.

I don't see any error message. I wonder if there's something missing here.

To check if the downloaded binary works, you can do

system("C:/Users/zhup3107/Documents/Ranalysis/Torsten/cmdstan/bin/stanc.exe C:/Users/zhup3107/Documents/Ranalysis/Torsten/example-models/pk2cpt/pk2cpt.stan")

This should generate pk2cpt.hpp in the project folder.

snailittle commented 2 years ago

I was able to download stanc.exe and verify that the above command worked and generated the hpp file. Now trying to run Torsten and it seems working all right. Many thanks! You are a life saver!