"Invalid BXL stream" in MS-SQL server while executing R scripts - r

I am executing an R script as ms-sql stored procedure. I'm trying to use the "geosphere" package, however when I execute the stored procedure, I'm getting the error "Invalid BXL stream" and the execution halts. The package is already installed on the machine and simply loading the package causes this error i.e library("geosphere") causes the error.
I can however, use this package independently with R Studio, so there doesn't seem to be any issue with the package.

I know this question is dated but I've run into the same issue multiple times so I wanted to leave my results here.
What I've found in using sp_execute_external_script to run R and Python scripts in MS-SQL 2016/17 is that the BXL error comes for 2 different reasons
Bad data types - Often, SQL doesn't understand the data types being sent out of the script. Usually explicitly casting the data as a certain datatype helps here.
Bad package configuration - Certain packages in the R and Anaconda distributions don't sync well with the stored procedure since the database blocks certain dependencies in these packages. Try reinstalling the package in the SQL installed instance of R or Python.
It seems that your problem falls in the latter category. I hope that helped!

Had a similar issue today but with a different package. Getting "invalid BXL stream from MSSQL stored procedure. However, i found that If i opened up Rterm.exe and typed the command 'require(packagename)' then Rterm crashes with "Rterm frontend has stopped working". This looks like a memory issue - which has also been suggested causes the "invalid BXL stream" error.
However, my issue turned out to be the fact that the dependencies for the packages had not been installed correctly (perhaps you are working through a proxy?).
I basically removed all the library packages that had been created when I first installed the problem package and did a install.packages("packagename"). All started working!
Apologies - just noticed that you stated that the package worked independently with R studio - this is probably an issue with R Memory allocation with SQL - See http://henkvandervalk.com/introducing-microsoft-sql-server-2016-r-services

Related

R package versioning problems

I am developing an R-package in one R-session (within R-Studio) while testing the package in another R-session (within a second instance of R-Studio). The package ("P") contains an R-function "foo".
In the test session all calls to foo are made by explicit qualification P::f(...).
When a new version is ready, the old library is uninstalled (checked that it is really gone from all locations in .libPaths()), newly built and reinstalled (with a new version number).
After some iterations of this, a bizarre phenomenon started: an old version of P::foo
executes even though it should not exist anywhere. I even check in the test session via
R> P:foo
the source code and it displays the latest version. However this is not the code that is executing. I can tell by the way the log file is written and there is simply no doubt about it. It is an old version that is executing.
What could I do to analyse this situation?

Can no longer save R/RStudio scripts on OneDrive - Windows

R version: 4.0.3
RStudio version: 1.3
Windows 10, 1909
At my work I have to use OneDrive to store all my files and R scripts. This has worked fine up until recently. Now I get an error message when trying to save or modify an R script. I can create a new script and save it once, but if I try to make changes and save it again the error prevents me from doing so.
The error message in RStudio is:
"The create operation failed because the name contained at least one mount point which resolves to a volume to which the specified device object is not attached"
Not the most helpful error message.
The same behavior happens in R itself, but the error message just says it cannot save.
I have seen some talk online about this being related to that latest Windows 10 version (1909), but I started to experience the issue about 2 weeks before my computer updated to 1909. Besides, my work will not allow a roll back to the previous version.
Microsoft's OneDrive team failed to provide any help on this because they see it as an error on the R/RStudio side.
Anyone else experiencing this? Any solution?

RStudio Project stalls even without running anything

One of my RStudio projects stalls even before I've run any code or loaded any packages or data. I can edit scripts but it won't save them and it won't run code in the console. I am still able to use R from the terminal. After some time (in the range of an hour or so), multiple dialog boxes will pop up with the message Unable to establish connection with R session. I've seen a similar thing before when loading big datasets or running something computationally intensive but never before I've even run any code or loaded any data.
My other Projects don't seem to have the same problem.
I've also filed an issue here on the RStudio github with some screenshots and log files in case that's helpful.
The solution was to update the data.table package. See the issue I filed or this thread on RStudio community

Error occurred while checking for updates.Unable to establish connection with R session Rstudio

I am unable to load an R project and I am getting an error: Error occurred while checking for updates. Unable to establish a connection with R session with R studio. I am using large data sets inside that projects which might be causing this issue. Is there a way I could log in from the terminal and remove some datasets from the workspace. Can someone help how I can log in?
It sounds like you're auto-saving the workspace to .RData. It's usually not a problem (though still not advised) to do so with small-ish data sets/objects in the workspace but it's almost deadly to use this setting if you work with large data sets/objects often.
Disable the Restore .RData into workspace at startup setting in RStudio preferences and also set Save workspace to .RData on exit to Never.
Hunt down all the .RData files in your various working directories and delete them, too.
I had the same problem. And the above proposed strategy did not work well. However, having anaconda installed in my PC I downloaded Rstudio on that platform. Contrarily to the other Rstudio standalone version, Rstudio in anaconda works well. I do not know why, but in case of need you can smash out your Rstudio without deleting your files and use the Rstudio on the anaconda platform. Just to have another point of view!

Error: Unable to establish connection with R session

I am having trouble pulling down data sets from the web (https://api.fda.gov) FDA API. The connection is fine and it appears generate more than 4000 JSON records. The problem is, when it is done, R gives me the below error and I am no longer able to do anything in RStudio - I basically have to force quit. I've seen references to similar issues, but haven't been able to find a solution.
Error: Unable to establish connection with R session
I assume that you are using RStudio? There is a problem with RStudio and pulling large data sets. See here: Wang's Tech Blog and here: RStudio Support.
I suggest just using R in the terminal when you run scripts that pull large data-sets.
I was able to solve all problems by deactivating/deinstalling the antivirus software (Avast)
I also ran into this error. Uninstalling avast did not work for me. I uninstalled r and r studio and reinstalled r and r studio and this solved my problem.

Resources