Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
webportal
Impactful Individual
Impactful Individual

Error: package or namespace load failed for 'ggplot2': package 'ggplot2' was installed before R 4.0.

I'm really stuck and need some help.

After installing R 4.0.2, I'm getting this error message on R visualizations in Power BI Desktop which were previously working

"Error: package or namespace load failed for 'ggplot2':
 package 'ggplot2' was installed before R 4.0.0: please re-install it.
 Execution halted"

I already tried to:

reinstall R 4.0.2reinstall RStudio

reinstall ggplot2 

reinstall all packages

reinstall Power BI Desktop. My version is August-2020

Still it does not work.

Considerations:

My visualizations were working well before I installed R 4.0.2My visualizations are working well on other PCs

When I run the code on RStudio I don't get any error

Any thoughts?

8 REPLIES 8
DanMandle
Frequent Visitor

Have folks discovered other workarounds to the error? It's a bummer to have to remove old instances of R to get ggplot2 to work in Power BI. Particularly since there are some visualizations in PBI that only work on some of the older instances, and some on the newer instances. 

I just changed it to my old version and it worked.

 

peterhui50_0-1621629766481.png

 

dpombal
Post Patron
Post Patron

I have same issue, after updating R 3.5.3 to R 4.0.2

 

2020-10-07T15:16:27.4697043Z

Local Time:
2020-10-07T17:16:27.4697043+02:00

Session ID:
e6c0803a-de48-4baa-95d2-15388843f4f0

Release:
August 2020

Product Version:
2.84.981.0 (20.08) (x64)

Error Message:
Error del script R.
Error: package or namespace load failed for 'ggplot2':
package 'ggplot2' was installed before R 4.0.0: please re-install it
Ejecución interrumpida


Stack Trace:
Microsoft.PowerBI.ExploreServiceCommon.ScriptHandlerException: Error del script R.
Error: package or namespace load failed for 'ggplot2':
package 'ggplot2' was installed before R 4.0.0: please re-install it
Ejecución interrumpida
---> Microsoft.PowerBI.Scripting.R.Exceptions.RScriptRuntimeException: Error del script R.
Error: package or namespace load failed for 'ggplot2':
package 'ggplot2' was installed before R 4.0.0: please re-install it
Ejecución interrumpida

v-diye-msft
Community Support
Community Support

Hi @webportal 

 

Try below solution:

Find the root folder of R :

000.png

Run it and input : 

install.packages("ggplot2")

then enter "yes>yes.." until finished.

0002.png

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

Problem is solved after DELETING old libraries inside

 

"<user>/documents/R" and in "<user>/library"

 

 

You can see in .libPaths 2 routes but....PowerBI also uses...  "C:\<user>/library"  ....remove old ones from here

  • "C:\<user>/documents/R"
  • C:\Program Files\R\R-4.0.2\library
webportal
Impactful Individual
Impactful Individual

Actually, I had also tried that. I had conflicting versions of packages, and deleted all the old ones and reinstalled everything again to 4.0.2.
It didn't work, so I uninstalled all 4.0.2 again, including R Gui and R Studio and reinstalled all 3.6.3. and it finally worked!

Not worked for me

 


Stack Trace:
Microsoft.PowerBI.ExploreServiceCommon.ScriptHandlerException: Error del script R.
Error: package or namespace load failed for 'ggplot2':
package 'ggplot2' was installed before R 4.0.0: please re-install it
Ejecución interrumpida
---> Microsoft.PowerBI.Scripting.R.Exceptions.RScriptRuntimeException: Error del script R.
Error: package or namespace load failed for 'ggplot2':
package 'ggplot2' was installed before R 4.0.0: please re-install it
Ejecución interrumpida

Hi,
Sure; I did that as per my post above.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.