cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Prodigy
Post Prodigy

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?

6 REPLIES 6
Highlighted
Community Support
Community Support

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

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.
Highlighted
Post Prodigy
Post Prodigy

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

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

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

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

Highlighted
Post Patron
Post Patron

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

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

Highlighted
Post Patron
Post Patron

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

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
Highlighted
Post Prodigy
Post Prodigy

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

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!

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Upcoming Events

Experience what’s next for Power BI

See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors
Top Kudoed Authors