Quantcast
Channel: R.NET
Viewing all 1634 articles
Browse latest View live

New Post: Inside SQLCLR

$
0
0
I've implemented the HellowWorldFromR() method as well as several others but after I execute one from SQL Server one time and attempt a second execution, I get this error, presumably because I call Dispose():

Msg 6522, Level 16, State 2, Line 32
A .NET Framework error occurred during execution of user-defined routine or aggregate "OneSidedHypothesis":
System.InvalidOperationException: The single REngine instance has already been disposed of (i.e. shut down). Multiple engine restart is not possible.
System.InvalidOperationException:
at RDotNet.REngine.GetInstance(String dll, Boolean initialize, StartupParameter parameter, ICharacterDevice device)
at ProviderAnalysisCLR.OneSidedHypothesis(SqlDecimal PriorAverage, SqlDecimal Tau, SqlDecimal ProvMean, SqlDecimal ProvStdDev, SqlDecimal N)

How am I supposed to get around this? Clearly, the engine should be disposed and when I run this as a standard function from a Console app it works fine with repeated executions.

New Post: REngine.CreateInstance

$
0
0
So, in a static method in a SQL CLR library, should we NOT call Dispose()?

New Post: REngine.CreateInstance

$
0
0
Well, I tried that and still ended up with the same old error:

Msg 6522, Level 16, State 2, Line 32
A .NET Framework error occurred during execution of user-defined routine or aggregate "OneSidedHypothesis":
System.InvalidOperationException: The single REngine instance has already been disposed of (i.e. shut down). Multiple engine restart is not possible.
System.InvalidOperationException:
at RDotNet.REngine.GetInstance(String dll, Boolean initialize, StartupParameter parameter, ICharacterDevice device)
at ProviderAnalysisCLR.OneSidedHypothesis(SqlDecimal PriorAverage, SqlDecimal Tau, SqlDecimal ProvMean, SqlDecimal ProvStdDev, SqlDecimal N)

Anything that can be done here? I'm out of ideas....

New Post: REngine.CreateInstance

$
0
0
Update:

I got it to run properly in SQL Server by ommitting the call to Dispose(). However, now I'm running up against the library apparently crashing after running for several minutes. Any thoughts?

Thanks!

New Post: Inside SQLCLR

$
0
0
gksmithlcw wrote:
I've implemented the HellowWorldFromR() method as well as several others but after I execute one from SQL Server one time and attempt a second execution, I get this error, presumably because I call Dispose():

Msg 6522, Level 16, State 2, Line 32
A .NET Framework error occurred during execution of user-defined routine or aggregate "OneSidedHypothesis":
System.InvalidOperationException: The single REngine instance has already been disposed of (i.e. shut down). Multiple engine restart is not possible.
System.InvalidOperationException:
at RDotNet.REngine.GetInstance(String dll, Boolean initialize, StartupParameter parameter, ICharacterDevice device)
at ProviderAnalysisCLR.OneSidedHypothesis(SqlDecimal PriorAverage, SqlDecimal Tau, SqlDecimal ProvMean, SqlDecimal ProvStdDev, SqlDecimal N)

How am I supposed to get around this? Clearly, the engine should be disposed and when I run this as a standard function from a Console app it works fine with repeated executions.
Update:

I got it to run properly in SQL Server by omitting the call to Dispose(). However, now I'm running up against the library apparently crashing after running for several minutes. Any thoughts?

Thanks!

New Post: R.NET in ASP.NET application

$
0
0
Hi,

I can run R from a Console App but from my ASP.NET app it now says this??? It used to also work...

Cannot evaluate expression because the current thread is in a stack overflow state

Help!?

New Post: R.NET in ASP.NET application

New Post: Inside SQLCLR

$
0
0
You'll need to provide more information, if possible of course.

Why do you state "apparently crashing"?. If you have a stack trace or error message to report, please do so.

New Post: REngine.CreateInstance

$
0
0
This thread attracted my attention as I have a related problem with
REngine engine = REngine.GetInstance();

Using the NuGet package manager with Visual Studio, I have installed
R.Net.Community (v1.6.5) and its dependency DynamicInterop (v.0.7.4).

In my case, REngine.GetInstance fails with the exception:
Windows Registry key 'SOFTWARE\R-core' not found in HKEY_LOCAL_MACHINE nor HKEY_CURRENT_USER

I've installed the system on several machines and the same error appears.

I have also tried setting rHome and rPath explicitly as shown in the code snippet below, but another
exception appears:
An unhandled exception of type 'System.Exception' occurred in DynamicInterop.dll
Additional information: This 32-bit process failed to load the library R.dll.
Native error message is 'The specified module could not be found'
However, I have confirmed that R.dll does exist in the specified folder.

I am grateful for a solution or any helpful suggestions.

using System;
using System.IO;
using RDotNet;

namespace ConsoleApplication1
{
class Program
{
    static void Main(string[] args)
    {

        string rHome = @"C:\Program Files\R\R-3.1.3";
        string rPath = Path.Combine(rHome, @"bin\x64");
        REngine.SetEnvironmentVariables(rHome, rPath);

        // There are several options to initialize the engine, but by default the following suffice:
        REngine engine = REngine.GetInstance();

        engine.Dispose();
    }
}
}

New Post: Different results while running a script in R and in C# with R.NET

$
0
0
Hi Everyone,

I am having a problem that running the same script in C# gives me the different result when running the same script with the exactly the same data directly in R.

Did anyone ever experienced this? I tried almost anything and checked everything multiple times with multiple data sets.

Tnx in advance

New Post: REngine.CreateInstance

$
0
0
grc2001,

You use explicit rPath to set environment variables, but your process is 32 bits ("This 32-bit process failed to load the library R.dll" ) and you specify the path to 64 bits R ("string rPath = Path.Combine(rHome, @"bin\x64");"). It cannot work. You need to change your c# project settings to run in 64 bits, or specify the path to 32 bits R.

Regarding the first issue encountered, if the windows registry keys are indeed not set up, it behaves as it should, If you do have R reg keys set, report the overall content, as it is possibly a bug.

the page http://jmp75.github.io/rdotnet/ts_paths_on_windows/ provides some material to help diagnose such issues.

New Post: A process serving application pool 'DefaultAppPool' suffered a fatal communication error with the Windows Process Activation Service. The process id was 'xxxx'. The data field contains the error number.

$
0
0
Hello Everyone,

I have spent the better portion of last 2 days trying to resolve this issue to no avail. I thought now would be a good time to look for help and hence i am here:

Objective
Trying to execute a R script with C#.NET website that allows users to enter input and training files (csv) and spits out a csv file.

Progress
The website is fully functional on my local instance on Visual Studio 2010

Issue
Post deployment on IIS 7.5, the application accepts the input and training files and continues executing indefinitely.

System Configuration
Windows 7 64 bit (16 GB RAM - not more than 5 GB utilized at any point)
R 3.2.2
IIS 7.5

Diagnostics Steps Taken
  1. I checked the event viewer and found a WAS warning that happens every time (unaccompanied by error). The warning says -
    A process serving application pool 'DefaultAppPool' suffered a fatal communication error with the Windows Process Activation Service. The process id was 'xxxx'. The data field contains the error number.
  2. I also used DebugDiag for Windows and can see that w3wp.exe is closing at this time ([9/22/2015 1:07:16 PM] Process Exited: Process Name - w3wp.exe Process ID - 9552 Web application pool name - DefaultAppPool) but i am unable to find out why
Resolutions Attempted
  1. Disabled Rapid Fail Protection in application pool
  2. Enabled 32-bit applications in application pool
  3. Tried to run application with smaller input files (This works. Code is able to run for CSV file with 10 rows. Current file is 1200 rows)
Possible Issue
Since point 3 above worked i suspect it is some kind of stack/buffer overflow but i am unable to pin-point or resolve it

Will deeply appreciate any direction you can provide.

Thanks,
Rahul

Created Unassigned: REngine.GetInstance fails [177]

$
0
0
Hi, I'm new to R but really would love to use it in my C# programs via RDotNet. I've added R.net via Manage NuGet Packages in VS2013 (RDotNet runtime Version v4.0.30319).

Within Windows 7 I'm running R-3.2.2 and both 32bit and 64bit reside within my C:\Program Files\R\R-3.2.2\bin folder.

Here's the beginning of my code.

using System.IO;
using System.Linq;
using RDotNet;
using RDotNet.NativeLibrary;

namespace RNetTest
{
class Program
{
static void Main(string[] args)
{
// Set the R_HOME environment variable in which R.dll is located.
Environment.SetEnvironmentVariable("R_HOME", @"C:\Program Files\R\R-3.2.2\bin\i386");

REngine engine = REngine.GetInstance("RDotNet");

It fails on the GetInstance with the error:

An unhandled exception of type 'System.ArgumentException' occurred in DynamicInterop.dll

Additional information: Could not retrieve a pointer for the symbol 'R_CStackLimit' in file 'RDotNet'

If I run REngine.GetInstance(); like is suggested I get the following error:

An unhandled exception of type 'System.Exception' occurred in DynamicInterop.dll

Additional information: This 32-bit process failed to load the library R.dll. Native error message is 'The system cannot find the file specified'

I've been wrestling with this for many hours now and finally asking for some help on what a solution might be. It should be noted the error is the same for 32bit or 64bit R.dll versions.


Commented Unassigned: REngine.GetInstance fails [177]

$
0
0
Hi, I'm new to R but really would love to use it in my C# programs via RDotNet. I've added R.net via Manage NuGet Packages in VS2013 (RDotNet runtime Version v4.0.30319).

Within Windows 7 I'm running R-3.2.2 and both 32bit and 64bit reside within my C:\Program Files\R\R-3.2.2\bin folder.

Here's the beginning of my code.

using System.IO;
using System.Linq;
using RDotNet;
using RDotNet.NativeLibrary;

namespace RNetTest
{
class Program
{
static void Main(string[] args)
{
// Set the R_HOME environment variable in which R.dll is located.
Environment.SetEnvironmentVariable("R_HOME", @"C:\Program Files\R\R-3.2.2\bin\i386");

REngine engine = REngine.GetInstance("RDotNet");

It fails on the GetInstance with the error:

An unhandled exception of type 'System.ArgumentException' occurred in DynamicInterop.dll

Additional information: Could not retrieve a pointer for the symbol 'R_CStackLimit' in file 'RDotNet'

If I run REngine.GetInstance(); like is suggested I get the following error:

An unhandled exception of type 'System.Exception' occurred in DynamicInterop.dll

Additional information: This 32-bit process failed to load the library R.dll. Native error message is 'The system cannot find the file specified'

I've been wrestling with this for many hours now and finally asking for some help on what a solution might be. It should be noted the error is the same for 32bit or 64bit R.dll versions.


Comments: I think you need to simplify your invocation by removing the explicit path and instance name. Have a look at the example on the main page of the rdotnet codeplex site: http://rdotnet.codeplex.com/

Commented Unassigned: REngine.GetInstance fails [177]

$
0
0
Hi, I'm new to R but really would love to use it in my C# programs via RDotNet. I've added R.net via Manage NuGet Packages in VS2013 (RDotNet runtime Version v4.0.30319).

Within Windows 7 I'm running R-3.2.2 and both 32bit and 64bit reside within my C:\Program Files\R\R-3.2.2\bin folder.

Here's the beginning of my code.

using System.IO;
using System.Linq;
using RDotNet;
using RDotNet.NativeLibrary;

namespace RNetTest
{
class Program
{
static void Main(string[] args)
{
// Set the R_HOME environment variable in which R.dll is located.
Environment.SetEnvironmentVariable("R_HOME", @"C:\Program Files\R\R-3.2.2\bin\i386");

REngine engine = REngine.GetInstance("RDotNet");

It fails on the GetInstance with the error:

An unhandled exception of type 'System.ArgumentException' occurred in DynamicInterop.dll

Additional information: Could not retrieve a pointer for the symbol 'R_CStackLimit' in file 'RDotNet'

If I run REngine.GetInstance(); like is suggested I get the following error:

An unhandled exception of type 'System.Exception' occurred in DynamicInterop.dll

Additional information: This 32-bit process failed to load the library R.dll. Native error message is 'The system cannot find the file specified'

I've been wrestling with this for many hours now and finally asking for some help on what a solution might be. It should be noted the error is the same for 32bit or 64bit R.dll versions.


Comments: That's the direction I originally took. I've been trying to follow many of the different examples that are on this site and none work. When I try just this: REngine.SetEnvironmentVariables(); REngine engine = REngine.GetInstance(); I get the following error on the SetEnvironmentVariables call. An unhandled exception of type 'System.IO.DirectoryNotFoundException' occurred in RDotNet.NativeLibrary.dll Additional information: Directory '' does not exist - cannot set the environment variable R_HOME to that value

Created Unassigned: R.NET Dataframe not handling POSIXlt properly [178]

$
0
0
Hi
One of my R dataframe column is of type "POSIXlt".
I am loading this R dataframe in R.NET's Dataframe object like following :

In R (instance created using R.NET):
----------------------------------------
mydataset = # some R dataframe that has, say fourth column of type POSIXlt. And there are more than 11 rows in the dataframe.

In C#
------
DataFrame DF = engine.GetSymbol("mydataset").AsDataFrame();

Now, when I try to access value of the row index greater than 11 and col index (that is of type POSIXlt), I get ArgumentOutOfRangeException ( as if that particular index doesn't exists ).

//now if I try to access 4th column of row index greater than 11, I get exeception
object data = DF[12,4];


Thanks,

Commented Unassigned: R.NET Dataframe not handling POSIXlt properly [178]

$
0
0
Hi
One of my R dataframe column is of type "POSIXlt".
I am loading this R dataframe in R.NET's Dataframe object like following :

In R (instance created using R.NET):
----------------------------------------
mydataset = # some R dataframe that has, say fourth column of type POSIXlt. And there are more than 11 rows in the dataframe.

In C#
------
DataFrame DF = engine.GetSymbol("mydataset").AsDataFrame();

Now, when I try to access value of the row index greater than 11 and col index (that is of type POSIXlt), I get ArgumentOutOfRangeException ( as if that particular index doesn't exists ).

//now if I try to access 4th column of row index greater than 11, I get exeception
object data = DF[12,4];


Thanks,

Comments: I'm not familiar with that type. Can you provide a small and compact example that demonstrates the issue?

Commented Unassigned: REngine.GetInstance fails [177]

$
0
0
Hi, I'm new to R but really would love to use it in my C# programs via RDotNet. I've added R.net via Manage NuGet Packages in VS2013 (RDotNet runtime Version v4.0.30319).

Within Windows 7 I'm running R-3.2.2 and both 32bit and 64bit reside within my C:\Program Files\R\R-3.2.2\bin folder.

Here's the beginning of my code.

using System.IO;
using System.Linq;
using RDotNet;
using RDotNet.NativeLibrary;

namespace RNetTest
{
class Program
{
static void Main(string[] args)
{
// Set the R_HOME environment variable in which R.dll is located.
Environment.SetEnvironmentVariable("R_HOME", @"C:\Program Files\R\R-3.2.2\bin\i386");

REngine engine = REngine.GetInstance("RDotNet");

It fails on the GetInstance with the error:

An unhandled exception of type 'System.ArgumentException' occurred in DynamicInterop.dll

Additional information: Could not retrieve a pointer for the symbol 'R_CStackLimit' in file 'RDotNet'

If I run REngine.GetInstance(); like is suggested I get the following error:

An unhandled exception of type 'System.Exception' occurred in DynamicInterop.dll

Additional information: This 32-bit process failed to load the library R.dll. Native error message is 'The system cannot find the file specified'

I've been wrestling with this for many hours now and finally asking for some help on what a solution might be. It should be noted the error is the same for 32bit or 64bit R.dll versions.


Comments: Is R_HOME set?

Commented Unassigned: REngine.GetInstance fails [177]

$
0
0
Hi, I'm new to R but really would love to use it in my C# programs via RDotNet. I've added R.net via Manage NuGet Packages in VS2013 (RDotNet runtime Version v4.0.30319).

Within Windows 7 I'm running R-3.2.2 and both 32bit and 64bit reside within my C:\Program Files\R\R-3.2.2\bin folder.

Here's the beginning of my code.

using System.IO;
using System.Linq;
using RDotNet;
using RDotNet.NativeLibrary;

namespace RNetTest
{
class Program
{
static void Main(string[] args)
{
// Set the R_HOME environment variable in which R.dll is located.
Environment.SetEnvironmentVariable("R_HOME", @"C:\Program Files\R\R-3.2.2\bin\i386");

REngine engine = REngine.GetInstance("RDotNet");

It fails on the GetInstance with the error:

An unhandled exception of type 'System.ArgumentException' occurred in DynamicInterop.dll

Additional information: Could not retrieve a pointer for the symbol 'R_CStackLimit' in file 'RDotNet'

If I run REngine.GetInstance(); like is suggested I get the following error:

An unhandled exception of type 'System.Exception' occurred in DynamicInterop.dll

Additional information: This 32-bit process failed to load the library R.dll. Native error message is 'The system cannot find the file specified'

I've been wrestling with this for many hours now and finally asking for some help on what a solution might be. It should be noted the error is the same for 32bit or 64bit R.dll versions.


Comments: Yes, I have R_HOME as a system variable set to the file location where the R.dll is located. See the attached image:

Commented Unassigned: REngine.GetInstance fails [177]

$
0
0
Hi, I'm new to R but really would love to use it in my C# programs via RDotNet. I've added R.net via Manage NuGet Packages in VS2013 (RDotNet runtime Version v4.0.30319).

Within Windows 7 I'm running R-3.2.2 and both 32bit and 64bit reside within my C:\Program Files\R\R-3.2.2\bin folder.

Here's the beginning of my code.

using System.IO;
using System.Linq;
using RDotNet;
using RDotNet.NativeLibrary;

namespace RNetTest
{
class Program
{
static void Main(string[] args)
{
// Set the R_HOME environment variable in which R.dll is located.
Environment.SetEnvironmentVariable("R_HOME", @"C:\Program Files\R\R-3.2.2\bin\i386");

REngine engine = REngine.GetInstance("RDotNet");

It fails on the GetInstance with the error:

An unhandled exception of type 'System.ArgumentException' occurred in DynamicInterop.dll

Additional information: Could not retrieve a pointer for the symbol 'R_CStackLimit' in file 'RDotNet'

If I run REngine.GetInstance(); like is suggested I get the following error:

An unhandled exception of type 'System.Exception' occurred in DynamicInterop.dll

Additional information: This 32-bit process failed to load the library R.dll. Native error message is 'The system cannot find the file specified'

I've been wrestling with this for many hours now and finally asking for some help on what a solution might be. It should be noted the error is the same for 32bit or 64bit R.dll versions.


Comments: UPDATE: I restarted my machine to ensure that all of my environment variable changes actually took effect and now I'm back to my original error message when calling GetInstance(); Here is the error: REngine.SetEnvironmentVariables(); REngine engine = REngine.GetInstance(); The specified module could not be found System.Exception: This 32-bit process failed to load the library R.dll. Native error message is 'The operation completed successfully' at DynamicInterop.UnmanagedDll.ThrowFailedLibraryLoad(String dllFullName, String nativeError) at DynamicInterop.UnmanagedDll.ReportLoadLibError(String dllName, String nativeError) at DynamicInterop.UnmanagedDll..ctor(String dllName) at RDotNet.REngine..ctor(String id, String dll) at RDotNet.REngine.CreateInstance(String id, String dll) at RDotNet.REngine.GetInstance(String dll, Boolean initialize, StartupParameter parameter, ICharacterDevice device) at RNetTest.Program.Main(String[] args) in c:\Users\cmenright\Documents\Visual Studio 2013\Projects\RNetTest\RNetTest\Program.cs:line 25
Viewing all 1634 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>