Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi - I have R 4.0.5 installed and trying to get the Clustering with Outliers visual to work. I keep getting this error message despite loading the packages it's mentioning into R. Does anyone know how to fix this issue?
Feedback Type:
Frown (Error)
Timestamp:
2021-04-16T15:33:36.4340855Z
Local Time:
2021-04-16T08:33:36.4340855-07:00
Session ID:
36d44cfa-2372-4380-8fcd-3a5d7199f8b5
Release:
March 2021
Product Version:
2.91.884.0 (21.03) (x64)
Error Message:
R script error.
Loading required package: scales
Error: package or namespace load failed for 'scales':
package 'scales' was installed before R 4.0.0: please re-install it
Warning message:
In libraryRequireInstall("scales") : *** Failed to install 'scales' ***
Loading required package: fpc
Loading required package: car
Loading required package: carData
Loading required package: dbscan
Attaching package: 'dbscan'
The following object is masked from 'package:fpc':
dbscan
Error in alpha(colpoints, pointOpacity) : could not find function "alpha"
Calls: plot -> plot.default -> plot.xy
Execution halted
Stack Trace:
Microsoft.PowerBI.ExploreServiceCommon.ScriptHandlerException: R script error.
Loading required package: scales
Error: package or namespace load failed for 'scales':
package 'scales' was installed before R 4.0.0: please re-install it
Warning message:
In libraryRequireInstall("scales") : *** Failed to install 'scales' ***
Loading required package: fpc
Loading required package: car
Loading required package: carData
Loading required package: dbscan
Attaching package: 'dbscan'
The following object is masked from 'package:fpc':
dbscan
Error in alpha(colpoints, pointOpacity) : could not find function "alpha"
Calls: plot -> plot.default -> plot.xy
Execution halted
---> Microsoft.PowerBI.Scripting.R.Exceptions.RScriptRuntimeException: R script error.
Loading required package: scales
Error: package or namespace load failed for 'scales':
package 'scales' was installed before R 4.0.0: please re-install it
Warning message:
In libraryRequireInstall("scales") : *** Failed to install 'scales' ***
Loading required package: fpc
Loading required package: car
Loading required package: carData
Loading required package: dbscan
Attaching package: 'dbscan'
The following object is masked from 'package:fpc':
dbscan
Error in alpha(colpoints, pointOpacity) : could not find function "alpha"
Calls: plot -> plot.default -> plot.xy
Execution halted
at Microsoft.PowerBI.Scripting.R.RScriptWrapper.RunScript(String originalScript, Int32 timeoutMs)
at Microsoft.PowerBI.Client.Windows.R.RScriptHandler.GenerateVisual(ScriptHandlerOptions options)
--- End of inner exception stack trace ---
at Microsoft.PowerBI.Client.Windows.R.RScriptHandler.GenerateVisual(ScriptHandlerOptions options)
at Microsoft.PowerBI.ExploreServiceCommon.ScriptVisualCommandFlow.RunInternal(Stream dataShapeResultStream, QueryBindingDescriptor& bindingDescriptor)
at Microsoft.PowerBI.ExploreServiceCommon.ScriptVisualCommandFlow.Run(Stream dataShapeResultStream, QueryBindingDescriptor& bindingDescriptor)
at Microsoft.PowerBI.ExploreHost.SemanticQuery.ExecuteSemanticQueryFlow.TransformDataShapeResult(QueryCommand transformCommand, SemanticQueryDataShapeCommand command, Stream dataShapeResultStream, QueryBindingDescriptor& bindingDescriptor)
at Microsoft.PowerBI.ExploreHost.SemanticQuery.ExecuteSemanticQueryFlow.ExecuteDataQuery(IQueryResultDataWriter queryResultDataWriter, EngineDataModel engineDataModel, DataQuery query, Int32 queryId, ServiceErrorStatusCode& serviceErrorStatusCode, CancellationToken cancelToken)
at Microsoft.PowerBI.ExploreHost.SemanticQuery.ExecuteSemanticQueryFlow.ProcessAndWriteSemanticQueryCommands(IQueryResultsWriter queryResultsWriter, IList`1 queries, HashSet`1 pendingQueriesToCancel, EngineDataModel engineDataModel)
Invocation Stack Trace:
at Microsoft.Mashup.Host.Document.ExceptionExtensions.GetCurrentInvocationStackTrace()
at Microsoft.Mashup.Client.UI.Shared.StackTraceInfo..ctor(String exceptionStackTrace, String invocationStackTrace, String exceptionMessage)
at Microsoft.PowerBI.Client.Windows.ErrorHostService.GetErrorDetails(ShowErrorDialogArgs args)
at Microsoft.PowerBI.Client.Windows.ErrorHostService.<>c__DisplayClass5_0.<ShowErrorDialogCore>b__0()
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)
at System.Windows.Forms.Control.Invoke(Delegate method, Object[] args)
at System.Windows.Forms.WindowsFormsSynchronizationContext.Send(SendOrPostCallback d, Object state)
at Microsoft.PowerBI.Client.Windows.Services.UIBlockingService.AllowModalDialogs(Action action)
at Microsoft.PowerBI.Client.Windows.ErrorHostService.<ShowErrorDialogCore>d__5.MoveNext()
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
at Microsoft.PowerBI.Client.Windows.ErrorHostService.ShowErrorDialogCore(String errorDialogArgs)
at Microsoft.PowerBI.Client.Windows.HostServiceDispatcher.<>c__DisplayClass6_0`1.<ExecuteOnUIThread>b__0()
at Microsoft.PowerBI.Client.Windows.HostServiceDispatcher.<>c__DisplayClass5_0.<ExecuteOnUIThread>b__0(Object t)
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at Microsoft.Mashup.Client.UI.Shared.WindowManager.ShowModal[T](T dialog, Func`1 showModalFunction)
at Microsoft.PowerBI.Client.Program.<>c__DisplayClass4_0.<Main>b__1()
at Microsoft.PowerBI.Client.Windows.IExceptionHandlerExtensions.<>c__DisplayClass3_0.<HandleExceptionsWithNestedTasks>b__0()
at Microsoft.Mashup.Host.Document.ExceptionHandlerExtensions.HandleExceptions(IExceptionHandler exceptionHandler, Action action)
at Microsoft.PowerBI.Client.Program.Main(String[] args)
Solved! Go to Solution.
I downgraded my version of R to 3.5.3 and got the visuals to work.
I downgraded my version of R to 3.5.3 and got the visuals to work.
Hi, @jgray72
There may be a problem with the previous installation, and you may need to uninstall it.
Do you try to download Microsoft R Open 4.0.2? Download . MRAN (revolutionanalytics.com)
Follow the steps in the document:
Create Power BI visuals using R - Power BI | Microsoft Docs
If it doesn’t solve your problem, please feel free to ask me.
Best Regards
Janey Guo
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi - I took off my previous instance of R and installed Microsoft R Open 4.0.2; I stillget errors. If I go to R and install the packages that it says that it's missing, it still doesn't recognize them. I have rebooted, open and closed Power BI, etc.
Feedback Type:
Frown (Error)
Timestamp:
2021-04-19T16:13:35.7085687Z
Local Time:
2021-04-19T09:13:35.7085687-07:00
Session ID:
c40f1718-5eac-4b3a-92f1-c4cc85515445
Release:
April 2021
Product Version:
2.92.706.0 (21.04) (x64)
Error Message:
R script error.
Loading required package: XML
Error: package or namespace load failed for 'XML':
package 'XML' was installed before R 4.0.0: please re-install it
Warning message:
In libraryRequireInstall("XML") :
*** The package: 'XML' was not installed ***
Loading required package: htmlwidgets
Error: package or namespace load failed for 'htmlwidgets':
package 'htmlwidgets' was installed before R 4.0.0: please re-install it
Warning message:
In libraryRequireInstall("htmlwidgets") :
*** The package: 'htmlwidgets' was not installed ***
Loading required package: base64enc
Error: package or namespace load failed for 'base64enc':
package 'base64enc' was installed before R 4.0.0: please re-install it
Warning message:
In libraryRequireInstall("base64enc") :
*** The package: 'base64enc' was not installed ***
Loading required package: nloptr
Loading required package: seriation
Loading required package: NbClust
Loading required package: cluster
Loading required package: car
Loading required package: carData
Error: package or namespace load failed for 'car':
package 'data.table' was installed before R 4.0.0: please re-install it
Loading required package: scales
Loading required package: fpc
Loading required package: mclust
Package 'mclust' version 5.4.7
Type 'citation("mclust")' for citing this R package in publications.
Loading required package: apcluster
Error: package or namespace load failed for 'apcluster':
package 'Rcpp' was installed before R 4.0.0: please re-install it
Loading required package: vegan
Loading required package: permute
Attaching package: 'permute'
The following object is masked from 'package:seriation':
permute
Loading required package: lattice
Attaching package: 'lattice'
The following object is masked from 'package:seriation':
panel.lines
Registered S3 method overwritten by 'vegan':
method from
reorder.hclust seriation
This is vegan 2.5-7
Loading required package: Redmonder
Loading required package: caTools
Loading required package: ggplot2
Loading required package: plotly
Error: package or namespace load failed for 'plotly':
package 'plotly' was installed before R 4.0.0: please re-install it
Error in plotly_build(gg) : could not find function "plotly_build"
Execution halted
Stack Trace:
Microsoft.PowerBI.ExploreServiceCommon.ScriptHandlerException: R script error.
Loading required package: XML
Error: package or namespace load failed for 'XML':
package 'XML' was installed before R 4.0.0: please re-install it
Warning message:
In libraryRequireInstall("XML") :
*** The package: 'XML' was not installed ***
Loading required package: htmlwidgets
Error: package or namespace load failed for 'htmlwidgets':
package 'htmlwidgets' was installed before R 4.0.0: please re-install it
Warning message:
In libraryRequireInstall("htmlwidgets") :
*** The package: 'htmlwidgets' was not installed ***
Loading required package: base64enc
Error: package or namespace load failed for 'base64enc':
package 'base64enc' was installed before R 4.0.0: please re-install it
Warning message:
In libraryRequireInstall("base64enc") :
*** The package: 'base64enc' was not installed ***
Loading required package: nloptr
Loading required package: seriation
Loading required package: NbClust
Loading required package: cluster
Loading required package: car
Loading required package: carData
Error: package or namespace load failed for 'car':
package 'data.table' was installed before R 4.0.0: please re-install it
Loading required package: scales
Loading required package: fpc
Loading required package: mclust
Package 'mclust' version 5.4.7
Type 'citation("mclust")' for citing this R package in publications.
Loading required package: apcluster
Error: package or namespace load failed for 'apcluster':
package 'Rcpp' was installed before R 4.0.0: please re-install it
Loading required package: vegan
Loading required package: permute
Attaching package: 'permute'
The following object is masked from 'package:seriation':
permute
Loading required package: lattice
Attaching package: 'lattice'
The following object is masked from 'package:seriation':
panel.lines
Registered S3 method overwritten by 'vegan':
method from
reorder.hclust seriation
This is vegan 2.5-7
Loading required package: Redmonder
Loading required package: caTools
Loading required package: ggplot2
Loading required package: plotly
Error: package or namespace load failed for 'plotly':
package 'plotly' was installed before R 4.0.0: please re-install it
Error in plotly_build(gg) : could not find function "plotly_build"
Execution halted
---> Microsoft.PowerBI.Scripting.R.Exceptions.RScriptRuntimeException: R script error.
Loading required package: XML
Error: package or namespace load failed for 'XML':
package 'XML' was installed before R 4.0.0: please re-install it
Warning message:
In libraryRequireInstall("XML") :
*** The package: 'XML' was not installed ***
Loading required package: htmlwidgets
Error: package or namespace load failed for 'htmlwidgets':
package 'htmlwidgets' was installed before R 4.0.0: please re-install it
Warning message:
In libraryRequireInstall("htmlwidgets") :
*** The package: 'htmlwidgets' was not installed ***
Loading required package: base64enc
Error: package or namespace load failed for 'base64enc':
package 'base64enc' was installed before R 4.0.0: please re-install it
Warning message:
In libraryRequireInstall("base64enc") :
*** The package: 'base64enc' was not installed ***
Loading required package: nloptr
Loading required package: seriation
Loading required package: NbClust
Loading required package: cluster
Loading required package: car
Loading required package: carData
Error: package or namespace load failed for 'car':
package 'data.table' was installed before R 4.0.0: please re-install it
Loading required package: scales
Loading required package: fpc
Loading required package: mclust
Package 'mclust' version 5.4.7
Type 'citation("mclust")' for citing this R package in publications.
Loading required package: apcluster
Error: package or namespace load failed for 'apcluster':
package 'Rcpp' was installed before R 4.0.0: please re-install it
Loading required package: vegan
Loading required package: permute
Attaching package: 'permute'
The following object is masked from 'package:seriation':
permute
Loading required package: lattice
Attaching package: 'lattice'
The following object is masked from 'package:seriation':
panel.lines
Registered S3 method overwritten by 'vegan':
method from
reorder.hclust seriation
This is vegan 2.5-7
Loading required package: Redmonder
Loading required package: caTools
Loading required package: ggplot2
Loading required package: plotly
Error: package or namespace load failed for 'plotly':
package 'plotly' was installed before R 4.0.0: please re-install it
Error in plotly_build(gg) : could not find function "plotly_build"
Execution halted
at Microsoft.PowerBI.Scripting.R.RScriptWrapper.RunScript(String originalScript, Int32 timeoutMs)
at Microsoft.PowerBI.Client.Windows.R.RScriptHandler.GenerateVisual(ScriptHandlerOptions options)
--- End of inner exception stack trace ---
at Microsoft.PowerBI.Client.Windows.R.RScriptHandler.GenerateVisual(ScriptHandlerOptions options)
at Microsoft.PowerBI.ExploreServiceCommon.ScriptVisualCommandFlow.RunInternal(Stream dataShapeResultStream, QueryBindingDescriptor& bindingDescriptor)
at Microsoft.PowerBI.ExploreServiceCommon.ScriptVisualCommandFlow.Run(Stream dataShapeResultStream, QueryBindingDescriptor& bindingDescriptor)
at Microsoft.PowerBI.ExploreHost.SemanticQuery.ExecuteSemanticQueryFlow.TransformDataShapeResult(QueryCommand transformCommand, SemanticQueryDataShapeCommand command, Stream dataShapeResultStream, QueryBindingDescriptor& bindingDescriptor)
at Microsoft.PowerBI.ExploreHost.SemanticQuery.ExecuteSemanticQueryFlow.ExecuteDataQuery(IQueryResultDataWriter queryResultDataWriter, EngineDataModel engineDataModel, DataQuery query, Int32 queryId, ServiceErrorStatusCode& serviceErrorStatusCode, CancellationToken cancelToken)
at Microsoft.PowerBI.ExploreHost.SemanticQuery.ExecuteSemanticQueryFlow.ProcessAndWriteSemanticQueryCommands(IQueryResultsWriter queryResultsWriter, IList`1 queries, HashSet`1 pendingQueriesToCancel, EngineDataModel engineDataModel)
Invocation Stack Trace:
at Microsoft.Mashup.Host.Document.ExceptionExtensions.GetCurrentInvocationStackTrace()
at Microsoft.Mashup.Client.UI.Shared.StackTraceInfo..ctor(String exceptionStackTrace, String invocationStackTrace, String exceptionMessage)
at Microsoft.PowerBI.Client.Windows.ErrorHostService.GetErrorDetails(ShowErrorDialogArgs args)
at Microsoft.PowerBI.Client.Windows.ErrorHostService.<>c__DisplayClass5_0.<ShowErrorDialogCore>b__0()
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)
at System.Windows.Forms.Control.Invoke(Delegate method, Object[] args)
at System.Windows.Forms.WindowsFormsSynchronizationContext.Send(SendOrPostCallback d, Object state)
at Microsoft.PowerBI.Client.Windows.Services.UIBlockingService.AllowModalDialogs(Action action)
at Microsoft.PowerBI.Client.Windows.ErrorHostService.<ShowErrorDialogCore>d__5.MoveNext()
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
at Microsoft.PowerBI.Client.Windows.ErrorHostService.ShowErrorDialogCore(String errorDialogArgs)
at Microsoft.PowerBI.Client.Windows.HostServiceDispatcher.<>c__DisplayClass6_0`1.<ExecuteOnUIThread>b__0()
at Microsoft.PowerBI.Client.Windows.HostServiceDispatcher.<>c__DisplayClass5_0.<ExecuteOnUIThread>b__0(Object t)
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at Microsoft.Mashup.Client.UI.Shared.WindowManager.ShowModal[T](T dialog, Func`1 showModalFunction)
at Microsoft.PowerBI.Client.Program.<>c__DisplayClass4_0.<Main>b__1()
at Microsoft.PowerBI.Client.Windows.IExceptionHandlerExtensions.<>c__DisplayClass3_0.<HandleExceptionsWithNestedTasks>b__0()
at Microsoft.Mashup.Host.Document.ExceptionHandlerExtensions.HandleExceptions(IExceptionHandler exceptionHandler, Action action)
at Microsoft.PowerBI.Client.Program.Main(String[] args)
Hi, @jgray72
I doubt that you did not completely delete the R package you installed before.
Here is a solved case that explains how to uninstall and install. You can follow it or find your own installation path and check whether all previous versions of R packages have been completely removed.
In addition, the version of R installed in different versions (such as mac and linux) seems to be different, you need to confirm which one to download. CRAN - Mirrors (r-project.org)
Here is a tutorial for using R in powerbi:
Run R scripts in Power BI Desktop - Power BI | Microsoft Docs
If it doesn’t solve your problem, please feel free to ask me.
Best Regards
Janey Guo
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi - I still can't get it to work. I will just not use the visuals, as I have already spent hours on this problem.
@jgray72 , seems like package is missing or outdated
package 'scales' was installed before R 4.0.0: please re-install it
Hi - I did reinstall that package and it still doesn't work.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
146 | |
110 | |
93 | |
84 | |
67 |