What is LD_LIBRARY_PATH for R in a conda envrionment? - r

I have an a GCP virtual machine running RStudio Server. It has a public IP and I was accessing it at #.#.#.#:8787. During an ubuntu (22.04) update the server stopped working via the public IP. sudo rstudio-server verify installation showed that libR.so could not be found. However, if I ssh tunnel to the vm I can access RSS at localhost:8787.
According to the folks at RStudio, the problem may have to do with setting the LD_LIBRARY_PATH for R in the /etc/rstudio/rserver.conf file. However, I can't seem to figure out what that should be set to.
I tried /home/balter/conda/lib/R/lib, but that did not fix the problem.
There is more detail in the issue I filed.
My question here is what to try instead of rsession-ld-library-path=/home/balter/conda/lib/R/lib in the /etc/rstudio/rserver.conf file?

Related

How do I make the R kernel available to jupyter?

I have read multiple articles along this line, but they all use conda to install R. I am not using conda; I have Windows Subsystem for Linux installed. I was successfully able to install Python, create a virtual environment, and install and run jupyter notebook in that virtual environment.
I installed R in WSL, then activated my virtual environment and ran R with "sudo R" because I was getting a permissions issue. I was able to install IRkernel, but I get an error when I run this:
IRkernel::installspec(user=FALSE)
The error message is: "jupyter-client has to be installed but 'jupyter kernelspec --version' exited with code 127".
I thought it might be a path error, so I used this:
Sys.setenv(PATH="everything from getenv:/path-to-virtual-env/bin")
Tried using installspec again but got the same 127 error.
I'm concerned that it might be because of where I put my virtual environment. To access your files on Windows from within WSL, you have to go to "/mnt/c/Users/your-username/". That's where my virtual environment is, and I'm wondering if that's why R can't see it even when I explicitly tell R where it is. Any help is appreciated.

Is it possible to install Rstudio server on Linux without root access?

I'm an undergraduate research assistant working on a Linux server without root privilege. I'm trying to install the Rstudio server but the Rstudio website only provides the installation method for sudoers. Is it possible to install it without root access? I'm asking because I'm really not sure if I could get access from the manager. Any help will be appreciated!
No, you can't install it without root access. But there are a couple of things you could do to piece together a solution. Here are two options:
Extract the server and run it directly
You have to be root to install packages, so you can't install the .deb/.rpm file yourself. However, you could extract the contents of the file to a directory inside your home directory and run RStudio Server from there, by executing the rserver program in a regular shell.
Note that this will probably require an afternoon of editing the rserver.conf file to tell it where to find the rest of the files in the installation (since it presumes they are installed in /usr/lib by default). You can get some inspiration for how to do this here: https://github.com/rstudio/rstudio/blob/master/src/cpp/conf/rserver-dev.conf
Run the desktop version and forward the graphics
The other route is to run RStudio Desktop on the server; we make several builds of RStudio Desktop that are installer-less and can just be unpacked into your home directory. Then run an X11 server on your own computer and an X11 client on the RStudio server, so that the RStudio Desktop instance appears on your computer instead of the server.
Yes, you can run rserver without root priveliges.
For RStudio 1.4 I patched the following line into src/cpp/core/LogOptions.cpp
const FilePath kDefaultLogPath = core::system::xdg::userDataDir().completePath("log");
Then you need to set the system environment variables to some location read-writeable for the user, like
RSTUDIO_CONFIG_DIR=$HOME/.config/rstudio
RSTUDIO_CONFIG_HOME=$HOME/.config/rstudio
RSTUDIO_DATA_HOME=$HOME/.local/share/rstudio
And start rserver with the option
--server-data-dir={directory writeable for user}
--server-pid-file={file-path creatable for user}
--database-config-file={config-file}
With these adjustments it runs for me when I start it as a simple user (no root privileges) with
rserver --auth-none=1 --www-frame-origin=same --www-port={port} --www-verify-user-agent=0 --server-data-dir={my-tmp-path} --server-pid-file={my-tmp-path}/rstudio.pid --database-config-file={my-tmp-path}/db.conf}
ATTENTION:
But be aware, that anyone who can reach your system and the specified port from the network has access to the running RStudio in his browser and therefore can run any command in the name of the user on your system now.

Error while opening Rstudio throught Terminal

I am working with Unix and from now on I need to use the University server to run some packages in R.
1.I assessed the server by ssh
2.I downloaded miniconda
3.source ~/.bashrc
4.Downloaded Rstudio
5. conda install -c r rstudio
And when I am trying to open Rstudio I am receiving the following error
'QXcbConnection: Could not connect to display'
Any help will be super useful.
Depending you your platform and your university's security policy this may or may not work
https://unix.stackexchange.com/questions/12755/how-to-forward-x-over-ssh-to-run-graphics-applications-remotely
In short you need to explicitly enable X11 forwarding (though I was under the impression that it is on by default). Also you need to run an X11 server, there are a few on windows and MacOS. If the above does not help, it is most likely due to a security policy and you may want to speak to your university's SysAdmin

rsession: no process found - R Studio

I am installing R Studio on AWS ec2 instance running Ubuntu. While installation I get an error "rsession: no process found".
After installation I opened "server_ip:8787" in browser, R Studio asked me for login credentials. I am unable to login as it always shows "RStudio initialization error : Unable to connect to server".
In terminal when I enter sudo rstudio-server verify-installation nothing happens.
sudo rstudio-server restart gives rsession: no process found.
I also tried sudo ufw allow 8787 but no success.
you've probably already fix your issue, but have you actually installed R BEFORE RStudio?
I had the same problem (using Hetzner server) and sudo ufw allow 8787 did the trick for me. Thanks!

Getting auth sign message when connecting cloud server using opencpu

I am trying to expose a sample r model as API so I created R package. In my local machine , I am able to get the output using the command :
curl http://local host/5656/ocpu/library/mypackage/R/tv/json -F "input=#test.csv"
But when I am trying the same in my AWS linux cloud server on CentOS , I am not getting the output. I tried the command :
curl 13.228.109.233:8787/p/5656/ocpu/library/mypackage/R/tv/json -F "input=#test.csv"
and I get the output as
http://13.228.109.233:8787/auth-sign-in?appUr‌​i=%2Fp%2F5656%2Focpu‌​%2Flibrary%2Fmypacka‌​ge%2FR%2Ftv%2Fjson .
The R package is loaded into the my R studio server and I am trying to access it using putty. I installed the open cpu using the command :
yum install opencpu-server
It looks like it is asking for some authentication but I am not able to get what it means. Am I missing something here?
Thanks
If one visits the URL with a browser, one sees the RStudio-Server login screen. And indeed, you are connecting to port 8787, which is the default port for Rstudio Server. Try URLs below http://13.228.109.233/ocpu/ instead.
As Ralf suggests, that was the error , I was giving the wrong URL . Also, whenever we install opencpu in CentOS , just doing a 'yum install opencpu-server' might not be sufficient. We need to execute the entire built script: https://github.com/opencpu/opencpu-server/blob/master/rpm/buildscript.sh
Without executing the build script , I was not able to connect to opencpu server.
Just in case someone gets the same issue.

Resources