cancel
Showing results for 
Search instead for 
Did you mean: 
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

webportal
Impactful Individual
Impactful Individual

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

Helpful resources

Announcements
August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power BI Dev Camp Session 24 without aka link and time 768x460.jpg

Ted's Dev Camp - July 28, 2022

Watch Session 24 of Ted's Dev Camp along with past sessions!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors