Cannot install tmap on R studio on a Ubuntu computer

I tried installing tmap but this is what I get :

install.packages("tmap")

I skipped the start because I can't put more links but it just tries URLs for different dependencies

Here are the errors :

ERROR: failed to lock directory ‘/home/rebecca/R/x86_64-pc-linux-gnu-library/3.6’ for modifying
Try removing ‘/home/rebecca/R/x86_64-pc-linux-gnu-library/3.6/00LOCK-lwgeom’
Warning in install.packages :
installation of package ‘lwgeom’ had non-zero exit status
ERROR: dependency ‘lwgeom’ is not available for package ‘stars’

  • removing ‘/home/rebecca/R/x86_64-pc-linux-gnu-library/3.6/stars’
    Warning in install.packages :
    installation of package ‘stars’ had non-zero exit status
    ERROR: dependencies ‘lwgeom’, ‘stars’ are not available for package ‘tmaptools’
  • removing ‘/home/rebecca/R/x86_64-pc-linux-gnu-library/3.6/tmaptools’
    Warning in install.packages :
    installation of package ‘tmaptools’ had non-zero exit status
    ERROR: dependencies ‘tmaptools’, ‘stars’ are not available for package ‘tmap’
  • removing ‘/home/rebecca/R/x86_64-pc-linux-gnu-library/3.6/tmap’
    Warning in install.packages :
    installation of package ‘tmap’ had non-zero exit status

The downloaded source packages are in
‘/tmp/Rtmpxzvtun/downloaded_packages’

What should I do to make it work?

This means that you have a lock file which is intended to prevent you overwriting a file lwgeom . It probably is there because of an error in the installation process or if you had to restart R or RStudio during the installation. You need to navigate to that directory home/rebecca/R/x86_64-pc-linux-gnu-library/3.6/ and delete 00LOCK-lwgeom

This may not cure the problem but it will let you start over to see what other error messages appear.

Please post anything in the output without a URL. It should hep us debug the problem.
Edit
What versions of R, Rstudio & Ubuntu?

Update

I tried installing tmap and got errors but no lock file.

For some reason tmap was not loading the sp package.
you might want to try

install.packages("sp")

before

install.packages("tmap")