Trouble installing rstan on Windows

Another try replying ‘Yes’ to installation from source:

Installing 1 packages: rlang

There is a binary version available but the source version is later:
binary source needs_compilation
rlang 0.4.5 0.4.6 TRUE

installing the source package ‘rlang’

trying URL ‘https://cran.ma.imperial.ac.uk/src/contrib/rlang_0.4.6.tar.gz
Content type ‘application/x-gzip’ length 835198 bytes (815 KB)
downloaded 815 KB

  • installing source package ‘rlang’ …
    ** package ‘rlang’ successfully unpacked and MD5 sums checked
    ** using staged installation
    ** libs

*** arch - i386
c:/Rtools/mingw_32/bin/gcc -I"C:/Users/MSmith/DOCUME~1/R/R-36~1.0/include" -DNDEBUG -I./lib/ -O3 -Wall -std=gnu99 -mtune=generic -c capture.c -o capture.o
sh: c:/Rtools/mingw_32/bin/gcc: No such file or directory
make: *** [C:/Users/MSmith/DOCUME~1/R/R-36~1.0/etc/i386/Makeconf:208: capture.o] Error 127
ERROR: compilation failed for package ‘rlang’

  • removing ‘C:/Users/MSmith/Documents/R/R-3.6.0/library/rlang’
    Error: Failed to install ‘rethinking’ from GitHub:
    (converted from warning) installation of package ‘rlang’ had non-zero exit status

Are you using R 4.0 or R 3.6?

I installed R 4.0 (previously using 3.6) which combined with Rtools40 managed to get Rstan installed.

HI.
I am also facing same issue. Please help

Can you post the full error message that you’re getting?

After searching a lot solutions, finally I delete .Renviron file in C:\Users\My name\Documents. Then rtools40 works.