InternetOpenUrl failed: A connection with the server could not be established - r

I get this error on old Windows systems. I have an up to date Linux machine, there the following test runs fine:
length(readLines(file('https://saezlab.org/')))
On the same computer I have a Windows 7 virtual machine. There I get InternetOpenUrl failed: A connection with the server could not be established error. However for other URLs it works with no error:
length(readLines(file('https://google.com/')))
I tried to set the option download.file.method to wininet, internal, libcurl, without success. Also the webpage which fails from R (https://saezlab.org/) can be opened from Firefox. Searching for the error I got mostly irrelevant hits. My question is also about how to investigate further this issue? How can I get something similar to curl -vvv output, where I can see exactly where the communication fails? I see InternetOpenUrl sometimes gives more specific error messages (e.g. timeout, DNS issue, SSL error) but this message sounds quite vague: what's the reason why the connection can't be established? A little more background: I encountered this error when Bioconductor reported failed tests for my package on their Windows Server 2012 build machine (also an old Windows) while on their Windows Server 2019 machine the tests run fine. I used everywhere the latest R (4.0.2).

Related

How can I get past this 'SSL connect error' when using jsonlite::fromJSON in R?

Issue
I get the following error whenever I run
all_companies <- jsonlite::fromJSON("https://www.sec.gov/files/company_tickers_exchange.json")
Warning: URL 'https://www.sec.gov/files/company_tickers_exchange.json': status was 'SSL connect error'Error in open.connection(con, "rb") :
cannot open the connection to 'https://www.sec.gov/files/company_tickers_exchange.json'
Thank you in advance for any help!
What I've tried
I am trying to run this on a new work computer, it runs fine on my old work computer but the new one gives me this error.
It seems the difference causing this issue is that I am using {jsonlite} 1.8.2 on my new computer and 1.8.0 on my old computer. Deep in the definition of the fromJSON() function, the working version seems to use curl::curl() to establish a connection whereas the not-working version uses base::url().
The following example line from the help documentation runs fine on the new computer with version 1.8.2
data1 <- fromJSON("https://api.github.com/users/hadley/orgs")
I can access the JSON file I am trying to read on an internet browser.
I do not have permission to install Rtools on my computer to be able to compile an older version of {jsonlite}.

jupyterhub fails to spawn server with systemdspawner

I am trying to run jupyterhub on an Ubuntu 20.04 LTS server. My idea is to run python/jupyterhub in a conda virtual environment as a system service. As I want to be able to limit the resources available to individual users I installed the systemdspawner.
After installing everything and starting the jupyterhub service I can login through my web browser. However, when trying to start the server the spawner stucks and after a while I get an error message saying "Spawn failed: Timeout"
in journalctl I can see the following messages:
User logged in: me 302 POST /hub/login?next= -> /hub/spawn (me#::ffff:[my IP address]) 59.42ms
Adding role server to token: <APIToken('93c8...', user='me', client_id='jupyterhub')
Creating oauth client jupyterhub-user-me
pam_loginuid(login:session): Error writing /proc/self/loginuid: Operation not permitted
pam_loginuid(login:session): set_loginuid failed
pam_unix(login:session): session opened for user me by (uid=0)
Failed to open PAM session for me: [PAM Error 14] Cannot make/remove an entry for the specified session
Disabling PAM sessions from now on. user:me
Unit jupyter-me-singleuser in a failed state. Resetting state.
Disclaimer: My Jupyter/Python installation is replacing an former installation that was setup by someone else and got messed up a bit during time. I tried to remove everything related and start with a clean installation from scratch. However, as I had very little documentation about the old setup there is a certain risk that there might be some left-overs of the previous installation that may cause trouble.
Any ideas?
Solved it out myself. In the end the PAM related messages seem to be non-critical and were not related to the timeout at all. Instead I found a mistake in /etc/systemd/system/jupyterhub.service, where the PATH variable was not including the bin directory of my miniconda installation.

How to download data into Rstudio via "Rblpapi"?

Good afternoon. Recently I've experienced a problem with downloading data from Bloomberg information system into RStudio via "Rblpapi" package. In order to get this package on my PC I executed the following commands:
install.packages("Rblpapi")
library(Rblpapi)
This code was proceeded succesfully. Further, in order to establish the connection between my PC and Blooberg I did the following:
blpConnect()
Then I received the error message:
25MAR2021_12:27:10.598 4484:7384 ERROR blpapi_platformtransporttcp.cpp:671 blpapi.session.transporttcp.{4}.localhost:8194 Connection failed
25MAR2021_12:27:10.598 4484:7384 WARN blpapi_platformcontroller.cpp:371 blpapi.session.platformcontroller.{4} Platform: 0 failed 1 consecutive connect attempts, stopped trying to reconnect.
Error in blpConnect_Impl(host, port, appName) :Failed to start session.
Therefore, I couldn`t establish the connection between my PC and Bloomberg.
Could you, please, tell me, how this problem can be solved?
Thank you for your effort.

R RSelenium rsDriver chrome browser error on Mac

I am using a Mac (OS 10.13.6) and am trying to learn how to use RSelenium.
I have installed RSelenium but am having trouble with the rsDriver command:
rD <- rsDriver(browser="chrome",chromever="80.0.3987.106")
I get this error:
Could not open chrome browser.
Client error message:
Undefined error in httr call. httr output: Failed to connect to localhost port 4567: Connection refused
Check server log for further details.
Warning message:
In rsDriver(browser = "chrome", chromever = "80.0.3987.106") :
Could not determine server status.
I've been poking around for help for a couple of days now but am not clear on the appropriate solution here. I've tried the command with chromever="latest" and following the suggested workaround found here: stackoverflow.com/questions/55201226/. Furthermore, I don't know where to find the "server log" mentioned in the error.
Having never used this package before, or done this type of thing, I can't tell if I just don't have things set up on my machine correctly (non-R requirements of RSelenium that I need to install and where), or whether this is strictly a chrome browser setting/verison issue, or generally mac compatibility issue.
Does anyone an updated (i.e. not involving the defunct checkForServer() command) set of steps (for absolute Selenium beginners) for getting RSelenium set up and rsDriver working on a mac?
After a lot of trials and errors, I managed to solve the same issue by installing
Java SE Development Kit 14 on my Mac.
I hope this solves your issue.

R can't connect to Spigot server using ropenscilabs miner package

I would like to try out the miner Minecraft API from ROpenSci and am having trouble connecting to the server from R. I am sure this is a networking issue rather than a R or Minecraft issue but I don't really have any experience in this area.
I have followed the vignette and installed spigot on my Arch machine following these instructions and can successfully start the server and connect to it using the Minecraft client.
However when I try to connect through R I am unable to do so. This is what I get:
library(miner)
mc_connect("127.0.0.1")
Error in socketConnection(host = hostname, as.integer(port), open = "r+b", :
cannot open the connection
In addition: Warning message:
In socketConnection(host = hostname, as.integer(port), open = "r+b", :
127.0.0.1:4711 cannot be opened
I also tried "localhost" and adding server-ip=127.0.0.1
This looks like fun so it would be cool to figure out what I'm doing wrong.
This is my server.properties file if it helps:
#Minecraft server properties
#Wed Jul 12 21:30:47 NZST 2017
generator-settings=
force-gamemode=true
allow-nether=true
gamemode=1
enable-query=false
player-idle-timeout=0
difficulty=0
spawn-monsters=true
op-permission-level=4
pvp=true
snooper-enabled=true
level-type=DEFAULT
hardcore=false
enable-command-block=false
max-players=20
network-compression-threshold=256
resource-pack-sha1=
max-world-size=29999984
server-port=25565
debug=false
server-ip=
spawn-npcs=true
allow-flight=false
level-name=world
view-distance=10
resource-pack=
spawn-animals=true
white-list=false
generate-structures=true
online-mode=true
max-build-height=256
level-seed=
prevent-proxy-connections=false
use-native-transport=true
enable-rcon=false
motd=My very own minecraft server```

Resources