Cannot install RcppEigen in R

I have been unable to install RcppEigen or any package that depends on it (e.g., mice, glmnet, lme4, etc.) using the RStudio IDE on Posit Cloud. The error I get is the following:

ERROR: failed to lock directory ‘/cloud/lib/x86_64-pc-linux-gnu-library/4.4’ for modifying
  Try removing ‘/cloud/lib/x86_64-pc-linux-gnu-library/4.4/00LOCK-RcppEigen’

I tried to get around this by running unlink(‘/cloud/lib/x86_64-pc-linux-gnu-library/4.4/00LOCK-RcppEigen’, recursive=TRUE), and that began the download process, but then the session crashed and had to be reloaded.

I then tried install.packages("RcppEigen", dependencies=TRUE, INSTALL_opts = c('--no-lock')), but that led to the same initial downloading progress and then crashing of the session.

After trying that second option, I'm getting new errors when trying install.packages("glmnet"):

    4 | #include <RcppEigen.h>
      |          ^~~~~~~~~~~~~
compilation terminated.
make: *** [/opt/R/4.4.3/lib/R/etc/Makeconf:204: RcppExports.o] Error 1
ERROR: compilation failed for package ‘glmnet’
* removing ‘/cloud/lib/x86_64-pc-linux-gnu-library/4.4/glmnet’

Please help me troubleshoot this. Many important packages rely on RcppEigen, and I imagine other important packages may also require Rcpp-related dependencies that would encounter a similar issue.

1 Like

[quote="JJ_Test, post:1, topic:209950"]
`` Try removing ‘/cloud/lib/x86_64-pc-linux-gnu-library/4.4/00LOCK-RcppEigen’`
[/quote]

I have no idea what caused the problem originally but you need to delete that lock file.

00LOCK-RcppEigen

Hi @JJ_Test , @jrkrideau

Thank you for the question. We find that with the smaller plans, installation of some of the larger packages, that require compilation, can fail.

We have had success installing the packages into the newer OS available in the settings.

Can you try changing your default image from Ubuntu 20 to Ubuntu 24 and letting us know if that resolves the issue?

Thanks.

Thanks for your comment. I did switch the default to Ubuntu 24.04, but something failed when it tried to update the renv.

I was still encountering the same error as the last one I saw, which came after unlinking the 00LOCK-RcppEigen file:

install.packages('RcppEigen')
Installing package into ‘/cloud/lib/x86_64-pc-linux-gnu-library/4.4’
(as ‘lib’ is unspecified)
trying URL 'http://rspm/default/__linux__/noble/latest/src/contrib/RcppEigen_0.3.4.0.2.tar.gz'
Content type 'application/x-gzip' length 1761370 bytes (1.7 MB)
==================================================
downloaded 1.7 MB

ERROR: failed to lock directory ‘/cloud/lib/x86_64-pc-linux-gnu-library/4.4’ for modifying
Try removing ‘/cloud/lib/x86_64-pc-linux-gnu-library/4.4/00LOCK-RcppEigen’
The downloaded source packages are in
	‘/tmp/Rtmpi0YMK0/downloaded_packages’
Warning message:
In utils::install.packages("RcppEigen") :
  installation of package ‘RcppEigen’ had non-zero exit status

However, after following the advice to remove the 00LOCK-RcppEigen directory, the RcppEigen and glmnet packages did install and load, albeit with a huge amount of printed messages that seemed to repeatedly terminate in the following:

/cloud/lib/x86_64-pc-linux-gnu-library/4.4/RcppEigen/include/Eigen/src/Core/CoreEvaluators.h:1071:54: warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits<double>::type’ {aka ‘__m128d’} [-Wignored-attributes]
 1071 |     PacketAlignment = unpacket_traits<PacketScalar>::alignment,
      |                                                      ^~~~~~~~~

Everything seems okay now except all the printed messages, so I think it's okay to close this ticket unless you foresee a probem based on the printed output.

Thanks again!

I'm having the same issue on Posit Cloud with both RcppEigen and BayesFactor, which requires RcppEigen.

Following the advice above, I did remove the lock files, and verified that my OS is set to Ubuntu 24.04. I can now install RcppEigen (following a long string of messages, as described by OP). However, I can't load it; I get the following message:

Error: package or namespace load failed for ‘RcppEigen’ in get(Info[i, 1], envir = env):
 lazy-load database '/cloud/lib/x86_64-pc-linux-gnu-library/4.5/RcppEigen/R/RcppEigen.rdb' is corrupt
In addition: Warning message:
In get(Info[i, 1], envir = env) :
  internal error 1 in R_decompress1 with libdeflate

Trying to install BayesFactor produces the same problem as described by the original poster; many of the printed messages refer to RcppEigen. I've tried installing both RcppEigen and BayesFactor from archive (.tar.gz) files rather than CRAN, and installing both from CRAN with and without dependencies, but get the same results. The packages install, load, and work just fine on my Mac desktop RStudio.

I have a class of 100 students trying to use these packages for an assignment due next week, so any advice is much appreciated!

This means that you loaded a different version of the package than the one installed on the disk right now, probably because you installed a different version after loading the package.

The solution is to restart the R session.

Thank you for the quick reply! Unfortunately, after uninstalling RcppEigen, restarting the R session, removing the lock file (again), and installing RcppEigen again, the install consistently hangs up on this message:

./inst/include/Eigen/src/Core/DenseCoeffsBase.h:56:30: warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits<double>::type’ {aka ‘__m128d’} [-Wignored-attributes]

It freezes long enough that I get a popup message: "Login expired or signed out from another window."

I've just repeated those steps for the third time; it always freezes, always on that same line, and has yet to complete the install without kicking me out.

No need to uninstall it, restarting the R session like I suggested above is sufficient...

Anyway, that's not an error message, it is a harmless warning. I would make sure to be logged in to Posit Cloud from one browser window. Then try again.

Since this is an issue with Posit Cloud, I suggest you add that tag to your post, or create a new port that is clearly tagged as "Posit Cloud", so the right people see it and they can help you.

Thanks! I am definitely logged in via only one window (restarted computer to be sure).

I know that warning isn't an error - I just noticed that it's consistently freezing at the same spot in the warnings. Unfortunately, restarting the session wasn't sufficient.

I don't believe I can tag as I'm not the OP here, I'll try starting a new post.

Faced the same issue and followed JJ_Test's procedure on unlinking "4.5/00LOCK-RcppEigen" and "glmnet". Session crashes after a wealth of processing messages upon re-installing RccpEigen and glmnet. My OS is windows 10 Pro, version 22H2, and its build is 19045.6466.

Here is the code I use to run after re-installation;

install.packages("RcppEigen", dependencies = T, INSTALL_opts = c("--no-lock"))

What could be going wrong here @Lachlan_Simpson ?

@Tino Thank you for asking, great question. In your case, the issue will be different. The original question was using https://posit.cloud.

You are using Windows 10? Can you please confirm you have the appropriate version of RTools installed.

Can you share more of the error message that you see when the installation fails?

These two packages can require quite a large amount of memory - does your system have enough memory to spare?

Yes, I am using Windows 10 -- still haven't upgraded my operating system.

I confirm that I was able to install the version of RTools from the link you shared, and was able to install the "stm" package offline. However, I was initially working from "posit.cloud" and would like to continue working from there.

The problem still persist on posit, with the clash happening at the error messages as shown in this image.

Hi @Tino thank you for the update.

Can you please check to see which OS you are using - the same solution previously mentioned in this thread should work for you, too.

Let us know if changing the project to use Ubuntu 24 images doesn't work.

It did work swiftly after changing my RStudio Cloud's system from Ubuntu 20 to Ubuntu 24.

Many thanks.

1 Like

This topic was automatically closed 7 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.