Unable to install packages with error: Error: package or namespace load failed for ‘utf8’ in dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object '/opt/R/R-4.2.1/library/00LOCK-utf8/00new/utf8/libs/utf8.so': /opt/R/R-4.2.1/library/00LOC

Hello,

I initially tried installing highcharter package, but dependencies were not getting installed so I installed utf8 package on our Linux server but receiving below error:

Error: package or namespace load failed for ‘utf8’ in dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object '/opt/R/R-4.2.1/library/00LOCK-utf8/00new/utf8/libs/utf8.so': /opt/R/R-4.2.1/library/00LOC

We are using R: 4.2.1 and Linux Centos 7

I raised a support case and tried three suggestions with the analyst but received the same error:

  1. Modified rstudio-connect.gcfg > Restarted the service > Installed package using binaries

[RPackageRepository "CRAN"]
URL=https://packagemanager.posit.co/cran/__linux__/centos7/latest

  1. Ran this command: options(install.packages.compile.from.source = "never")

  2. Ran below commands:
    export R_VERSION=4.2.1
    /opt/R/R-${R_VERSION}/bin/R
    install.packages('utf8')

The analyst thinks this is a complier issue in R and suggested to post it here.

This is my first time posting so I may be missing some important information. Please let me know if you need more info. Thank you in advance!

Hi @ejl03
The 00LOCK-xxxx directory and files are created during the installation of a package and are usually removed automatically upon completion. But if package installation fails or is interrupted the LOCK files can be left behind which then blocks subsequent attempts at installation. So, in your case, one possible solution is to manually delete the 00LOCK-xxxx directory and it’s contents, re-start RStudio, and try the installation again.

The {pacman} package has a function, p_unlock(), to achieve this but there’s a Catch-22 here - if LOCK already exists then you can’t install pacman to fix it. So, if this happens in future, have pacman pre-installed ready to go.

we checked but there is no 00LOCK-xxxx directory as pacman is already installed,
please suggest any other way,

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.