What might be the error if :
I got the error message shown below when I write into
install.packages("rstan", repos = "https://cloud.r-project.org/", dependencies = TRUE)
If your question relates to installation please provide the following information:
Debian Linux 8
- Output of
Thanks for help in advance,
Run R as a regular user rather than as root
Hmm, many thanks ! So I need to repeat the whole installation process ? Well, I think so, but if possible I would rather not, if there is some simpler way. I use docker so there is not much point in adding extra users.
I mean, why is this limitation there ? Is there specific reason for this ?
I don’t mind setting up a new user, but do I really have to ? Is there no way to make this
work with /root ? If not, why not ? Some security reason ? This confuses me because usually root is allowed to do anything. I am a bit puzzled. Is that really the “right” solution ? If yes, why ? Is this some sort of design choice or simply some bug ?
There is little reason to be running R as root on a Debian system. And apparently the way it searches for the compiler does not work given the root’s PATH variable.
How did you detect he was running R as root?
The warning message said it tried and failed to open
Well, perhaps it would help to run R as another user but if I can find a way to fix this issue, that would be better.
Apparently running R as root is fine : https://www.digitalocean.com/community/tutorials/how-to-install-r-on-debian-9
at least on Debian 8 .
So this is rather a bug than a feature. If it’s a bug I’d rather try to find a workaround than to change my whole stack :) to use a new user. I think the former is the “correct” ( and easier / quicker / less risky / more stable ) solution, if this is really a bug and not a feature.
Do you really want to enable R and R packages to be able to call
system as root? That link doesn’t say it is fine to run R as root, it says
Since we’re planning to install an example package for every user on the system, we’ll start R as root so that the libraries will be available to all users automatically. Alternatively, if you run the
R command without
sudo , a personal library can be set up for your user.
Are you trying to install rstan for every user on the system? If so, there are much safer ways to do so.
I am using everything inside Docker, so root is pretty much the only “meaningful” user there. Docker is basically the perfect “matrix” for a running program. A program is executed natively (not virtually) on the host machine but it “sees” that it is somewhere else. So even if it thinks the he/she is the root, that means nothing. In that virtual world.
Docker is basically a VirtualBox/VMWare virtual machine but it is not implemented az an “emulator”, the code is executed directly on the CPU but it is isolated and it “sees” whatever is shown to it.
This is the reason why root is the most meaningful user to use in a Docker environment. There is no other user. If I want to run two separate systems, then I start two docker containers and they cannot see anything except for what I want
to show them (say mounted external directories, exposed ports, etc).
Introducing users into a Docker container creates unneccessary complexity, hence I (and almost everybody) wants to avoid them.
Also, what is strange :
rstan to be installed already … but
R cannot find it… so maybe I should install the two packages separately ?
I have tried this :
well… maybe I have a different problem ?
need ot install C++14 ?
Ok, google says https://github.com/stan-dev/rstan/issues/569 :
put this into
CXX14 = g++ -std=c++1y
or maybe I put this into
~/.R/Makevars : https://raw.githubusercontent.com/cran/rstan/2.18.1/src/Makevars
CXX14 = g++ -std=c++1y
yes, this ^^^ seems to be helping (at least it does not stop with an error right away but starts to compile something, I hope that is a good sign ) :
no, that did not help :
this is my
Makevars file :
It says I need to recompile it with
-fPIC … hmmm … where do I put that flag in the
Makevars file ?
Many thanks ! I don’t know what kind of installation manual I have been reading so far… but this looks like it is the real deal !
btw, what is the best operating system for Stan / R , in general, is there some community wisdom on this topic ?
Sure, all linux is “the same”, but still … debian 8 might be a bit outdated… I start to be “afraid” … is it ? What is default linux distro used by R/Stan community ?
Debian 8 is fine, although you need R >= 3.4.0. All Linux distributions are not the same, but there is certainly no default one used by the R and / or Stan communities. Ubuntu is presumably the most popular one and the base for various R efforts with Travis, Docker, etc.
Cool, I stay with deb 8 then, cheers. Jozsef